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:
Avi Weinstock 2019-11-21 17:15:18 -05:00
parent fb573f726c
commit 87d935267e
8 changed files with 24 additions and 24 deletions

View File

@ -28,13 +28,13 @@ use lapack;
))
)]
#[derive(Clone, Debug)]
pub struct Cholesky<N: Scalar, D: Dim>
pub struct Cholesky<N: Scalar + Copy, D: Dim>
where DefaultAllocator: Allocator<N, D, 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
DefaultAllocator: Allocator<N, D, D>,
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>`)
/// supported by the cholesky decomposition.
pub trait CholeskyScalar: Scalar {
pub trait CholeskyScalar: Scalar + Copy {
#[allow(missing_docs)]
fn xpotrf(uplo: u8, n: i32, a: &mut [Self], lda: i32, info: &mut i32);
#[allow(missing_docs)]

View File

@ -33,7 +33,7 @@ use lapack;
))
)]
#[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>
{
/// 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>>,
}
impl<N: Scalar, D: Dim> Copy for Eigen<N, D>
impl<N: Scalar + Copy, D: Dim> Copy for Eigen<N, D>
where
DefaultAllocator: Allocator<N, D> + Allocator<N, D, D>,
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
/// eigendecomposition.
pub trait EigenScalar: Scalar {
pub trait EigenScalar: Scalar + Copy {
#[allow(missing_docs)]
fn xgeev(
jobvl: u8,

View File

@ -30,14 +30,14 @@ use lapack;
))
)]
#[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>>
{
h: MatrixN<N, D>,
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
DefaultAllocator: Allocator<N, D, D> + Allocator<N, DimDiff<D, U1>>,
MatrixN<N, D>: Copy,
@ -137,7 +137,7 @@ where DefaultAllocator: Allocator<N, D, D> + Allocator<N, DimDiff<D, U1>>
* Lapack functions dispatch.
*
*/
pub trait HessenbergScalar: Scalar {
pub trait HessenbergScalar: Scalar + Copy {
fn xgehrd(
n: i32,
ilo: i32,

View File

@ -37,14 +37,14 @@ use lapack;
))
)]
#[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>
{
lu: MatrixMN<N, 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
DefaultAllocator: Allocator<N, R, C> + Allocator<i32, DimMinimum<R, C>>,
MatrixMN<N, R, C>: Copy,
@ -306,7 +306,7 @@ where
*
*/
/// Trait implemented by scalars for which Lapack implements the LU decomposition.
pub trait LUScalar: Scalar {
pub trait LUScalar: Scalar + Copy {
#[allow(missing_docs)]
fn xgetrf(m: i32, n: i32, a: &mut [Self], lda: i32, ipiv: &mut [i32], info: &mut i32);
#[allow(missing_docs)]

View File

@ -33,14 +33,14 @@ use lapack;
))
)]
#[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>>
{
qr: MatrixMN<N, 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
DefaultAllocator: Allocator<N, R, C> + Allocator<N, DimMinimum<R, C>>,
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
/// QR decomposition.
pub trait QRScalar: Scalar {
pub trait QRScalar: Scalar + Copy {
fn xgeqrf(
m: i32,
n: i32,

View File

@ -33,7 +33,7 @@ use lapack;
))
)]
#[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>
{
re: VectorN<N, D>,
@ -42,7 +42,7 @@ where DefaultAllocator: Allocator<N, D> + Allocator<N, D, 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
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
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.
pub trait SchurScalar: Scalar {
pub trait SchurScalar: Scalar + Copy {
#[allow(missing_docs)]
fn xgees(
jobvs: u8,

View File

@ -36,7 +36,7 @@ use lapack;
))
)]
#[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>
{
/// 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>>,
}
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
DefaultAllocator: Allocator<N, C, C> + Allocator<N, R, R> + Allocator<N, DimMinimum<R, C>>,
MatrixMN<N, R, R>: Copy,
@ -57,7 +57,7 @@ where
/// Trait implemented by floats (`f32`, `f64`) and complex floats (`Complex<f32>`, `Complex<f64>`)
/// 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>
+ Allocator<Self, R, C>
+ Allocator<Self, DimMinimum<R, C>>

View File

@ -35,7 +35,7 @@ use lapack;
))
)]
#[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>
{
/// The eigenvectors of the decomposed matrix.
@ -45,7 +45,7 @@ where DefaultAllocator: Allocator<N, D> + Allocator<N, D, 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
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
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
/// real matrices.
pub trait SymmetricEigenScalar: Scalar {
pub trait SymmetricEigenScalar: Scalar + Copy {
#[allow(missing_docs)]
fn xsyev(
jobz: u8,