pub struct LuResult<T: Scalar> {
pub p: Tensor<T>,
pub l: Tensor<T>,
pub u: Tensor<T>,
}Expand description
LU decomposition result: A = P * L * U.
For an input of shape (m, n, *) with k = min(m, n):
p: permutation matrix tensor of shape(m, m, *)or an empty tensor of shape[0]when pivoting is disabledl: shape(m, k, *)u: shape(k, n, *)
§Examples
use tenferro_linalg::{lu, LuPivot};
use tenferro_prims::CpuContext;
use tenferro_tensor::{MemoryOrder, Tensor};
let mut ctx = CpuContext::new(1);
let a = Tensor::<f64>::from_slice(&[1.0, 0.0, 0.0, 1.0], &[2, 2], MemoryOrder::ColumnMajor)
.unwrap();
let result = lu(&mut ctx, &a, LuPivot::Partial).unwrap();
assert_eq!(result.p.dims(), &[2, 2]);Fields§
§p: Tensor<T>Row permutation matrix tensor.
l: Tensor<T>Unit lower-triangular factor.
u: Tensor<T>Upper-triangular factor.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for LuResult<T>
impl<T> !RefUnwindSafe for LuResult<T>
impl<T> Send for LuResult<T>
impl<T> Sync for LuResult<T>
impl<T> Unpin for LuResult<T>
impl<T> !UnwindSafe for LuResult<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more