Function cross
pub fn cross<T, C>(
ctx: &mut C,
a: &Tensor<T>,
b: &Tensor<T>,
) -> Result<Tensor<T>, Error>where
T: KernelLinalgScalar,
C: TensorLinalgContextFor<T> + TensorScalarContextFor<Standard<T>>,
<C as TensorLinalgContextFor<T>>::Backend: 'static,Expand description
Compute the cross product along the leading vector axis.
Both inputs must have a leading dimension of size 3.
ยงExamples
use tenferro_linalg::cross;
use tenferro_prims::CpuContext;
use tenferro_tensor::{MemoryOrder, Tensor};
let mut ctx = CpuContext::new(1);
let col = MemoryOrder::ColumnMajor;
let a = Tensor::<f64>::from_slice(&[1.0, 0.0, 0.0], &[3], col).unwrap();
let b = Tensor::<f64>::from_slice(&[0.0, 1.0, 0.0], &[3], col).unwrap();
let c = cross(&mut ctx, &a, &b).unwrap();
assert_eq!(c.dims(), &[3]);