Struct LstsqResult
pub struct LstsqResult<S, R>{
pub solution: Tensor<S>,
pub residuals: Tensor<R>,
}Expand description
Least-squares result.
§Examples
use tenferro_linalg::lstsq;
use tenferro_prims::CpuContext;
use tenferro_tensor::{MemoryOrder, Tensor};
let mut ctx = CpuContext::new(1);
let a = Tensor::from_slice(&[1.0_f64, 0.0, 1.0, 1.0], &[2, 2], MemoryOrder::ColumnMajor)
.unwrap();
let b = Tensor::from_slice(&[1.0_f64, 2.0], &[2], MemoryOrder::ColumnMajor).unwrap();
let result = lstsq(&mut ctx, &a, &b).unwrap();
assert_eq!(result.solution.dims(), &[2]);Fields§
§solution: Tensor<S>Least-squares solution.
residuals: Tensor<R>Squared residual summaries ||AX - B||_F^2 per right-hand side, or an empty tensor.
Trait Implementations§
Auto Trait Implementations§
impl<S, R> Freeze for LstsqResult<S, R>
impl<S, R> !RefUnwindSafe for LstsqResult<S, R>
impl<S, R> Send for LstsqResult<S, R>
impl<S, R> Sync for LstsqResult<S, R>
impl<S, R> Unpin for LstsqResult<S, R>
impl<S, R> !UnwindSafe for LstsqResult<S, R>
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