pub fn lstsq<R, M, N>(
a: &OMatrix<R, M, N>,
b: &OVector<R, M>,
epsilon: R
) -> Result<Lstsq<R, N>, &'static str>where
R: RealField,
M: DimMin<N>,
N: Dim,
DimMinimum<M, N>: DimSub<U1>,
DefaultAllocator: Allocator<R, M, N> + Allocator<R, N> + Allocator<R, M> + Allocator<R, DimDiff<DimMinimum<M, N>, U1>> + Allocator<R, DimMinimum<M, N>, N> + Allocator<R, M, DimMinimum<M, N>> + Allocator<R, DimMinimum<M, N>> + Allocator<(usize, usize), DimMinimum<M, N>> + Allocator<(R, usize), DimMinimum<M, N>>,
Expand description
Return the least-squares solution to a linear matrix equation.
Computes the vector x that approximatively solves the equation a * x = b
.
Usage is maximally compatible with Python’s numpy.linalg.lstsq
.
Arguments:
a
: “Coefficient” matrix (shape: M rows, N columns)b
: Ordinate or “dependent variable” values (shape: M dimensional)epsilon
: singular values less than this are assumed to be zero.
Returns:
Result<
Lstsq,&'static str>
See the module level documentation for example of usage.