Skip to content

Commit

Permalink
Rename LeastSquaresOutput to LeastSquaresOwned
Browse files Browse the repository at this point in the history
  • Loading branch information
termoshtt committed Sep 27, 2022
1 parent 38c64c9 commit ac2f7bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lax/src/least_squares.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cauchy::*;
use num_traits::{ToPrimitive, Zero};

/// Result of LeastSquares
pub struct LeastSquaresOutput<A: Scalar> {
pub struct LeastSquaresOwned<A: Scalar> {
/// singular values
pub singular_values: Vec<A::Real>,
/// The rank of the input matrix A
Expand All @@ -21,7 +21,7 @@ pub trait LeastSquaresSvdDivideConquer_: Scalar {
a_layout: MatrixLayout,
a: &mut [Self],
b: &mut [Self],
) -> Result<LeastSquaresOutput<Self>>;
) -> Result<LeastSquaresOwned<Self>>;

/// Solve least square problems $\argmin_X \| AX - B\|$
fn least_squares_nrhs(
Expand All @@ -46,7 +46,7 @@ macro_rules! impl_least_squares {
l: MatrixLayout,
a: &mut [Self],
b: &mut [Self],
) -> Result<LeastSquaresOutput<Self>> {
) -> Result<LeastSquaresOwned<Self>> {
let b_layout = l.resized(b.len() as i32, 1);
Self::least_squares_nrhs(l, a, b_layout, b)
}
Expand All @@ -56,7 +56,7 @@ macro_rules! impl_least_squares {
a: &mut [Self],
b_layout: MatrixLayout,
b: &mut [Self],
) -> Result<LeastSquaresOutput<Self>> {
) -> Result<LeastSquaresOwned<Self>> {
// Minimize |b - Ax|_2
//
// where
Expand Down Expand Up @@ -160,7 +160,7 @@ macro_rules! impl_least_squares {
transpose_over(b_layout, &b_t, b);
}

Ok(LeastSquaresOutput {
Ok(LeastSquaresOwned {
singular_values,
rank,
})
Expand Down
4 changes: 2 additions & 2 deletions ndarray-linalg/src/least_squares.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ where
D1: DataMut<Elem = E>,
D2: DataMut<Elem = E>,
{
let LeastSquaresOutput::<E> {
let LeastSquaresOwned::<E> {
singular_values,
rank,
} = E::least_squares(
Expand Down Expand Up @@ -386,7 +386,7 @@ where
{
let a_layout = a.layout()?;
let rhs_layout = rhs.layout()?;
let LeastSquaresOutput::<E> {
let LeastSquaresOwned::<E> {
singular_values,
rank,
} = E::least_squares_nrhs(
Expand Down

0 comments on commit ac2f7bc

Please sign in to comment.