pub struct SVEResult { /* private fields */ }Expand description
Result of Singular Value Expansion computation
Implementations§
Source§impl SVEResult
impl SVEResult
Sourcepub fn u(&self) -> &PiecewiseLegendrePolyVector
pub fn u(&self) -> &PiecewiseLegendrePolyVector
Left singular functions, one per singular value
Sourcepub fn v(&self) -> &PiecewiseLegendrePolyVector
pub fn v(&self) -> &PiecewiseLegendrePolyVector
Right singular functions, one per singular value
Sourcepub fn from_discretized_matrix<T>(
matrix: &Mat<T>,
gauss_x: &Rule<T>,
gauss_y: &Rule<T>,
segments_x: &[f64],
segments_y: &[f64],
n_gauss: usize,
epsilon: f64,
) -> Result<SVEResult, Error>where
T: CustomNumeric + 'static,
pub fn from_discretized_matrix<T>(
matrix: &Mat<T>,
gauss_x: &Rule<T>,
gauss_y: &Rule<T>,
segments_x: &[f64],
segments_y: &[f64],
n_gauss: usize,
epsilon: f64,
) -> Result<SVEResult, Error>where
T: CustomNumeric + 'static,
Build an SVE from a kernel matrix discretized on the Gauss points of
segments_x x segments_y
matrix[i][j] is sqrt(w_x[i]) * K(x[i], y[j]) * sqrt(w_y[j]) for the
piecewise Gauss-Legendre rules gauss_x and gauss_y of n_gauss
points per segment, so matrix has n_gauss * n_segments rows and
columns. The weights are divided out of the singular vectors before
they become piecewise Legendre polynomials.
§Errors
- The errors of
compute_svd_dtensor:Error::EmptyInput,Error::NonFiniteInputandError::DecompositionFailed Error::InvalidParameterifmatrixdoes not have one row (column) per Gauss point ofsegments_x(segments_y), or if a segment array has fewer than 2 entries- The errors of
Self::new, in particularError::EmptyInputfor a matrix of rank 0, which has no singular functions
Sourcepub fn from_discretized_matrices_centrosymmetric(
even: &Mat<f64>,
odd: &Mat<f64>,
gauss_x: &Rule<f64>,
gauss_y: &Rule<f64>,
segments_x: &[f64],
segments_y: &[f64],
n_gauss: usize,
xmax: f64,
ymax: f64,
epsilon: f64,
) -> Result<SVEResult, Error>
pub fn from_discretized_matrices_centrosymmetric( even: &Mat<f64>, odd: &Mat<f64>, gauss_x: &Rule<f64>, gauss_y: &Rule<f64>, segments_x: &[f64], segments_y: &[f64], n_gauss: usize, xmax: f64, ymax: f64, epsilon: f64, ) -> Result<SVEResult, Error>
Self::from_discretized_matrix for a centrosymmetric kernel, whose
even and odd parts are discretized on the half domains
segments_x x segments_y and extended to [-xmax, xmax] and
[-ymax, ymax]
A block of rank 0 (the odd part of a kernel that is even in y, say) contributes no singular function; only both blocks being empty is an error.
§Errors
- The errors of
Self::from_discretized_matrixfor each block, except that an empty block is accepted - The errors of the crate-internal
extend_to_full_domainandmerge_results, in particularError::EmptyInputif both blocks are empty
Sourcepub fn new(
u: PiecewiseLegendrePolyVector,
s: Vec<f64>,
v: PiecewiseLegendrePolyVector,
epsilon: f64,
) -> Result<SVEResult, Error>
pub fn new( u: PiecewiseLegendrePolyVector, s: Vec<f64>, v: PiecewiseLegendrePolyVector, epsilon: f64, ) -> Result<SVEResult, Error>
Create a new SVEResult
§Errors
Error::EmptyInputifsis emptyError::InvalidParameterifuorvdoes not have one function per singular value, a singular value is not positive, the singular values are not non-increasing, orepsilonis not in [0, 1)Error::NonFiniteInputif a singular value is NaN or infinite
Sourcepub fn part(
&self,
eps: Option<f64>,
max_size: Option<usize>,
) -> Result<(PiecewiseLegendrePolyVector, Vec<f64>, PiecewiseLegendrePolyVector), Error>
pub fn part( &self, eps: Option<f64>, max_size: Option<usize>, ) -> Result<(PiecewiseLegendrePolyVector, Vec<f64>, PiecewiseLegendrePolyVector), Error>
Extract a subset of the SVE result based on epsilon and max_size
§Arguments
eps- Relative threshold for singular values (default: self.epsilon)max_size- Maximum number of singular values to keep
§Returns
Tuple of (u_subset, s_subset, v_subset)
§Errors
Error::InvalidParameterifepsis not in [0, 1) (0 keeps every singular value) ormax_sizeisSome(0)- The errors of
Self::newandPiecewiseLegendrePolyVector::newif the (public) fields break their invariants
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SVEResult
impl RefUnwindSafe for SVEResult
impl Send for SVEResult
impl Sync for SVEResult
impl Unpin for SVEResult
impl UnsafeUnpin for SVEResult
impl UnwindSafe for SVEResult
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>,
impl<T, U> Imply<T> for U
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> ⓘ
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> ⓘ
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 moreimpl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSendSync for T
impl<T> MaybeSync for Twhere
T: Sync,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.