Struct linxal::generate::matgen::RandomSemiPositive
[−]
[src]
pub struct RandomSemiPositive<T: MG> { /* fields omitted */ }
Structure for creating positive semi-definite matrices.
Methods
impl<T: MG> RandomSemiPositive<T>
[src]
fn new<Rand: Rng>(n: usize, rand: &mut Rand) -> RandomSemiPositive<T>
Create a new matrix generator for random semi-positive definite matrices.
fn rank(&mut self, n: usize) -> &mut Self
Set the rank of the matrix.
The rank is capped to the size of the matrix.
Remarks
The rank is ignored when the eigenvalues / singular values are given as input.
fn full_rank(&mut self) -> &mut Self
Set the matrix to be full rank.
Remarks
The rank is ignored when the eigenvalues / singular values are given as input.
fn bands(&mut self, band: usize) -> &mut Self
Set the upper and lower band of the matrix.
If the band is larger than the matrix, it is interpreted as a full-sized matrix.
fn full_bands(&mut self) -> &mut Self
Set the matrix to be full bandwidth.
fn diagonal(&mut self) -> &mut Self
Set the matrix to be diagonal.
fn packing(&mut self, packing: Packing) -> &mut Self
Set how the entries of the matrix are packed.
Remarks
Only symmetric matrices can have non-Full
packing.
fn singular_values(
&mut self,
values: &[<T as LinxalImplScalar>::RealPart]
) -> &mut Self
&mut self,
values: &[<T as LinxalImplScalar>::RealPart]
) -> &mut Self
Set the singular values to the specified values.
When the rank of the matrix is specified as k
, any values
after the k
th are ignored and set to zero when the matrix is
generated.
The absolute value of all entries is taken.
fn sv(&mut self, values: &[<T as LinxalImplScalar>::RealPart]) -> &mut Self
Set the singular_values to the specified values.
fn sv_random_uniform(&mut self, min: T::RealPart, max: T::RealPart) -> &mut Self
Draw the singular_values from a uniform distribution.
The absolute value of all entries is taken, to ensure positive semi-definiteness.
fn generate(&mut self) -> Result<Array<T, Ix2>, GenerateError>
Generate a matrix matching the specifications previously specified.
fn generate_with_sv(
&mut self
) -> Result<(Array<T, Ix2>, Array<T::RealPart, Ix1>), GenerateError>
&mut self
) -> Result<(Array<T, Ix2>, Array<T::RealPart, Ix1>), GenerateError>
Generate a matrix matching the specifications, and singular values