Function tensorsolve
pub fn tensorsolve<T, C>(
ctx: &mut C,
a: &Tensor<T>,
b: &Tensor<T>,
dims: Option<&[usize]>,
) -> Result<Tensor<T>, Error>where
T: KernelLinalgScalar,
C: TensorLinalgContextFor<T>,
<C as TensorLinalgContextFor<T>>::Backend: 'static,Expand description
Solve a tensorized linear system.
Reshapes a and b into a standard linear system and solves it.
ยงExamples
use tenferro_linalg::tensorsolve;
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, 1.0], &[2, 2], col).unwrap();
let b = Tensor::<f64>::from_slice(&[3.0, 4.0], &[2], col).unwrap();
let x = tensorsolve(&mut ctx, &a, &b, None).unwrap();
assert_eq!(x.dims(), &[2]);