forked from M-Labs/nalgebra
Add Scalar + Copy bounds in nalgebra-lapack.
```bash export RELEVANT_SOURCEFILES="$(find nalgebra-lapack -name '*.rs')" for f in $RELEVANT_SOURCEFILES; do sed -i 's/N\([0-9]\?\): *Scalar,/N\1: Scalar + Copy,/' $f; done for f in $RELEVANT_SOURCEFILES; do sed -i 's/N\([0-9]\?\): *Scalar>/N\1: Scalar + Copy>/' $f; done for f in $RELEVANT_SOURCEFILES; do sed -i 's/\([A-Z]*Scalar\): Scalar {/\1: Scalar + Copy {/' $f; done for f in $RELEVANT_SOURCEFILES; do sed -i 's/SVDScalar<R: DimMin<C>, C: Dim>: Scalar/SVDScalar<R: DimMin<C>, C: Dim>: Scalar + Copy/' $f; done ```
This commit is contained in:
parent
6c236af696
commit
bd7dd6e345
@ -28,13 +28,13 @@ use lapack;
|
|||||||
))
|
))
|
||||||
)]
|
)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Cholesky<N: Scalar, D: Dim>
|
pub struct Cholesky<N: Scalar + Copy, D: Dim>
|
||||||
where DefaultAllocator: Allocator<N, D, D>
|
where DefaultAllocator: Allocator<N, D, D>
|
||||||
{
|
{
|
||||||
l: MatrixN<N, D>,
|
l: MatrixN<N, D>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: Scalar, D: Dim> Copy for Cholesky<N, D>
|
impl<N: Scalar + Copy, D: Dim> Copy for Cholesky<N, D>
|
||||||
where
|
where
|
||||||
DefaultAllocator: Allocator<N, D, D>,
|
DefaultAllocator: Allocator<N, D, D>,
|
||||||
MatrixN<N, D>: Copy,
|
MatrixN<N, D>: Copy,
|
||||||
@ -175,7 +175,7 @@ where DefaultAllocator: Allocator<N, D, D>
|
|||||||
*/
|
*/
|
||||||
/// Trait implemented by floats (`f32`, `f64`) and complex floats (`Complex<f32>`, `Complex<f64>`)
|
/// Trait implemented by floats (`f32`, `f64`) and complex floats (`Complex<f32>`, `Complex<f64>`)
|
||||||
/// supported by the cholesky decomposition.
|
/// supported by the cholesky decomposition.
|
||||||
pub trait CholeskyScalar: Scalar {
|
pub trait CholeskyScalar: Scalar + Copy {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
fn xpotrf(uplo: u8, n: i32, a: &mut [Self], lda: i32, info: &mut i32);
|
fn xpotrf(uplo: u8, n: i32, a: &mut [Self], lda: i32, info: &mut i32);
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
|
@ -33,7 +33,7 @@ use lapack;
|
|||||||
))
|
))
|
||||||
)]
|
)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Eigen<N: Scalar, D: Dim>
|
pub struct Eigen<N: Scalar + Copy, D: Dim>
|
||||||
where DefaultAllocator: Allocator<N, D> + Allocator<N, D, D>
|
where DefaultAllocator: Allocator<N, D> + Allocator<N, D, D>
|
||||||
{
|
{
|
||||||
/// The eigenvalues of the decomposed matrix.
|
/// The eigenvalues of the decomposed matrix.
|
||||||
@ -44,7 +44,7 @@ where DefaultAllocator: Allocator<N, D> + Allocator<N, D, D>
|
|||||||
pub left_eigenvectors: Option<MatrixN<N, D>>,
|
pub left_eigenvectors: Option<MatrixN<N, D>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: Scalar, D: Dim> Copy for Eigen<N, D>
|
impl<N: Scalar + Copy, D: Dim> Copy for Eigen<N, D>
|
||||||
where
|
where
|
||||||
DefaultAllocator: Allocator<N, D> + Allocator<N, D, D>,
|
DefaultAllocator: Allocator<N, D> + Allocator<N, D, D>,
|
||||||
VectorN<N, D>: Copy,
|
VectorN<N, D>: Copy,
|
||||||
@ -311,7 +311,7 @@ where DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>
|
|||||||
*/
|
*/
|
||||||
/// Trait implemented by scalar type for which Lapack function exist to compute the
|
/// Trait implemented by scalar type for which Lapack function exist to compute the
|
||||||
/// eigendecomposition.
|
/// eigendecomposition.
|
||||||
pub trait EigenScalar: Scalar {
|
pub trait EigenScalar: Scalar + Copy {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
fn xgeev(
|
fn xgeev(
|
||||||
jobvl: u8,
|
jobvl: u8,
|
||||||
|
@ -30,14 +30,14 @@ use lapack;
|
|||||||
))
|
))
|
||||||
)]
|
)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Hessenberg<N: Scalar, D: DimSub<U1>>
|
pub struct Hessenberg<N: Scalar + Copy, D: DimSub<U1>>
|
||||||
where DefaultAllocator: Allocator<N, D, D> + Allocator<N, DimDiff<D, U1>>
|
where DefaultAllocator: Allocator<N, D, D> + Allocator<N, DimDiff<D, U1>>
|
||||||
{
|
{
|
||||||
h: MatrixN<N, D>,
|
h: MatrixN<N, D>,
|
||||||
tau: VectorN<N, DimDiff<D, U1>>,
|
tau: VectorN<N, DimDiff<D, U1>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: Scalar, D: DimSub<U1>> Copy for Hessenberg<N, D>
|
impl<N: Scalar + Copy, D: DimSub<U1>> Copy for Hessenberg<N, D>
|
||||||
where
|
where
|
||||||
DefaultAllocator: Allocator<N, D, D> + Allocator<N, DimDiff<D, U1>>,
|
DefaultAllocator: Allocator<N, D, D> + Allocator<N, DimDiff<D, U1>>,
|
||||||
MatrixN<N, D>: Copy,
|
MatrixN<N, D>: Copy,
|
||||||
@ -137,7 +137,7 @@ where DefaultAllocator: Allocator<N, D, D> + Allocator<N, DimDiff<D, U1>>
|
|||||||
* Lapack functions dispatch.
|
* Lapack functions dispatch.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
pub trait HessenbergScalar: Scalar {
|
pub trait HessenbergScalar: Scalar + Copy {
|
||||||
fn xgehrd(
|
fn xgehrd(
|
||||||
n: i32,
|
n: i32,
|
||||||
ilo: i32,
|
ilo: i32,
|
||||||
|
@ -37,14 +37,14 @@ use lapack;
|
|||||||
))
|
))
|
||||||
)]
|
)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct LU<N: Scalar, R: DimMin<C>, C: Dim>
|
pub struct LU<N: Scalar + Copy, R: DimMin<C>, C: Dim>
|
||||||
where DefaultAllocator: Allocator<i32, DimMinimum<R, C>> + Allocator<N, R, C>
|
where DefaultAllocator: Allocator<i32, DimMinimum<R, C>> + Allocator<N, R, C>
|
||||||
{
|
{
|
||||||
lu: MatrixMN<N, R, C>,
|
lu: MatrixMN<N, R, C>,
|
||||||
p: VectorN<i32, DimMinimum<R, C>>,
|
p: VectorN<i32, DimMinimum<R, C>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: Scalar, R: DimMin<C>, C: Dim> Copy for LU<N, R, C>
|
impl<N: Scalar + Copy, R: DimMin<C>, C: Dim> Copy for LU<N, R, C>
|
||||||
where
|
where
|
||||||
DefaultAllocator: Allocator<N, R, C> + Allocator<i32, DimMinimum<R, C>>,
|
DefaultAllocator: Allocator<N, R, C> + Allocator<i32, DimMinimum<R, C>>,
|
||||||
MatrixMN<N, R, C>: Copy,
|
MatrixMN<N, R, C>: Copy,
|
||||||
@ -306,7 +306,7 @@ where
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/// Trait implemented by scalars for which Lapack implements the LU decomposition.
|
/// Trait implemented by scalars for which Lapack implements the LU decomposition.
|
||||||
pub trait LUScalar: Scalar {
|
pub trait LUScalar: Scalar + Copy {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
fn xgetrf(m: i32, n: i32, a: &mut [Self], lda: i32, ipiv: &mut [i32], info: &mut i32);
|
fn xgetrf(m: i32, n: i32, a: &mut [Self], lda: i32, ipiv: &mut [i32], info: &mut i32);
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
|
@ -33,14 +33,14 @@ use lapack;
|
|||||||
))
|
))
|
||||||
)]
|
)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct QR<N: Scalar, R: DimMin<C>, C: Dim>
|
pub struct QR<N: Scalar + Copy, R: DimMin<C>, C: Dim>
|
||||||
where DefaultAllocator: Allocator<N, R, C> + Allocator<N, DimMinimum<R, C>>
|
where DefaultAllocator: Allocator<N, R, C> + Allocator<N, DimMinimum<R, C>>
|
||||||
{
|
{
|
||||||
qr: MatrixMN<N, R, C>,
|
qr: MatrixMN<N, R, C>,
|
||||||
tau: VectorN<N, DimMinimum<R, C>>,
|
tau: VectorN<N, DimMinimum<R, C>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: Scalar, R: DimMin<C>, C: Dim> Copy for QR<N, R, C>
|
impl<N: Scalar + Copy, R: DimMin<C>, C: Dim> Copy for QR<N, R, C>
|
||||||
where
|
where
|
||||||
DefaultAllocator: Allocator<N, R, C> + Allocator<N, DimMinimum<R, C>>,
|
DefaultAllocator: Allocator<N, R, C> + Allocator<N, DimMinimum<R, C>>,
|
||||||
MatrixMN<N, R, C>: Copy,
|
MatrixMN<N, R, C>: Copy,
|
||||||
@ -166,7 +166,7 @@ where DefaultAllocator: Allocator<N, R, C>
|
|||||||
*/
|
*/
|
||||||
/// Trait implemented by scalar types for which Lapack function exist to compute the
|
/// Trait implemented by scalar types for which Lapack function exist to compute the
|
||||||
/// QR decomposition.
|
/// QR decomposition.
|
||||||
pub trait QRScalar: Scalar {
|
pub trait QRScalar: Scalar + Copy {
|
||||||
fn xgeqrf(
|
fn xgeqrf(
|
||||||
m: i32,
|
m: i32,
|
||||||
n: i32,
|
n: i32,
|
||||||
|
@ -33,7 +33,7 @@ use lapack;
|
|||||||
))
|
))
|
||||||
)]
|
)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Schur<N: Scalar, D: Dim>
|
pub struct Schur<N: Scalar + Copy, D: Dim>
|
||||||
where DefaultAllocator: Allocator<N, D> + Allocator<N, D, D>
|
where DefaultAllocator: Allocator<N, D> + Allocator<N, D, D>
|
||||||
{
|
{
|
||||||
re: VectorN<N, D>,
|
re: VectorN<N, D>,
|
||||||
@ -42,7 +42,7 @@ where DefaultAllocator: Allocator<N, D> + Allocator<N, D, D>
|
|||||||
q: MatrixN<N, D>,
|
q: MatrixN<N, D>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: Scalar, D: Dim> Copy for Schur<N, D>
|
impl<N: Scalar + Copy, D: Dim> Copy for Schur<N, D>
|
||||||
where
|
where
|
||||||
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
|
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
|
||||||
MatrixN<N, D>: Copy,
|
MatrixN<N, D>: Copy,
|
||||||
@ -162,7 +162,7 @@ where DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/// Trait implemented by scalars for which Lapack implements the RealField Schur decomposition.
|
/// Trait implemented by scalars for which Lapack implements the RealField Schur decomposition.
|
||||||
pub trait SchurScalar: Scalar {
|
pub trait SchurScalar: Scalar + Copy {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
fn xgees(
|
fn xgees(
|
||||||
jobvs: u8,
|
jobvs: u8,
|
||||||
|
@ -36,7 +36,7 @@ use lapack;
|
|||||||
))
|
))
|
||||||
)]
|
)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct SVD<N: Scalar, R: DimMin<C>, C: Dim>
|
pub struct SVD<N: Scalar + Copy, R: DimMin<C>, C: Dim>
|
||||||
where DefaultAllocator: Allocator<N, R, R> + Allocator<N, DimMinimum<R, C>> + Allocator<N, C, C>
|
where DefaultAllocator: Allocator<N, R, R> + Allocator<N, DimMinimum<R, C>> + Allocator<N, C, C>
|
||||||
{
|
{
|
||||||
/// The left-singular vectors `U` of this SVD.
|
/// The left-singular vectors `U` of this SVD.
|
||||||
@ -47,7 +47,7 @@ where DefaultAllocator: Allocator<N, R, R> + Allocator<N, DimMinimum<R, C>> + Al
|
|||||||
pub singular_values: VectorN<N, DimMinimum<R, C>>,
|
pub singular_values: VectorN<N, DimMinimum<R, C>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: Scalar, R: DimMin<C>, C: Dim> Copy for SVD<N, R, C>
|
impl<N: Scalar + Copy, R: DimMin<C>, C: Dim> Copy for SVD<N, R, C>
|
||||||
where
|
where
|
||||||
DefaultAllocator: Allocator<N, C, C> + Allocator<N, R, R> + Allocator<N, DimMinimum<R, C>>,
|
DefaultAllocator: Allocator<N, C, C> + Allocator<N, R, R> + Allocator<N, DimMinimum<R, C>>,
|
||||||
MatrixMN<N, R, R>: Copy,
|
MatrixMN<N, R, R>: Copy,
|
||||||
@ -57,7 +57,7 @@ where
|
|||||||
|
|
||||||
/// Trait implemented by floats (`f32`, `f64`) and complex floats (`Complex<f32>`, `Complex<f64>`)
|
/// Trait implemented by floats (`f32`, `f64`) and complex floats (`Complex<f32>`, `Complex<f64>`)
|
||||||
/// supported by the Singular Value Decompotition.
|
/// supported by the Singular Value Decompotition.
|
||||||
pub trait SVDScalar<R: DimMin<C>, C: Dim>: Scalar
|
pub trait SVDScalar<R: DimMin<C>, C: Dim>: Scalar + Copy
|
||||||
where DefaultAllocator: Allocator<Self, R, R>
|
where DefaultAllocator: Allocator<Self, R, R>
|
||||||
+ Allocator<Self, R, C>
|
+ Allocator<Self, R, C>
|
||||||
+ Allocator<Self, DimMinimum<R, C>>
|
+ Allocator<Self, DimMinimum<R, C>>
|
||||||
|
@ -35,7 +35,7 @@ use lapack;
|
|||||||
))
|
))
|
||||||
)]
|
)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct SymmetricEigen<N: Scalar, D: Dim>
|
pub struct SymmetricEigen<N: Scalar + Copy, D: Dim>
|
||||||
where DefaultAllocator: Allocator<N, D> + Allocator<N, D, D>
|
where DefaultAllocator: Allocator<N, D> + Allocator<N, D, D>
|
||||||
{
|
{
|
||||||
/// The eigenvectors of the decomposed matrix.
|
/// The eigenvectors of the decomposed matrix.
|
||||||
@ -45,7 +45,7 @@ where DefaultAllocator: Allocator<N, D> + Allocator<N, D, D>
|
|||||||
pub eigenvalues: VectorN<N, D>,
|
pub eigenvalues: VectorN<N, D>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: Scalar, D: Dim> Copy for SymmetricEigen<N, D>
|
impl<N: Scalar + Copy, D: Dim> Copy for SymmetricEigen<N, D>
|
||||||
where
|
where
|
||||||
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
|
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
|
||||||
MatrixN<N, D>: Copy,
|
MatrixN<N, D>: Copy,
|
||||||
@ -169,7 +169,7 @@ where DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>
|
|||||||
*/
|
*/
|
||||||
/// Trait implemented by scalars for which Lapack implements the eigendecomposition of symmetric
|
/// Trait implemented by scalars for which Lapack implements the eigendecomposition of symmetric
|
||||||
/// real matrices.
|
/// real matrices.
|
||||||
pub trait SymmetricEigenScalar: Scalar {
|
pub trait SymmetricEigenScalar: Scalar + Copy {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
fn xsyev(
|
fn xsyev(
|
||||||
jobz: u8,
|
jobz: u8,
|
||||||
|
Loading…
Reference in New Issue
Block a user