Function
dist
(p: Vec<ArgIntoFloat>, q: Vec<ArgIntoFloat>, vm: &VirtualMachine)
Source from the content-addressed store, hash-verified
| 236 | |
| 237 | #[pyfunction] |
| 238 | fn dist(p: Vec<ArgIntoFloat>, q: Vec<ArgIntoFloat>, vm: &VirtualMachine) -> PyResult<f64> { |
| 239 | let p = ArgIntoFloat::vec_into_f64(p); |
| 240 | let q = ArgIntoFloat::vec_into_f64(q); |
| 241 | if p.len() != q.len() { |
| 242 | return Err(vm.new_value_error("both points must have the same number of dimensions")); |
| 243 | } |
| 244 | Ok(pymath::math::dist(&p, &q)) |
| 245 | } |
| 246 | |
| 247 | #[pyfunction] |
| 248 | fn sin(x: ArgIntoFloat, vm: &VirtualMachine) -> PyResult<f64> { |