Move core/* to base/* + add conditional compilation to dynamics matrices when no_std is enabled.

This commit is contained in:
sebcrozet 2018-05-19 17:15:15 +02:00 committed by Sébastien Crozet
parent 88055dfc45
commit ca093fad29
103 changed files with 799 additions and 586 deletions

View File

@ -5,7 +5,21 @@ documented here.
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
## [0.15.0] - WIP ## [0.15.0] - WIP
The most notable change of this release is the support for using part of the library without the rust standard
library (i.e. it supports `#![no_std]`). Use the following in your `Cargo.toml` to work with a version of
nalgebra that does not rely on libstd:
```toml
#[dependencies]
nalgebra = { version = "0.15", default_features = false }
```
Some feature are no longer available when libstd is not used:
* Support for dynamically-sized matrices.
* Support for the `::new_random()` matrix constructor.
* Support for the `.resize(...)` method since it returns a dynamically-sized matrix.
All other feature, including matrix factorizations, will still work on statically-sized matrices!
### Modified ### Modified
* Rename the `core` module to `base` to avoid conflicts with the `core` crate implicitly imported when
`#![no_std]` is enabled.
* Constructors of the `MatrixSlice*` types have been renamed from `new_*` to `from_slice_*`. This was * Constructors of the `MatrixSlice*` types have been renamed from `new_*` to `from_slice_*`. This was
necessary to avoid the `incoherent_fundamental_impls` lint that is going to become a hard error. necessary to avoid the `incoherent_fundamental_impls` lint that is going to become a hard error.
### Added ### Added

View File

@ -16,24 +16,26 @@ name = "nalgebra"
path = "src/lib.rs" path = "src/lib.rs"
[features] [features]
default = [ "std" ]
std = [ "matrixmultiply" ]
arbitrary = [ "quickcheck" ] arbitrary = [ "quickcheck" ]
serde-serialize = [ "serde", "serde_derive", "num-complex/serde" ] serde-serialize = [ "serde", "serde_derive", "num-complex/serde" ]
abomonation-serialize = [ "abomonation" ] abomonation-serialize = [ "abomonation" ]
debug = [ ] debug = [ ]
[dependencies] [dependencies]
typenum = "1.7" typenum = "1.10"
generic-array = "0.8" generic-array = "0.11"
rand = "0.4" rand = { version = "0.4", default-features = false }
num-traits = "0.1" num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.1", default-features = false } num-complex = { version = "0.2.0-git", git = "https://github.com/rust-num/num-complex", default-features = false }
approx = "0.1" approx = { version = "0.1", default-features = false }
alga = "0.5" alga = { version = "0.5", default-features = false }
matrixmultiply = "0.1" matrixmultiply = { version = "0.1", optional = true }
serde = { version = "1.0", optional = true } serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true }
abomonation = { version = "0.4", optional = true } abomonation = { version = "0.4", optional = true }
mint = { version = "0.4.2", optional = true } mint = { version = "0.5", optional = true }
[dependencies.quickcheck] [dependencies.quickcheck]
optional = true optional = true

View File

@ -1,7 +1,8 @@
use core::Matrix; use base::dimension::{Dynamic, U1, U2, U3, U4, U5, U6};
use core::dimension::{Dynamic, U1, U2, U3, U4, U5, U6}; #[cfg(any(feature = "std", feature = "alloc"))]
use core::matrix_vec::MatrixVec; use base::matrix_vec::MatrixVec;
use core::storage::Owned; use base::storage::Owned;
use base::Matrix;
/* /*
* *
@ -21,6 +22,7 @@ pub type MatrixMN<N, R, C> = Matrix<N, R, C, Owned<N, R, C>>;
pub type MatrixN<N, D> = MatrixMN<N, D, D>; pub type MatrixN<N, D> = MatrixMN<N, D, D>;
/// A dynamically sized column-major matrix. /// A dynamically sized column-major matrix.
#[cfg(any(feature = "std", feature = "alloc"))]
pub type DMatrix<N> = MatrixN<N, Dynamic>; pub type DMatrix<N> = MatrixN<N, Dynamic>;
/// A stack-allocated, column-major, 1x1 square matrix. /// A stack-allocated, column-major, 1x1 square matrix.
@ -114,6 +116,7 @@ pub type Matrix6x5<N> = MatrixMN<N, U6, U5>;
* *
*/ */
/// A dynamically sized column vector. /// A dynamically sized column vector.
#[cfg(any(feature = "std", feature = "alloc"))]
pub type DVector<N> = Matrix<N, Dynamic, U1, MatrixVec<N, Dynamic, U1>>; pub type DVector<N> = Matrix<N, Dynamic, U1, MatrixVec<N, Dynamic, U1>>;
/// A statically sized D-dimensional column vector. /// A statically sized D-dimensional column vector.
@ -140,6 +143,7 @@ pub type Vector6<N> = VectorN<N, U6>;
* *
*/ */
/// A dynamically sized row vector. /// A dynamically sized row vector.
#[cfg(any(feature = "std", feature = "alloc"))]
pub type RowDVector<N> = Matrix<N, U1, Dynamic, MatrixVec<N, U1, Dynamic>>; pub type RowDVector<N> = Matrix<N, U1, Dynamic, MatrixVec<N, U1, Dynamic>>;
/// A statically sized D-dimensional row vector. /// A statically sized D-dimensional row vector.

View File

@ -1,6 +1,6 @@
use core::Matrix; use base::Matrix;
use core::dimension::{Dynamic, U1, U2, U3, U4, U5, U6}; use base::dimension::{Dynamic, U1, U2, U3, U4, U5, U6};
use core::matrix_slice::{SliceStorage, SliceStorageMut}; use base::matrix_slice::{SliceStorage, SliceStorageMut};
/* /*
* *

View File

@ -2,10 +2,10 @@
use std::any::Any; use std::any::Any;
use core::{DefaultAllocator, Scalar}; use base::{DefaultAllocator, Scalar};
use core::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
use core::dimension::{Dim, U1}; use base::dimension::{Dim, U1};
use core::storage::ContiguousStorageMut; use base::storage::ContiguousStorageMut;
/// A matrix allocator of a memory buffer that may contain `R::to_usize() * C::to_usize()` /// A matrix allocator of a memory buffer that may contain `R::to_usize() * C::to_usize()`
/// elements of type `N`. /// elements of type `N`.

View File

@ -1,14 +1,16 @@
use std::mem;
use num::{One, Signed, Zero};
use matrixmultiply;
use alga::general::{ClosedAdd, ClosedMul}; use alga::general::{ClosedAdd, ClosedMul};
#[cfg(feature = "std")]
use matrixmultiply;
use num::{One, Signed, Zero};
use std::mem;
use core::{DefaultAllocator, Matrix, Scalar, SquareMatrix, Vector}; use base::allocator::Allocator;
use core::dimension::{Dim, Dynamic, U1, U2, U3, U4}; use base::constraint::{
use core::constraint::{AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows, AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint,
ShapeConstraint}; };
use core::storage::{Storage, StorageMut}; use base::dimension::{Dim, Dynamic, U1, U2, U3, U4};
use core::allocator::Allocator; use base::storage::{Storage, StorageMut};
use base::{DefaultAllocator, Matrix, Scalar, SquareMatrix, Vector};
impl<N: Scalar + PartialOrd + Signed, D: Dim, S: Storage<N, D>> Vector<N, D, S> { impl<N: Scalar + PartialOrd + Signed, D: Dim, S: Storage<N, D>> Vector<N, D, S> {
/// Computes the index of the vector component with the largest absolute value. /// Computes the index of the vector component with the largest absolute value.
@ -457,7 +459,12 @@ where
+ SameNumberOfColumns<C1, C3> + SameNumberOfColumns<C1, C3>
+ AreMultipliable<R2, C2, R3, C3>, + AreMultipliable<R2, C2, R3, C3>,
{ {
let (nrows1, ncols1) = self.shape(); let ncols1 = self.shape();
#[cfg(feature = "std")]
{
// matrixmultiply can be used only if the std feature is available.
let nrows1 = self.nrows();
let (nrows2, ncols2) = a.shape(); let (nrows2, ncols2) = a.shape();
let (nrows3, ncols3) = b.shape(); let (nrows3, ncols3) = b.shape();
@ -531,13 +538,16 @@ where
); );
} }
} }
} else {
return;
}
}
for j1 in 0..ncols1 { for j1 in 0..ncols1 {
// FIXME: avoid bound checks. // FIXME: avoid bound checks.
self.column_mut(j1).gemv(alpha, a, &b.column(j1), beta); self.column_mut(j1).gemv(alpha, a, &b.column(j1), beta);
} }
} }
}
/// Computes `self = alpha * a.transpose() * b + beta * self`, where `a, b, self` are matrices. /// Computes `self = alpha * a.transpose() * b + beta * self`, where `a, b, self` are matrices.
/// `alpha` and `beta` are scalar. /// `alpha` and `beta` are scalar.
@ -698,10 +708,8 @@ where
S2: StorageMut<N, D2>, S2: StorageMut<N, D2>,
S3: Storage<N, D3, D3>, S3: Storage<N, D3, D3>,
S4: Storage<N, R4, C4>, S4: Storage<N, R4, C4>,
ShapeConstraint: DimEq<D3, R4> ShapeConstraint:
+ DimEq<D1, C4> DimEq<D3, R4> + DimEq<D1, C4> + DimEq<D2, D3> + AreMultipliable<C4, R4, D2, U1>,
+ DimEq<D2, D3>
+ AreMultipliable<C4, R4, D2, U1>,
{ {
work.gemv(N::one(), mid, &rhs.column(0), N::zero()); work.gemv(N::one(), mid, &rhs.column(0), N::zero());
self.column_mut(0).gemv_tr(alpha, &rhs, work, beta); self.column_mut(0).gemv_tr(alpha, &rhs, work, beta);

View File

@ -7,11 +7,11 @@
use num::One; use num::One;
use core::{DefaultAllocator, Matrix3, Matrix4, MatrixN, Scalar, SquareMatrix, Unit, Vector, use base::{DefaultAllocator, Matrix3, Matrix4, MatrixN, Scalar, SquareMatrix, Unit, Vector,
Vector3, VectorN}; Vector3, VectorN};
use core::dimension::{DimName, DimNameDiff, DimNameSub, U1}; use base::dimension::{DimName, DimNameDiff, DimNameSub, U1};
use core::storage::{Storage, StorageMut}; use base::storage::{Storage, StorageMut};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Isometry, IsometryMatrix3, Orthographic3, Perspective3, Point, Point3, Rotation2, use geometry::{Isometry, IsometryMatrix3, Orthographic3, Perspective3, Point, Point3, Rotation2,
Rotation3}; Rotation3};

View File

@ -1,15 +1,15 @@
// Non-convensional componentwise operators. // Non-convensional componentwise operators.
use std::ops::{Add, Mul};
use num::{Signed, Zero}; use num::{Signed, Zero};
use std::ops::{Add, Mul};
use alga::general::{ClosedDiv, ClosedMul}; use alga::general::{ClosedDiv, ClosedMul};
use core::{DefaultAllocator, Matrix, MatrixMN, MatrixSum, Scalar}; use base::allocator::{Allocator, SameShapeAllocator};
use core::dimension::Dim; use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
use core::storage::{Storage, StorageMut}; use base::dimension::Dim;
use core::allocator::{Allocator, SameShapeAllocator}; use base::storage::{Storage, StorageMut};
use core::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; use base::{DefaultAllocator, Matrix, MatrixMN, MatrixSum, Scalar};
/// The type of the result of a matrix componentwise operation. /// The type of the result of a matrix componentwise operation.
pub type MatrixComponentOp<N, R1, C1, R2, C2> = MatrixSum<N, R1, C1, R2, C2>; pub type MatrixComponentOp<N, R1, C1, R2, C2> = MatrixSum<N, R1, C1, R2, C2>;

View File

@ -1,6 +1,6 @@
//! Compatibility constraints between matrix shapes, e.g., for addition or multiplication. //! Compatibility constraints between matrix shapes, e.g., for addition or multiplication.
use core::dimension::{Dim, DimName, Dynamic}; use base::dimension::{Dim, DimName, Dynamic};
/// A type used in `where` clauses for enforcing constraints. /// A type used in `where` clauses for enforcing constraints.
pub struct ShapeConstraint; pub struct ShapeConstraint;

View File

@ -1,5 +1,5 @@
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use core::storage::Owned; use base::storage::Owned;
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use quickcheck::{Arbitrary, Gen}; use quickcheck::{Arbitrary, Gen};
@ -10,10 +10,10 @@ use typenum::{self, Cmp, Greater};
use alga::general::{ClosedAdd, ClosedMul}; use alga::general::{ClosedAdd, ClosedMul};
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::{Dim, DimName, Dynamic, U1, U2, U3, U4, U5, U6}; use base::dimension::{Dim, DimName, Dynamic, U1, U2, U3, U4, U5, U6};
use core::storage::Storage; use base::storage::Storage;
use core::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar, Unit, Vector, VectorN}; use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar, Unit, Vector, VectorN};
/* /*
* *
@ -228,6 +228,7 @@ where
/// Creates a matrix filled with random values. /// Creates a matrix filled with random values.
#[inline] #[inline]
#[cfg(feature = "std")]
pub fn new_random_generic(nrows: R, ncols: C) -> Self pub fn new_random_generic(nrows: R, ncols: C) -> Self
where where
N: Rand, N: Rand,
@ -384,6 +385,7 @@ macro_rules! impl_constructors(
/// Creates a matrix filled with random values. /// Creates a matrix filled with random values.
#[inline] #[inline]
#[cfg(feature = "std")]
pub fn new_random($($args: usize),*) -> Self { pub fn new_random($($args: usize),*) -> Self {
Self::new_random_generic($($gargs),*) Self::new_random_generic($($gargs),*)
} }

View File

@ -1,6 +1,6 @@
use core::dimension::{Dim, DimName, Dynamic, U1}; use base::dimension::{Dim, DimName, Dynamic, U1};
use core::matrix_slice::{SliceStorage, SliceStorageMut}; use base::matrix_slice::{SliceStorage, SliceStorageMut};
use core::{MatrixSliceMN, MatrixSliceMutMN, Scalar}; use base::{MatrixSliceMN, MatrixSliceMutMN, Scalar};
/* /*
* *

View File

@ -1,6 +1,6 @@
use core::{MatrixSliceMN, MatrixSliceMutMN, Scalar}; use base::dimension::{Dim, DimName, Dynamic, U1};
use core::dimension::{Dim, DimName, Dynamic, U1}; use base::matrix_slice::{SliceStorage, SliceStorageMut};
use core::matrix_slice::{SliceStorage, SliceStorageMut}; use base::{MatrixSliceMN, MatrixSliceMutMN, Scalar};
/* /*
* *
@ -15,7 +15,9 @@ impl<'a, N: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
/// This method is unsafe because the input data array is not checked to contain enough elements. /// This method is unsafe because the input data array is not checked to contain enough elements.
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`.
#[inline] #[inline]
#[deprecated(note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_with_strides_generic_unchecked instead.")] #[deprecated(
note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_with_strides_generic_unchecked instead."
)]
pub unsafe fn new_with_strides_generic_unchecked( pub unsafe fn new_with_strides_generic_unchecked(
data: &'a [N], data: &'a [N],
start: usize, start: usize,
@ -37,7 +39,9 @@ impl<'a, N: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
/// Panics if the input data array dose not contain enough elements. /// Panics if the input data array dose not contain enough elements.
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`.
#[inline] #[inline]
#[deprecated(note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_with_strides_generic instead.")] #[deprecated(
note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_with_strides_generic instead."
)]
pub fn new_with_strides_generic( pub fn new_with_strides_generic(
data: &'a [N], data: &'a [N],
nrows: R, nrows: R,
@ -54,7 +58,9 @@ impl<'a, N: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
"Matrix slice: input data buffer to small." "Matrix slice: input data buffer to small."
); );
unsafe { Self::from_slice_with_strides_generic_unchecked(data, 0, nrows, ncols, rstride, cstride) } unsafe {
Self::from_slice_with_strides_generic_unchecked(data, 0, nrows, ncols, rstride, cstride)
}
} }
} }
@ -66,7 +72,9 @@ impl<'a, N: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
/// This method is unsafe because the input data array is not checked to contain enough elements. /// This method is unsafe because the input data array is not checked to contain enough elements.
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`.
#[inline] #[inline]
#[deprecated(note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_with_strides_generic_unchecked instead.")] #[deprecated(
note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_with_strides_generic_unchecked instead."
)]
pub unsafe fn new_with_strides_generic_mut_unchecked( pub unsafe fn new_with_strides_generic_mut_unchecked(
data: &'a mut [N], data: &'a mut [N],
start: usize, start: usize,
@ -88,7 +96,9 @@ impl<'a, N: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
/// Panics if the input data array dose not contain enough elements. /// Panics if the input data array dose not contain enough elements.
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`.
#[inline] #[inline]
#[deprecated(note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_with_strides_generic instead.")] #[deprecated(
note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_with_strides_generic instead."
)]
pub fn new_with_strides_generic_mut( pub fn new_with_strides_generic_mut(
data: &'a mut [N], data: &'a mut [N],
nrows: R, nrows: R,
@ -117,7 +127,9 @@ impl<'a, N: Scalar, R: Dim, C: Dim> MatrixSliceMN<'a, N, R, C> {
/// This method is unsafe because the input data array is not checked to contain enough elements. /// This method is unsafe because the input data array is not checked to contain enough elements.
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`.
#[inline] #[inline]
#[deprecated(note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_generic_unchecked instead.")] #[deprecated(
note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_generic_unchecked instead."
)]
pub unsafe fn new_generic_unchecked(data: &'a [N], start: usize, nrows: R, ncols: C) -> Self { pub unsafe fn new_generic_unchecked(data: &'a [N], start: usize, nrows: R, ncols: C) -> Self {
Self::from_slice_with_strides_generic_unchecked(data, start, nrows, ncols, U1, nrows) Self::from_slice_with_strides_generic_unchecked(data, start, nrows, ncols, U1, nrows)
} }
@ -127,7 +139,9 @@ impl<'a, N: Scalar, R: Dim, C: Dim> MatrixSliceMN<'a, N, R, C> {
/// Panics if the input data array dose not contain enough elements. /// Panics if the input data array dose not contain enough elements.
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`.
#[inline] #[inline]
#[deprecated(note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_generic instead.")] #[deprecated(
note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_generic instead."
)]
pub fn new_generic(data: &'a [N], nrows: R, ncols: C) -> Self { pub fn new_generic(data: &'a [N], nrows: R, ncols: C) -> Self {
Self::from_slice_with_strides_generic(data, nrows, ncols, U1, nrows) Self::from_slice_with_strides_generic(data, nrows, ncols, U1, nrows)
} }
@ -139,7 +153,9 @@ impl<'a, N: Scalar, R: Dim, C: Dim> MatrixSliceMutMN<'a, N, R, C> {
/// This method is unsafe because the input data array is not checked to contain enough elements. /// This method is unsafe because the input data array is not checked to contain enough elements.
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`.
#[inline] #[inline]
#[deprecated(note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_generic_unchecked instead.")] #[deprecated(
note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_generic_unchecked instead."
)]
pub unsafe fn new_generic_mut_unchecked( pub unsafe fn new_generic_mut_unchecked(
data: &'a mut [N], data: &'a mut [N],
start: usize, start: usize,
@ -154,7 +170,9 @@ impl<'a, N: Scalar, R: Dim, C: Dim> MatrixSliceMutMN<'a, N, R, C> {
/// Panics if the input data array dose not contain enough elements. /// Panics if the input data array dose not contain enough elements.
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`.
#[inline] #[inline]
#[deprecated(note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_generic instead.")] #[deprecated(
note = "This constructor is being removed to avoid the incoherent_fundamental_impls lint error. Use ::from_slice_generic instead."
)]
pub fn new_generic_mut(data: &'a mut [N], nrows: R, ncols: C) -> Self { pub fn new_generic_mut(data: &'a mut [N], nrows: R, ncols: C) -> Self {
Self::from_slice_with_strides_generic(data, nrows, ncols, U1, nrows) Self::from_slice_with_strides_generic(data, nrows, ncols, U1, nrows)
} }

View File

@ -1,16 +1,16 @@
use std::ptr;
use std::mem;
use std::convert::{AsMut, AsRef, From, Into};
use alga::general::{SubsetOf, SupersetOf}; use alga::general::{SubsetOf, SupersetOf};
#[cfg(feature = "mint")] #[cfg(feature = "mint")]
use mint; use mint;
use std::convert::{AsMut, AsRef, From, Into};
use std::mem;
use std::ptr;
use core::{DefaultAllocator, Matrix, MatrixMN, Scalar}; use base::allocator::{Allocator, SameShapeAllocator};
use core::dimension::{Dim, U1, U10, U11, U12, U13, U14, U15, U16, U2, U3, U4, U5, U6, U7, U8, U9}; use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
use core::iter::{MatrixIter, MatrixIterMut}; use base::dimension::{Dim, U1, U10, U11, U12, U13, U14, U15, U16, U2, U3, U4, U5, U6, U7, U8, U9};
use core::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; use base::iter::{MatrixIter, MatrixIterMut};
use core::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut}; use base::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut};
use core::allocator::{Allocator, SameShapeAllocator}; use base::{DefaultAllocator, Matrix, MatrixMN, Scalar};
// FIXME: too bad this won't work allo slice conversions. // FIXME: too bad this won't work allo slice conversions.
impl<N1, N2, R1, C1, R2, C2> SubsetOf<MatrixMN<N2, R2, C2>> for MatrixMN<N1, R1, C1> impl<N1, N2, R1, C1, R2, C2> SubsetOf<MatrixMN<N2, R2, C2>> for MatrixMN<N1, R1, C1>
@ -21,9 +21,8 @@ where
C2: Dim, C2: Dim,
N1: Scalar, N1: Scalar,
N2: Scalar + SupersetOf<N1>, N2: Scalar + SupersetOf<N1>,
DefaultAllocator: Allocator<N2, R2, C2> DefaultAllocator:
+ Allocator<N1, R1, C1> Allocator<N2, R2, C2> + Allocator<N1, R1, C1> + SameShapeAllocator<N1, R1, C1, R2, C2>,
+ SameShapeAllocator<N1, R1, C1, R2, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>, ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
{ {
#[inline] #[inline]
@ -75,7 +74,8 @@ impl<'a, N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> IntoIterator for &'a Ma
} }
impl<'a, N: Scalar, R: Dim, C: Dim, S: StorageMut<N, R, C>> IntoIterator impl<'a, N: Scalar, R: Dim, C: Dim, S: StorageMut<N, R, C>> IntoIterator
for &'a mut Matrix<N, R, C, S> { for &'a mut Matrix<N, R, C, S>
{
type Item = &'a mut N; type Item = &'a mut N;
type IntoIter = MatrixIterMut<'a, N, R, C, S>; type IntoIter = MatrixIterMut<'a, N, R, C, S>;

View File

@ -7,9 +7,9 @@
use std::mem; use std::mem;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use core::{Matrix, Scalar}; use base::{Matrix, Scalar};
use core::dimension::{U1, U2, U3, U4, U5, U6}; use base::dimension::{U1, U2, U3, U4, U5, U6};
use core::storage::{ContiguousStorage, ContiguousStorageMut}; use base::storage::{ContiguousStorage, ContiguousStorageMut};
/* /*
* *

View File

@ -3,20 +3,21 @@
//! This will use stack-allocated buffers for matrices with dimensions known at compile-time, and //! This will use stack-allocated buffers for matrices with dimensions known at compile-time, and
//! heap-allocated buffers for matrices with at least one dimension unknown at compile-time. //! heap-allocated buffers for matrices with at least one dimension unknown at compile-time.
use std::mem;
use std::ptr;
use std::cmp; use std::cmp;
use std::mem;
use std::ops::Mul; use std::ops::Mul;
use std::ptr;
use typenum::Prod;
use generic_array::ArrayLength; use generic_array::ArrayLength;
use typenum::Prod;
use core::Scalar; use base::allocator::{Allocator, Reallocator};
use core::dimension::{Dim, DimName, Dynamic}; use base::dimension::{Dim, DimName, Dynamic};
use core::allocator::{Allocator, Reallocator}; use base::matrix_array::MatrixArray;
use core::storage::{Storage, StorageMut}; #[cfg(any(feature = "std", feature = "alloc"))]
use core::matrix_array::MatrixArray; use base::matrix_vec::MatrixVec;
use core::matrix_vec::MatrixVec; use base::storage::{Storage, StorageMut};
use base::Scalar;
/* /*
* *
@ -68,6 +69,7 @@ where
// Dynamic - Static // Dynamic - Static
// Dynamic - Dynamic // Dynamic - Dynamic
#[cfg(any(feature = "std", feature = "alloc"))]
impl<N: Scalar, C: Dim> Allocator<N, Dynamic, C> for DefaultAllocator { impl<N: Scalar, C: Dim> Allocator<N, Dynamic, C> for DefaultAllocator {
type Buffer = MatrixVec<N, Dynamic, C>; type Buffer = MatrixVec<N, Dynamic, C>;
@ -97,6 +99,7 @@ impl<N: Scalar, C: Dim> Allocator<N, Dynamic, C> for DefaultAllocator {
} }
// Static - Dynamic // Static - Dynamic
#[cfg(any(feature = "std", feature = "alloc"))]
impl<N: Scalar, R: DimName> Allocator<N, R, Dynamic> for DefaultAllocator { impl<N: Scalar, R: DimName> Allocator<N, R, Dynamic> for DefaultAllocator {
type Buffer = MatrixVec<N, R, Dynamic>; type Buffer = MatrixVec<N, R, Dynamic>;
@ -160,6 +163,7 @@ where
} }
// Static × Static -> Dynamic × Any // Static × Static -> Dynamic × Any
#[cfg(any(feature = "std", feature = "alloc"))]
impl<N: Scalar, RFrom, CFrom, CTo> Reallocator<N, RFrom, CFrom, Dynamic, CTo> for DefaultAllocator impl<N: Scalar, RFrom, CFrom, CTo> Reallocator<N, RFrom, CFrom, Dynamic, CTo> for DefaultAllocator
where where
RFrom: DimName, RFrom: DimName,
@ -187,6 +191,7 @@ where
} }
// Static × Static -> Static × Dynamic // Static × Static -> Static × Dynamic
#[cfg(any(feature = "std", feature = "alloc"))]
impl<N: Scalar, RFrom, CFrom, RTo> Reallocator<N, RFrom, CFrom, RTo, Dynamic> for DefaultAllocator impl<N: Scalar, RFrom, CFrom, RTo> Reallocator<N, RFrom, CFrom, RTo, Dynamic> for DefaultAllocator
where where
RFrom: DimName, RFrom: DimName,
@ -214,8 +219,10 @@ where
} }
// All conversion from a dynamic buffer to a dynamic buffer. // All conversion from a dynamic buffer to a dynamic buffer.
#[cfg(any(feature = "std", feature = "alloc"))]
impl<N: Scalar, CFrom: Dim, CTo: Dim> Reallocator<N, Dynamic, CFrom, Dynamic, CTo> impl<N: Scalar, CFrom: Dim, CTo: Dim> Reallocator<N, Dynamic, CFrom, Dynamic, CTo>
for DefaultAllocator { for DefaultAllocator
{
#[inline] #[inline]
unsafe fn reallocate_copy( unsafe fn reallocate_copy(
rto: Dynamic, rto: Dynamic,
@ -227,8 +234,10 @@ impl<N: Scalar, CFrom: Dim, CTo: Dim> Reallocator<N, Dynamic, CFrom, Dynamic, CT
} }
} }
#[cfg(any(feature = "std", feature = "alloc"))]
impl<N: Scalar, CFrom: Dim, RTo: DimName> Reallocator<N, Dynamic, CFrom, RTo, Dynamic> impl<N: Scalar, CFrom: Dim, RTo: DimName> Reallocator<N, Dynamic, CFrom, RTo, Dynamic>
for DefaultAllocator { for DefaultAllocator
{
#[inline] #[inline]
unsafe fn reallocate_copy( unsafe fn reallocate_copy(
rto: RTo, rto: RTo,
@ -240,8 +249,10 @@ impl<N: Scalar, CFrom: Dim, RTo: DimName> Reallocator<N, Dynamic, CFrom, RTo, Dy
} }
} }
#[cfg(any(feature = "std", feature = "alloc"))]
impl<N: Scalar, RFrom: DimName, CTo: Dim> Reallocator<N, RFrom, Dynamic, Dynamic, CTo> impl<N: Scalar, RFrom: DimName, CTo: Dim> Reallocator<N, RFrom, Dynamic, Dynamic, CTo>
for DefaultAllocator { for DefaultAllocator
{
#[inline] #[inline]
unsafe fn reallocate_copy( unsafe fn reallocate_copy(
rto: Dynamic, rto: Dynamic,
@ -253,8 +264,10 @@ impl<N: Scalar, RFrom: DimName, CTo: Dim> Reallocator<N, RFrom, Dynamic, Dynamic
} }
} }
#[cfg(any(feature = "std", feature = "alloc"))]
impl<N: Scalar, RFrom: DimName, RTo: DimName> Reallocator<N, RFrom, Dynamic, RTo, Dynamic> impl<N: Scalar, RFrom: DimName, RTo: DimName> Reallocator<N, RFrom, Dynamic, RTo, Dynamic>
for DefaultAllocator { for DefaultAllocator
{
#[inline] #[inline]
unsafe fn reallocate_copy( unsafe fn reallocate_copy(
rto: RTo, rto: RTo,

View File

@ -2,12 +2,15 @@ use num::{One, Zero};
use std::cmp; use std::cmp;
use std::ptr; use std::ptr;
use core::{DMatrix, DefaultAllocator, Matrix, MatrixMN, RowVector, Scalar, Vector}; use base::allocator::{Allocator, Reallocator};
use core::dimension::{Dim, DimAdd, DimDiff, DimMin, DimMinimum, DimName, DimSub, DimSum, Dynamic, use base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
U1}; use base::dimension::{
use core::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; Dim, DimAdd, DimDiff, DimMin, DimMinimum, DimName, DimSub, DimSum, Dynamic, U1,
use core::allocator::{Allocator, Reallocator}; };
use core::storage::{Storage, StorageMut}; use base::storage::{Storage, StorageMut};
#[cfg(any(feature = "std", feature = "alloc"))]
use base::DMatrix;
use base::{DefaultAllocator, Matrix, MatrixMN, RowVector, Scalar, Vector};
impl<N: Scalar + Zero, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> { impl<N: Scalar + Zero, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
/// Extracts the upper triangular part of this matrix (including the diagonal). /// Extracts the upper triangular part of this matrix (including the diagonal).
@ -544,6 +547,7 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
/// ///
/// The values are copied such that `self[(i, j)] == result[(i, j)]`. If the result has more /// The values are copied such that `self[(i, j)] == result[(i, j)]`. If the result has more
/// rows and/or columns than `self`, then the extra rows or columns are filled with `val`. /// rows and/or columns than `self`, then the extra rows or columns are filled with `val`.
#[cfg(any(feature = "std", feature = "alloc"))]
pub fn resize(self, new_nrows: usize, new_ncols: usize, val: N) -> DMatrix<N> pub fn resize(self, new_nrows: usize, new_ncols: usize, val: N) -> DMatrix<N>
where where
DefaultAllocator: Reallocator<N, R, C, Dynamic, Dynamic>, DefaultAllocator: Reallocator<N, R, C, Dynamic, Dynamic>,
@ -600,15 +604,11 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
nrows - new_nrows.value(), nrows - new_nrows.value(),
); );
res = Matrix::from_data(DefaultAllocator::reallocate_copy( res = Matrix::from_data(DefaultAllocator::reallocate_copy(
new_nrows, new_nrows, new_ncols, data,
new_ncols,
data,
)); ));
} else { } else {
res = Matrix::from_data(DefaultAllocator::reallocate_copy( res = Matrix::from_data(DefaultAllocator::reallocate_copy(
new_nrows, new_nrows, new_ncols, data,
new_ncols,
data,
)); ));
extend_rows( extend_rows(
&mut res.data.as_mut_slice(), &mut res.data.as_mut_slice(),

View File

@ -3,9 +3,9 @@
use std::marker::PhantomData; use std::marker::PhantomData;
use std::mem; use std::mem;
use core::Scalar; use base::Scalar;
use core::dimension::Dim; use base::dimension::Dim;
use core::storage::{Storage, StorageMut}; use base::storage::{Storage, StorageMut};
macro_rules! iterator { macro_rules! iterator {
(struct $Name:ident for $Storage:ident.$ptr: ident -> $Ptr:ty, $Ref:ty, $SRef: ty) => { (struct $Name:ident for $Storage:ident.$ptr: ident -> $Ptr:ty, $Ref:ty, $SRef: ty) => {

View File

@ -16,14 +16,14 @@ use abomonation::Abomonation;
use alga::general::{Real, Ring}; use alga::general::{Real, Ring};
use core::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR}; use base::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR};
use core::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; use base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
use core::dimension::{Dim, DimAdd, DimSum, U1, U2, U3}; use base::dimension::{Dim, DimAdd, DimSum, U1, U2, U3};
use core::iter::{MatrixIter, MatrixIterMut}; use base::iter::{MatrixIter, MatrixIterMut};
use core::storage::{ use base::storage::{
ContiguousStorage, ContiguousStorageMut, Owned, SameShapeStorage, Storage, StorageMut, ContiguousStorage, ContiguousStorageMut, Owned, SameShapeStorage, Storage, StorageMut,
}; };
use core::{DefaultAllocator, MatrixMN, MatrixN, Scalar, Unit, VectorN}; use base::{DefaultAllocator, MatrixMN, MatrixN, Scalar, Unit, VectorN};
/// A square matrix. /// A square matrix.
pub type SquareMatrix<N, D, S> = Matrix<N, D, D, S>; pub type SquareMatrix<N, D, S> = Matrix<N, D, D, S>;

View File

@ -7,10 +7,10 @@ use alga::general::{AbstractGroup, AbstractGroupAbelian, AbstractLoop, AbstractM
RingCommutative}; RingCommutative};
use alga::linear::{FiniteDimInnerSpace, FiniteDimVectorSpace, InnerSpace, NormedSpace, VectorSpace}; use alga::linear::{FiniteDimInnerSpace, FiniteDimVectorSpace, InnerSpace, NormedSpace, VectorSpace};
use core::{DefaultAllocator, MatrixMN, MatrixN, Scalar}; use base::{DefaultAllocator, MatrixMN, MatrixN, Scalar};
use core::dimension::{Dim, DimName}; use base::dimension::{Dim, DimName};
use core::storage::{Storage, StorageMut}; use base::storage::{Storage, StorageMut};
use core::allocator::Allocator; use base::allocator::Allocator;
/* /*
* *

View File

@ -19,11 +19,11 @@ use abomonation::Abomonation;
use typenum::Prod; use typenum::Prod;
use generic_array::{ArrayLength, GenericArray}; use generic_array::{ArrayLength, GenericArray};
use core::Scalar; use base::Scalar;
use core::dimension::{DimName, U1}; use base::dimension::{DimName, U1};
use core::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut}; use base::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut};
use core::allocator::Allocator; use base::allocator::Allocator;
use core::default_allocator::DefaultAllocator; use base::default_allocator::DefaultAllocator;
/* /*
* *

View File

@ -2,12 +2,12 @@ use std::marker::PhantomData;
use std::ops::{Range, RangeFrom, RangeFull, RangeTo}; use std::ops::{Range, RangeFrom, RangeFull, RangeTo};
use std::slice; use std::slice;
use core::{Matrix, Scalar}; use base::{Matrix, Scalar};
use core::dimension::{Dim, DimName, Dynamic, U1}; use base::dimension::{Dim, DimName, Dynamic, U1};
use core::iter::MatrixIter; use base::iter::MatrixIter;
use core::storage::{Owned, Storage, StorageMut}; use base::storage::{Owned, Storage, StorageMut};
use core::allocator::Allocator; use base::allocator::Allocator;
use core::default_allocator::DefaultAllocator; use base::default_allocator::DefaultAllocator;
macro_rules! slice_storage_impl( macro_rules! slice_storage_impl(
($doc: expr; $Storage: ident as $SRef: ty; $T: ident.$get_addr: ident ($Ptr: ty as $Ref: ty)) => { ($doc: expr; $Storage: ident as $SRef: ty; $T: ident.$get_addr: ident ($Ptr: ty as $Ref: ty)) => {

View File

@ -1,10 +1,10 @@
use std::ops::Deref; use std::ops::Deref;
use core::Scalar; use base::allocator::Allocator;
use core::dimension::{Dim, DimName, Dynamic, U1}; use base::default_allocator::DefaultAllocator;
use core::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut}; use base::dimension::{Dim, DimName, Dynamic, U1};
use core::allocator::Allocator; use base::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut};
use core::default_allocator::DefaultAllocator; use base::Scalar;
#[cfg(feature = "abomonation-serialize")] #[cfg(feature = "abomonation-serialize")]
use abomonation::Abomonation; use abomonation::Abomonation;

View File

@ -1,45 +1,47 @@
//! [Reexported at the root of this crate.] Data structures for vector and matrix computations. //! [Reexported at the root of this crate.] Data structures for vector and matrix computations.
pub mod dimension;
pub mod constraint;
pub mod allocator; pub mod allocator;
pub mod storage;
pub mod coordinates;
mod ops;
mod blas; mod blas;
pub mod iter; pub mod constraint;
pub mod coordinates;
pub mod default_allocator; pub mod default_allocator;
pub mod dimension;
pub mod iter;
mod ops;
pub mod storage;
mod scalar; mod alias;
mod matrix; mod alias_slice;
mod cg;
mod componentwise;
mod construction; mod construction;
mod construction_slice; mod construction_slice;
mod construction_slice_deprecated; mod construction_slice_deprecated;
mod properties;
mod alias;
mod alias_slice;
mod matrix_alga;
mod conversion; mod conversion;
mod matrix_slice;
mod matrix_array;
mod matrix_vec;
mod cg;
mod unit;
mod componentwise;
mod edition; mod edition;
mod matrix;
mod matrix_alga;
mod matrix_array;
mod matrix_slice;
#[cfg(any(feature = "std", feature = "alloc"))]
mod matrix_vec;
mod properties;
mod scalar;
mod unit;
#[doc(hidden)] #[doc(hidden)]
pub mod helper; pub mod helper;
pub use self::scalar::*;
pub use self::matrix::*; pub use self::matrix::*;
pub use self::scalar::*;
pub use self::unit::*; pub use self::unit::*;
pub use self::dimension::*;
pub use self::default_allocator::*; pub use self::default_allocator::*;
pub use self::dimension::*;
pub use self::alias::*; pub use self::alias::*;
pub use self::alias_slice::*; pub use self::alias_slice::*;
pub use self::matrix_slice::*;
pub use self::matrix_array::*; pub use self::matrix_array::*;
pub use self::matrix_slice::*;
#[cfg(any(feature = "std", feature = "alloc"))]
pub use self::matrix_vec::*; pub use self::matrix_vec::*;

View File

@ -6,12 +6,12 @@ use num::{One, Signed, Zero};
use alga::general::{ClosedAdd, ClosedDiv, ClosedMul, ClosedNeg, ClosedSub}; use alga::general::{ClosedAdd, ClosedDiv, ClosedMul, ClosedNeg, ClosedSub};
use core::{DefaultAllocator, Matrix, MatrixMN, MatrixN, MatrixSum, Scalar}; use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, MatrixSum, Scalar};
use core::dimension::{Dim, DimMul, DimName, DimProd}; use base::dimension::{Dim, DimMul, DimName, DimProd};
use core::constraint::{AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows, use base::constraint::{AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows,
ShapeConstraint}; ShapeConstraint};
use core::storage::{ContiguousStorageMut, Storage, StorageMut}; use base::storage::{ContiguousStorageMut, Storage, StorageMut};
use core::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR}; use base::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR};
/* /*
* *

View File

@ -4,10 +4,10 @@ use num::{One, Zero};
use alga::general::{ClosedAdd, ClosedMul, Real}; use alga::general::{ClosedAdd, ClosedMul, Real};
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::{Dim, DimMin}; use base::dimension::{Dim, DimMin};
use core::storage::Storage; use base::storage::Storage;
use core::{DefaultAllocator, Matrix, Scalar, SquareMatrix}; use base::{DefaultAllocator, Matrix, Scalar, SquareMatrix};
impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> { impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
/// Indicates if this is a square matrix. /// Indicates if this is a square matrix.

View File

@ -3,10 +3,10 @@
use std::fmt::Debug; use std::fmt::Debug;
use std::mem; use std::mem;
use core::Scalar; use base::Scalar;
use core::default_allocator::DefaultAllocator; use base::default_allocator::DefaultAllocator;
use core::dimension::{Dim, U1}; use base::dimension::{Dim, U1};
use core::allocator::{Allocator, SameShapeC, SameShapeR}; use base::allocator::{Allocator, SameShapeC, SameShapeR};
/* /*
* Aliases for allocation results. * Aliases for allocation results.

View File

@ -1,14 +1,14 @@
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use base::storage::Owned;
#[cfg(feature = "arbitrary")]
use quickcheck::{Arbitrary, Gen}; use quickcheck::{Arbitrary, Gen};
#[cfg(feature = "arbitrary")]
use core::storage::Owned;
use num_complex::Complex;
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, MatrixN}; use base::allocator::Allocator;
use core::dimension::{Dim, Dynamic, U2}; use base::dimension::{Dim, Dynamic, U2};
use core::allocator::Allocator; use base::{DefaultAllocator, MatrixN};
use geometry::UnitComplex; use geometry::UnitComplex;
use num_complex::Complex;
/// A random orthogonal matrix. /// A random orthogonal matrix.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]

View File

@ -1,12 +1,12 @@
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use base::storage::Owned;
#[cfg(feature = "arbitrary")]
use quickcheck::{Arbitrary, Gen}; use quickcheck::{Arbitrary, Gen};
#[cfg(feature = "arbitrary")]
use core::storage::Owned;
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, MatrixN}; use base::allocator::Allocator;
use core::dimension::{Dim, Dynamic}; use base::dimension::{Dim, Dynamic};
use core::allocator::Allocator; use base::{DefaultAllocator, MatrixN};
use debug::RandomOrthogonal; use debug::RandomOrthogonal;

View File

@ -12,10 +12,10 @@ use abomonation::Abomonation;
use alga::general::{Real, SubsetOf}; use alga::general::{Real, SubsetOf};
use alga::linear::Rotation; use alga::linear::Rotation;
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
use core::storage::Owned; use base::storage::Owned;
use core::{DefaultAllocator, MatrixN}; use base::{DefaultAllocator, MatrixN};
use geometry::{Point, Translation}; use geometry::{Point, Translation};
/// A direct isometry, i.e., a rotation followed by a translation. /// A direct isometry, i.e., a rotation followed by a translation.

View File

@ -5,9 +5,9 @@ use alga::linear::Isometry as AlgaIsometry;
use alga::linear::{AffineTransformation, DirectIsometry, ProjectiveTransformation, Rotation, use alga::linear::{AffineTransformation, DirectIsometry, ProjectiveTransformation, Rotation,
Similarity, Transformation}; Similarity, Transformation};
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::DimName; use base::dimension::DimName;
use core::{DefaultAllocator, VectorN}; use base::{DefaultAllocator, VectorN};
use geometry::{Isometry, Point, Translation}; use geometry::{Isometry, Point, Translation};

View File

@ -1,4 +1,4 @@
use core::dimension::{U2, U3}; use base::dimension::{U2, U3};
use geometry::{Isometry, Rotation2, Rotation3, UnitComplex, UnitQuaternion}; use geometry::{Isometry, Rotation2, Rotation3, UnitComplex, UnitQuaternion};

View File

@ -1,7 +1,7 @@
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use quickcheck::{Arbitrary, Gen}; use quickcheck::{Arbitrary, Gen};
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use core::storage::Owned; use base::storage::Owned;
use num::One; use num::One;
use rand::{Rand, Rng}; use rand::{Rand, Rng};
@ -9,9 +9,9 @@ use rand::{Rand, Rng};
use alga::general::Real; use alga::general::Real;
use alga::linear::Rotation as AlgaRotation; use alga::linear::Rotation as AlgaRotation;
use core::{DefaultAllocator, Vector2, Vector3}; use base::{DefaultAllocator, Vector2, Vector3};
use core::dimension::{DimName, U2, U3}; use base::dimension::{DimName, U2, U3};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Isometry, Point, Point3, Rotation, Rotation2, Rotation3, Translation, UnitComplex, use geometry::{Isometry, Point, Point3, Rotation, Rotation2, Rotation3, Translation, UnitComplex,
UnitQuaternion}; UnitQuaternion};

View File

@ -1,9 +1,9 @@
use alga::general::{Real, SubsetOf, SupersetOf}; use alga::general::{Real, SubsetOf, SupersetOf};
use alga::linear::Rotation; use alga::linear::Rotation;
use core::{DefaultAllocator, MatrixN}; use base::{DefaultAllocator, MatrixN};
use core::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1}; use base::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation}; use geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation};

View File

@ -3,9 +3,9 @@ use std::ops::{Div, DivAssign, Mul, MulAssign};
use alga::general::Real; use alga::general::Real;
use alga::linear::Rotation as AlgaRotation; use alga::linear::Rotation as AlgaRotation;
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::{DimName, U1, U3, U4}; use base::dimension::{DimName, U1, U3, U4};
use core::{DefaultAllocator, Unit, VectorN}; use base::{DefaultAllocator, Unit, VectorN};
use geometry::{Isometry, Point, Rotation, Translation, UnitQuaternion}; use geometry::{Isometry, Point, Rotation, Translation, UnitQuaternion};

View File

@ -7,10 +7,10 @@ use std::fmt;
use alga::general::Real; use alga::general::Real;
use core::{Matrix4, Vector, Vector3}; use base::{Matrix4, Vector, Vector3};
use core::dimension::U3; use base::dimension::U3;
use core::storage::Storage; use base::storage::Storage;
use core::helper; use base::helper;
use geometry::Point3; use geometry::Point3;

View File

@ -8,10 +8,10 @@ use std::fmt;
use alga::general::Real; use alga::general::Real;
use core::{Matrix4, Scalar, Vector, Vector3}; use base::{Matrix4, Scalar, Vector, Vector3};
use core::dimension::U3; use base::dimension::U3;
use core::storage::Storage; use base::storage::Storage;
use core::helper; use base::helper;
use geometry::Point3; use geometry::Point3;

View File

@ -10,10 +10,10 @@ use serde;
#[cfg(feature = "abomonation-serialize")] #[cfg(feature = "abomonation-serialize")]
use abomonation::Abomonation; use abomonation::Abomonation;
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
use core::iter::{MatrixIter, MatrixIterMut}; use base::iter::{MatrixIter, MatrixIterMut};
use core::{DefaultAllocator, Scalar, VectorN}; use base::{DefaultAllocator, Scalar, VectorN};
/// A point in a n-dimensional euclidean space. /// A point in a n-dimensional euclidean space.
#[repr(C)] #[repr(C)]

View File

@ -1,9 +1,9 @@
use alga::general::{Field, JoinSemilattice, Lattice, MeetSemilattice, Real}; use alga::general::{Field, JoinSemilattice, Lattice, MeetSemilattice, Real};
use alga::linear::{AffineSpace, EuclideanSpace}; use alga::linear::{AffineSpace, EuclideanSpace};
use core::{DefaultAllocator, Scalar, VectorN}; use base::{DefaultAllocator, Scalar, VectorN};
use core::dimension::DimName; use base::dimension::DimName;
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::Point; use geometry::Point;

View File

@ -1,4 +1,4 @@
use core::dimension::{U1, U2, U3, U4, U5, U6}; use base::dimension::{U1, U2, U3, U4, U5, U6};
use geometry::Point; use geometry::Point;

View File

@ -5,9 +5,9 @@ use rand::{Rand, Rng};
use num::{Bounded, One, Zero}; use num::{Bounded, One, Zero};
use alga::general::ClosedDiv; use alga::general::ClosedDiv;
use core::{DefaultAllocator, Scalar, VectorN}; use base::{DefaultAllocator, Scalar, VectorN};
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1, U2, U3, U4, U5, U6}; use base::dimension::{DimName, DimNameAdd, DimNameSum, U1, U2, U3, U4, U5, U6};
use geometry::Point; use geometry::Point;

View File

@ -1,9 +1,9 @@
use num::{One, Zero}; use num::{One, Zero};
use alga::general::{ClosedDiv, SubsetOf, SupersetOf}; use alga::general::{ClosedDiv, SubsetOf, SupersetOf};
use core::{DefaultAllocator, Matrix, Scalar, VectorN}; use base::{DefaultAllocator, Matrix, Scalar, VectorN};
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::Point; use geometry::Point;

View File

@ -1,10 +1,10 @@
use std::mem; use std::mem;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use core::{DefaultAllocator, Scalar}; use base::allocator::Allocator;
use core::dimension::{U1, U2, U3, U4, U5, U6}; use base::coordinates::{X, XY, XYZ, XYZW, XYZWA, XYZWAB};
use core::coordinates::{X, XY, XYZ, XYZW, XYZWA, XYZWAB}; use base::dimension::{U1, U2, U3, U4, U5, U6};
use core::allocator::Allocator; use base::{DefaultAllocator, Scalar};
use geometry::Point; use geometry::Point;

View File

@ -1,14 +1,15 @@
use std::ops::{Add, AddAssign, Div, DivAssign, Index, IndexMut, Mul, MulAssign, Neg, Sub,
SubAssign};
use num::{One, Zero}; use num::{One, Zero};
use std::ops::{
Add, AddAssign, Div, DivAssign, Index, IndexMut, Mul, MulAssign, Neg, Sub, SubAssign,
};
use alga::general::{ClosedAdd, ClosedDiv, ClosedMul, ClosedNeg, ClosedSub}; use alga::general::{ClosedAdd, ClosedDiv, ClosedMul, ClosedNeg, ClosedSub};
use core::{DefaultAllocator, Matrix, Scalar, Vector, VectorSum}; use base::allocator::{Allocator, SameShapeAllocator};
use core::dimension::{Dim, DimName, U1}; use base::constraint::{AreMultipliable, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
use core::constraint::{AreMultipliable, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; use base::dimension::{Dim, DimName, U1};
use core::storage::Storage; use base::storage::Storage;
use core::allocator::{Allocator, SameShapeAllocator}; use base::{DefaultAllocator, Matrix, Scalar, Vector, VectorSum};
use geometry::Point; use geometry::Point;

View File

@ -4,7 +4,7 @@ use std::fmt;
use std::hash; use std::hash;
#[cfg(feature = "serde-serialize")] #[cfg(feature = "serde-serialize")]
use core::storage::Owned; use base::storage::Owned;
#[cfg(feature = "serde-serialize")] #[cfg(feature = "serde-serialize")]
use serde; use serde;
@ -13,9 +13,9 @@ use abomonation::Abomonation;
use alga::general::Real; use alga::general::Real;
use core::dimension::{U1, U3, U4}; use base::dimension::{U1, U3, U4};
use core::storage::{CStride, RStride}; use base::storage::{CStride, RStride};
use core::{Matrix3, MatrixN, MatrixSlice, MatrixSliceMut, Unit, Vector3, Vector4}; use base::{Matrix3, MatrixN, MatrixSlice, MatrixSliceMut, Unit, Vector3, Vector4};
use geometry::Rotation; use geometry::Rotation;

View File

@ -7,7 +7,7 @@ use alga::linear::{AffineTransformation, DirectIsometry, FiniteDimVectorSpace, I
NormedSpace, OrthogonalTransformation, ProjectiveTransformation, Rotation, NormedSpace, OrthogonalTransformation, ProjectiveTransformation, Rotation,
Similarity, Transformation, VectorSpace}; Similarity, Transformation, VectorSpace};
use core::{Vector3, Vector4}; use base::{Vector3, Vector4};
use geometry::{Point3, Quaternion, UnitQuaternion}; use geometry::{Point3, Quaternion, UnitQuaternion};
impl<N: Real> Identity<Multiplicative> for Quaternion<N> { impl<N: Real> Identity<Multiplicative> for Quaternion<N> {

View File

@ -1,18 +1,18 @@
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use quickcheck::{Arbitrary, Gen}; use quickcheck::{Arbitrary, Gen};
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use core::storage::Owned; use base::storage::Owned;
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use core::dimension::U4; use base::dimension::U4;
use rand::{Rand, Rng}; use rand::{Rand, Rng};
use num::{One, Zero}; use num::{One, Zero};
use alga::general::Real; use alga::general::Real;
use core::{Unit, Vector, Vector3, Vector4}; use base::{Unit, Vector, Vector3, Vector4};
use core::storage::Storage; use base::storage::Storage;
use core::dimension::U3; use base::dimension::U3;
use geometry::{Quaternion, Rotation, UnitQuaternion}; use geometry::{Quaternion, Rotation, UnitQuaternion};

View File

@ -6,8 +6,8 @@ use alga::linear::Rotation as AlgaRotation;
#[cfg(feature = "mint")] #[cfg(feature = "mint")]
use mint; use mint;
use core::{Matrix4, Vector4}; use base::{Matrix4, Vector4};
use core::dimension::U3; use base::dimension::U3;
use geometry::{Isometry, Point3, Quaternion, Rotation, Rotation3, Similarity, SuperTCategoryOf, use geometry::{Isometry, Point3, Quaternion, Rotation, Rotation3, Similarity, SuperTCategoryOf,
TAffine, Transform, Translation, UnitQuaternion}; TAffine, Transform, Translation, UnitQuaternion};

View File

@ -3,7 +3,7 @@ use std::ops::{Deref, DerefMut};
use alga::general::Real; use alga::general::Real;
use core::coordinates::IJKW; use base::coordinates::IJKW;
use geometry::Quaternion; use geometry::Quaternion;

View File

@ -55,10 +55,10 @@ use std::ops::{Add, AddAssign, Div, DivAssign, Index, IndexMut, Mul, MulAssign,
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, Unit, Vector, Vector3}; use base::{DefaultAllocator, Unit, Vector, Vector3};
use core::storage::Storage; use base::storage::Storage;
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::{U1, U3, U4}; use base::dimension::{U1, U3, U4};
use geometry::{Point3, Quaternion, Rotation, UnitQuaternion}; use geometry::{Point3, Quaternion, Rotation, UnitQuaternion};

View File

@ -1,7 +1,7 @@
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, Matrix, Scalar, Unit, Vector}; use base::allocator::Allocator;
use core::constraint::{AreMultipliable, DimEq, SameNumberOfRows, ShapeConstraint}; use base::constraint::{AreMultipliable, DimEq, SameNumberOfRows, ShapeConstraint};
use core::allocator::Allocator; use base::{DefaultAllocator, Matrix, Scalar, Unit, Vector};
use dimension::{Dim, DimName, U1}; use dimension::{Dim, DimName, U1};
use storage::{Storage, StorageMut}; use storage::{Storage, StorageMut};

View File

@ -7,16 +7,16 @@ use std::hash;
use serde; use serde;
#[cfg(feature = "serde-serialize")] #[cfg(feature = "serde-serialize")]
use core::storage::Owned; use base::storage::Owned;
#[cfg(feature = "abomonation-serialize")] #[cfg(feature = "abomonation-serialize")]
use abomonation::Abomonation; use abomonation::Abomonation;
use alga::general::Real; use alga::general::Real;
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
use core::{DefaultAllocator, MatrixN, Scalar}; use base::{DefaultAllocator, MatrixN, Scalar};
/// A rotation matrix. /// A rotation matrix.
#[repr(C)] #[repr(C)]

View File

@ -4,9 +4,9 @@ use alga::general::{AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid,
use alga::linear::{self, AffineTransformation, DirectIsometry, Isometry, OrthogonalTransformation, use alga::linear::{self, AffineTransformation, DirectIsometry, Isometry, OrthogonalTransformation,
ProjectiveTransformation, Similarity, Transformation}; ProjectiveTransformation, Similarity, Transformation};
use core::{DefaultAllocator, VectorN}; use base::{DefaultAllocator, VectorN};
use core::dimension::DimName; use base::dimension::DimName;
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Point, Rotation}; use geometry::{Point, Rotation};

View File

@ -1,4 +1,4 @@
use core::dimension::{U2, U3}; use base::dimension::{U2, U3};
use geometry::Rotation; use geometry::Rotation;

View File

@ -2,9 +2,9 @@ use num::{One, Zero};
use alga::general::{ClosedAdd, ClosedMul}; use alga::general::{ClosedAdd, ClosedMul};
use core::{DefaultAllocator, MatrixN, Scalar}; use base::{DefaultAllocator, MatrixN, Scalar};
use core::dimension::DimName; use base::dimension::DimName;
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::Rotation; use geometry::Rotation;

View File

@ -6,9 +6,9 @@ use alga::linear::Rotation as AlgaRotation;
#[cfg(feature = "mint")] #[cfg(feature = "mint")]
use mint; use mint;
use core::{DefaultAllocator, MatrixN}; use base::{DefaultAllocator, MatrixN};
use core::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1}; use base::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Isometry, Point, Rotation, Rotation2, Rotation3, Similarity, SuperTCategoryOf, use geometry::{Isometry, Point, Rotation, Rotation2, Rotation3, Similarity, SuperTCategoryOf,
TAffine, Transform, Translation, UnitComplex, UnitQuaternion}; TAffine, Transform, Translation, UnitComplex, UnitQuaternion};

View File

@ -21,11 +21,11 @@ use num::{One, Zero};
use alga::general::{ClosedAdd, ClosedMul}; use alga::general::{ClosedAdd, ClosedMul};
use core::{DefaultAllocator, Matrix, MatrixMN, Scalar}; use base::{DefaultAllocator, Matrix, MatrixMN, Scalar};
use core::dimension::{Dim, DimName, U1}; use base::dimension::{Dim, DimName, U1};
use core::constraint::{AreMultipliable, ShapeConstraint}; use base::constraint::{AreMultipliable, ShapeConstraint};
use core::storage::Storage; use base::storage::Storage;
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Point, Rotation}; use geometry::{Point, Rotation};

View File

@ -1,16 +1,16 @@
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use quickcheck::{Arbitrary, Gen}; use quickcheck::{Arbitrary, Gen};
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use core::storage::Owned; use base::storage::Owned;
use std::ops::Neg; use std::ops::Neg;
use num::Zero; use num::Zero;
use rand::{Rand, Rng}; use rand::{Rand, Rng};
use alga::general::Real; use alga::general::Real;
use core::{MatrixN, Unit, Vector, Vector1, Vector3, VectorN}; use base::{MatrixN, Unit, Vector, Vector1, Vector3, VectorN};
use core::dimension::{U1, U2, U3}; use base::dimension::{U1, U2, U3};
use core::storage::Storage; use base::storage::Storage;
use geometry::{Rotation2, Rotation3, UnitComplex}; use geometry::{Rotation2, Rotation3, UnitComplex};

View File

@ -11,10 +11,10 @@ use abomonation::Abomonation;
use alga::general::{Real, SubsetOf}; use alga::general::{Real, SubsetOf};
use alga::linear::Rotation; use alga::linear::Rotation;
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
use core::storage::Owned; use base::storage::Owned;
use core::{DefaultAllocator, MatrixN}; use base::{DefaultAllocator, MatrixN};
use geometry::{Isometry, Point, Translation}; use geometry::{Isometry, Point, Translation};
/// A similarity, i.e., an uniform scaling, followed by a rotation, followed by a translation. /// A similarity, i.e., an uniform scaling, followed by a rotation, followed by a translation.

View File

@ -3,9 +3,9 @@ use alga::general::{AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid,
use alga::linear::{AffineTransformation, ProjectiveTransformation, Rotation, Transformation}; use alga::linear::{AffineTransformation, ProjectiveTransformation, Rotation, Transformation};
use alga::linear::Similarity as AlgaSimilarity; use alga::linear::Similarity as AlgaSimilarity;
use core::{DefaultAllocator, VectorN}; use base::{DefaultAllocator, VectorN};
use core::dimension::DimName; use base::dimension::DimName;
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Point, Similarity, Translation}; use geometry::{Point, Similarity, Translation};

View File

@ -1,4 +1,4 @@
use core::dimension::{U2, U3}; use base::dimension::{U2, U3};
use geometry::{Rotation2, Rotation3, Similarity, UnitComplex, UnitQuaternion}; use geometry::{Rotation2, Rotation3, Similarity, UnitComplex, UnitQuaternion};

View File

@ -1,7 +1,7 @@
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use quickcheck::{Arbitrary, Gen}; use quickcheck::{Arbitrary, Gen};
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use core::storage::Owned; use base::storage::Owned;
use num::One; use num::One;
use rand::{Rand, Rng}; use rand::{Rand, Rng};
@ -9,9 +9,9 @@ use rand::{Rand, Rng};
use alga::general::Real; use alga::general::Real;
use alga::linear::Rotation as AlgaRotation; use alga::linear::Rotation as AlgaRotation;
use core::{DefaultAllocator, Vector2, Vector3}; use base::{DefaultAllocator, Vector2, Vector3};
use core::dimension::{DimName, U2, U3}; use base::dimension::{DimName, U2, U3};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Isometry, Point, Point3, Rotation2, Rotation3, Similarity, Translation, use geometry::{Isometry, Point, Point3, Rotation2, Rotation3, Similarity, Translation,
UnitComplex, UnitQuaternion}; UnitComplex, UnitQuaternion};

View File

@ -1,9 +1,9 @@
use alga::general::{Real, SubsetOf, SupersetOf}; use alga::general::{Real, SubsetOf, SupersetOf};
use alga::linear::Rotation; use alga::linear::Rotation;
use core::{DefaultAllocator, MatrixN}; use base::{DefaultAllocator, MatrixN};
use core::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1}; use base::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation}; use geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation};

View File

@ -3,9 +3,9 @@ use std::ops::{Div, DivAssign, Mul, MulAssign};
use alga::general::Real; use alga::general::Real;
use alga::linear::Rotation as AlgaRotation; use alga::linear::Rotation as AlgaRotation;
use core::{DefaultAllocator, VectorN}; use base::{DefaultAllocator, VectorN};
use core::dimension::{DimName, U1, U3, U4}; use base::dimension::{DimName, U1, U3, U4};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Isometry, Point, Rotation, Similarity, Translation, UnitQuaternion}; use geometry::{Isometry, Point, Rotation, Similarity, Translation, UnitQuaternion};

View File

@ -7,10 +7,10 @@ use serde;
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, MatrixN}; use base::{DefaultAllocator, MatrixN};
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
use core::storage::Owned; use base::storage::Owned;
use core::allocator::Allocator; use base::allocator::Allocator;
/// Trait implemented by phantom types identifying the projective transformation type. /// Trait implemented by phantom types identifying the projective transformation type.
/// ///
@ -350,7 +350,7 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use core::Matrix4; use base::Matrix4;
#[test] #[test]
fn checks_homogeneous_invariants_of_square_identity_matrix() { fn checks_homogeneous_invariants_of_square_identity_matrix() {

View File

@ -2,9 +2,9 @@ use alga::general::{AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid,
AbstractQuasigroup, AbstractSemigroup, Identity, Inverse, Multiplicative, Real}; AbstractQuasigroup, AbstractSemigroup, Identity, Inverse, Multiplicative, Real};
use alga::linear::{ProjectiveTransformation, Transformation}; use alga::linear::{ProjectiveTransformation, Transformation};
use core::{DefaultAllocator, VectorN}; use base::{DefaultAllocator, VectorN};
use core::dimension::{DimNameAdd, DimNameSum, U1}; use base::dimension::{DimNameAdd, DimNameSum, U1};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Point, SubTCategoryOf, TCategory, TProjective, Transform}; use geometry::{Point, SubTCategoryOf, TCategory, TProjective, Transform};

View File

@ -1,4 +1,4 @@
use core::dimension::{U2, U3}; use base::dimension::{U2, U3};
use geometry::{TAffine, TGeneral, TProjective, Transform}; use geometry::{TAffine, TGeneral, TProjective, Transform};

View File

@ -2,9 +2,9 @@ use num::One;
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, MatrixN}; use base::{DefaultAllocator, MatrixN};
use core::dimension::{DimNameAdd, DimNameSum, U1}; use base::dimension::{DimNameAdd, DimNameSum, U1};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{TCategory, Transform}; use geometry::{TCategory, Transform};

View File

@ -1,8 +1,8 @@
use alga::general::{Real, SubsetOf}; use alga::general::{Real, SubsetOf};
use core::{DefaultAllocator, MatrixN}; use base::{DefaultAllocator, MatrixN};
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{SuperTCategoryOf, TCategory, Transform}; use geometry::{SuperTCategoryOf, TCategory, Transform};

View File

@ -3,9 +3,9 @@ use std::ops::{Div, DivAssign, Index, IndexMut, Mul, MulAssign};
use alga::general::{ClosedAdd, ClosedMul, Real, SubsetOf}; use alga::general::{ClosedAdd, ClosedMul, Real, SubsetOf};
use core::{DefaultAllocator, MatrixN, Scalar, VectorN}; use base::{DefaultAllocator, MatrixN, Scalar, VectorN};
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1, U3, U4}; use base::dimension::{DimName, DimNameAdd, DimNameSum, U1, U3, U4};
use geometry::{Isometry, Point, Rotation, Similarity, SubTCategoryOf, SuperTCategoryOf, TAffine, use geometry::{Isometry, Point, Rotation, Similarity, SubTCategoryOf, SuperTCategoryOf, TAffine,
TCategory, TCategoryMul, TGeneral, TProjective, Transform, Translation, TCategory, TCategoryMul, TGeneral, TProjective, Transform, Translation,

View File

@ -11,10 +11,10 @@ use abomonation::Abomonation;
use alga::general::{ClosedNeg, Real}; use alga::general::{ClosedNeg, Real};
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
use core::storage::Owned; use base::storage::Owned;
use core::{DefaultAllocator, MatrixN, Scalar, VectorN}; use base::{DefaultAllocator, MatrixN, Scalar, VectorN};
/// A translation. /// A translation.
#[repr(C)] #[repr(C)]

View File

@ -5,9 +5,9 @@ use alga::linear::{AffineTransformation, DirectIsometry, Isometry, ProjectiveTra
Similarity, Transformation}; Similarity, Transformation};
use alga::linear::Translation as AlgaTranslation; use alga::linear::Translation as AlgaTranslation;
use core::{DefaultAllocator, VectorN}; use base::{DefaultAllocator, VectorN};
use core::dimension::DimName; use base::dimension::DimName;
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Point, Translation}; use geometry::{Point, Translation};

View File

@ -1,4 +1,4 @@
use core::dimension::{U2, U3}; use base::dimension::{U2, U3};
use geometry::Translation; use geometry::Translation;

View File

@ -1,16 +1,16 @@
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use quickcheck::{Arbitrary, Gen}; use quickcheck::{Arbitrary, Gen};
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use core::storage::Owned; use base::storage::Owned;
use num::{One, Zero}; use num::{One, Zero};
use rand::{Rand, Rng}; use rand::{Rand, Rng};
use alga::general::ClosedAdd; use alga::general::ClosedAdd;
use core::{DefaultAllocator, Scalar, VectorN}; use base::{DefaultAllocator, Scalar, VectorN};
use core::dimension::{DimName, U1, U2, U3, U4, U5, U6}; use base::dimension::{DimName, U1, U2, U3, U4, U5, U6};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::Translation; use geometry::Translation;

View File

@ -1,9 +1,9 @@
use alga::general::{Real, SubsetOf, SupersetOf}; use alga::general::{Real, SubsetOf, SupersetOf};
use alga::linear::Rotation; use alga::linear::Rotation;
use core::{DefaultAllocator, MatrixN, Scalar, VectorN}; use base::{DefaultAllocator, MatrixN, Scalar, VectorN};
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
use core::allocator::Allocator; use base::allocator::Allocator;
use geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation}; use geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation};

View File

@ -2,10 +2,10 @@ use std::ops::{Div, DivAssign, Mul, MulAssign};
use alga::general::{ClosedAdd, ClosedSub}; use alga::general::{ClosedAdd, ClosedSub};
use core::{DefaultAllocator, Scalar}; use base::{DefaultAllocator, Scalar};
use core::dimension::{DimName, U1}; use base::dimension::{DimName, U1};
use core::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
use core::allocator::{Allocator, SameShapeAllocator}; use base::allocator::{Allocator, SameShapeAllocator};
use geometry::{Point, Translation}; use geometry::{Point, Translation};

View File

@ -3,7 +3,7 @@ use num_complex::Complex;
use std::fmt; use std::fmt;
use alga::general::Real; use alga::general::Real;
use core::{Matrix2, Matrix3, Unit, Vector1}; use base::{Matrix2, Matrix3, Unit, Vector1};
use geometry::Rotation2; use geometry::Rotation2;
/// A complex number with a norm equal to 1. /// A complex number with a norm equal to 1.

View File

@ -4,9 +4,9 @@ use alga::general::{AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid,
use alga::linear::{AffineTransformation, DirectIsometry, Isometry, OrthogonalTransformation, use alga::linear::{AffineTransformation, DirectIsometry, Isometry, OrthogonalTransformation,
ProjectiveTransformation, Rotation, Similarity, Transformation}; ProjectiveTransformation, Rotation, Similarity, Transformation};
use core::{DefaultAllocator, Vector2}; use base::{DefaultAllocator, Vector2};
use core::allocator::Allocator; use base::allocator::Allocator;
use core::dimension::U2; use base::dimension::U2;
use geometry::{Point2, UnitComplex}; use geometry::{Point2, UnitComplex};
/* /*

View File

@ -6,10 +6,10 @@ use num_complex::Complex;
use rand::{Rand, Rng}; use rand::{Rand, Rng};
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, Unit, Vector}; use base::allocator::Allocator;
use core::dimension::{U1, U2}; use base::dimension::{U1, U2};
use core::storage::Storage; use base::storage::Storage;
use core::allocator::Allocator; use base::{DefaultAllocator, Unit, Vector};
use geometry::{Rotation, UnitComplex}; use geometry::{Rotation, UnitComplex};
impl<N: Real> UnitComplex<N> { impl<N: Real> UnitComplex<N> {

View File

@ -4,10 +4,12 @@ use num_complex::Complex;
use alga::general::{Real, SubsetOf, SupersetOf}; use alga::general::{Real, SubsetOf, SupersetOf};
use alga::linear::Rotation as AlgaRotation; use alga::linear::Rotation as AlgaRotation;
use core::Matrix3; use base::dimension::U2;
use core::dimension::U2; use base::Matrix3;
use geometry::{Isometry, Point2, Rotation2, Similarity, SuperTCategoryOf, TAffine, Transform, use geometry::{
Translation, UnitComplex}; Isometry, Point2, Rotation2, Similarity, SuperTCategoryOf, TAffine, Transform, Translation,
UnitComplex,
};
/* /*
* This file provides the following conversions: * This file provides the following conversions:

View File

@ -1,11 +1,11 @@
use std::ops::{Div, DivAssign, Mul, MulAssign}; use std::ops::{Div, DivAssign, Mul, MulAssign};
use alga::general::Real; use alga::general::Real;
use core::allocator::Allocator; use base::allocator::Allocator;
use core::constraint::{DimEq, ShapeConstraint}; use base::constraint::{DimEq, ShapeConstraint};
use core::dimension::{Dim, U1, U2}; use base::dimension::{Dim, U1, U2};
use core::storage::{Storage, StorageMut}; use base::storage::{Storage, StorageMut};
use core::{DefaultAllocator, Matrix, Unit, Vector, Vector2}; use base::{DefaultAllocator, Matrix, Unit, Vector, Vector2};
use geometry::{Isometry, Point2, Rotation, Similarity, Translation, UnitComplex}; use geometry::{Isometry, Point2, Rotation, Similarity, Translation, UnitComplex};
/* /*

View File

@ -84,6 +84,7 @@ an optimized set of tools for computer graphics and physics. Those features incl
#![deny(missing_docs)] #![deny(missing_docs)]
#![warn(incoherent_fundamental_impls)] #![warn(incoherent_fundamental_impls)]
#![doc(html_root_url = "http://nalgebra.org/rustdoc")] #![doc(html_root_url = "http://nalgebra.org/rustdoc")]
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
extern crate quickcheck; extern crate quickcheck;
@ -103,6 +104,7 @@ extern crate mint;
#[macro_use] #[macro_use]
extern crate approx; extern crate approx;
extern crate generic_array; extern crate generic_array;
#[cfg(feature = "std")]
extern crate matrixmultiply; extern crate matrixmultiply;
extern crate num_complex; extern crate num_complex;
extern crate num_traits as num; extern crate num_traits as num;
@ -111,20 +113,30 @@ extern crate typenum;
extern crate alga; extern crate alga;
pub mod core; #[cfg(not(feature = "std"))]
extern crate core as std;
pub mod base;
#[cfg(feature = "debug")] #[cfg(feature = "debug")]
pub mod debug; pub mod debug;
pub mod geometry; pub mod geometry;
pub mod linalg; pub mod linalg;
pub use core::*; #[cfg(feature = "std")]
#[deprecated(
note = "The 'core' module is being renamed 'based' to avoid conflicts with the 'core' crate."
)]
pub use base as core;
pub use base::*;
pub use geometry::*; pub use geometry::*;
pub use linalg::*; pub use linalg::*;
use std::cmp::{self, Ordering, PartialOrd}; use std::cmp::{self, Ordering, PartialOrd};
use alga::general::{Additive, AdditiveGroup, Identity, Inverse, JoinSemilattice, Lattice, use alga::general::{
MeetSemilattice, Multiplicative, SupersetOf}; Additive, AdditiveGroup, Identity, Inverse, JoinSemilattice, Lattice, MeetSemilattice,
Multiplicative, SupersetOf,
};
use alga::linear::SquareMatrix as AlgaSquareMatrix; use alga::linear::SquareMatrix as AlgaSquareMatrix;
use alga::linear::{EuclideanSpace, FiniteDimVectorSpace, InnerSpace, NormedSpace}; use alga::linear::{EuclideanSpace, FiniteDimVectorSpace, InnerSpace, NormedSpace};
use num::Signed; use num::Signed;

View File

@ -1,12 +1,12 @@
//! Functions for balancing a matrix. //! Functions for balancing a matrix.
use std::ops::{DivAssign, MulAssign};
use alga::general::Real; use alga::general::Real;
use std::ops::{DivAssign, MulAssign};
use core::{DefaultAllocator, MatrixN, VectorN};
use core::dimension::{Dim, U1};
use core::storage::Storage;
use allocator::Allocator; use allocator::Allocator;
use base::dimension::{Dim, U1};
use base::storage::Storage;
use base::{DefaultAllocator, MatrixN, VectorN};
/// Applies in-place a modified Parlett and Reinsch matrix balancing with 2-norm to the matrix `m` and returns /// Applies in-place a modified Parlett and Reinsch matrix balancing with 2-norm to the matrix `m` and returns
/// the corresponding diagonal transformation. /// the corresponding diagonal transformation.

View File

@ -2,33 +2,45 @@
use serde; use serde;
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Unit, VectorN}; use allocator::Allocator;
use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Unit, VectorN};
use constraint::{DimEq, ShapeConstraint};
use dimension::{Dim, DimDiff, DimMin, DimMinimum, DimSub, Dynamic, U1}; use dimension::{Dim, DimDiff, DimMin, DimMinimum, DimSub, Dynamic, U1};
use storage::Storage; use storage::Storage;
use allocator::Allocator;
use constraint::{DimEq, ShapeConstraint};
use linalg::householder;
use geometry::Reflection; use geometry::Reflection;
use linalg::householder;
/// The bidiagonalization of a general matrix. /// The bidiagonalization of a general matrix.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-serialize", #[cfg_attr(
serde(bound(serialize = "DimMinimum<R, C>: DimSub<U1>, feature = "serde-serialize",
serde(
bound(
serialize = "DimMinimum<R, C>: DimSub<U1>,
DefaultAllocator: Allocator<N, R, C> + DefaultAllocator: Allocator<N, R, C> +
Allocator<N, DimMinimum<R, C>> + Allocator<N, DimMinimum<R, C>> +
Allocator<N, DimDiff<DimMinimum<R, C>, U1>>, Allocator<N, DimDiff<DimMinimum<R, C>, U1>>,
MatrixMN<N, R, C>: serde::Serialize, MatrixMN<N, R, C>: serde::Serialize,
VectorN<N, DimMinimum<R, C>>: serde::Serialize, VectorN<N, DimMinimum<R, C>>: serde::Serialize,
VectorN<N, DimDiff<DimMinimum<R, C>, U1>>: serde::Serialize")))] VectorN<N, DimDiff<DimMinimum<R, C>, U1>>: serde::Serialize"
#[cfg_attr(feature = "serde-serialize", )
serde(bound(deserialize = "DimMinimum<R, C>: DimSub<U1>, )
)]
#[cfg_attr(
feature = "serde-serialize",
serde(
bound(
deserialize = "DimMinimum<R, C>: DimSub<U1>,
DefaultAllocator: Allocator<N, R, C> + DefaultAllocator: Allocator<N, R, C> +
Allocator<N, DimMinimum<R, C>> + Allocator<N, DimMinimum<R, C>> +
Allocator<N, DimDiff<DimMinimum<R, C>, U1>>, Allocator<N, DimDiff<DimMinimum<R, C>, U1>>,
MatrixMN<N, R, C>: serde::Deserialize<'de>, MatrixMN<N, R, C>: serde::Deserialize<'de>,
VectorN<N, DimMinimum<R, C>>: serde::Deserialize<'de>, VectorN<N, DimMinimum<R, C>>: serde::Deserialize<'de>,
VectorN<N, DimDiff<DimMinimum<R, C>, U1>>: serde::Deserialize<'de>")))] VectorN<N, DimDiff<DimMinimum<R, C>, U1>>: serde::Deserialize<'de>"
)
)
)]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Bidiagonal<N: Real, R: DimMin<C>, C: Dim> pub struct Bidiagonal<N: Real, R: DimMin<C>, C: Dim>
where where

View File

@ -3,20 +3,32 @@ use serde;
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, Matrix, MatrixMN, MatrixN, SquareMatrix};
use constraint::{SameNumberOfRows, ShapeConstraint};
use storage::{Storage, StorageMut};
use allocator::Allocator; use allocator::Allocator;
use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, SquareMatrix};
use constraint::{SameNumberOfRows, ShapeConstraint};
use dimension::{Dim, DimSub, Dynamic}; use dimension::{Dim, DimSub, Dynamic};
use storage::{Storage, StorageMut};
/// The Cholesky decomposion of a symmetric-definite-positive matrix. /// The Cholesky decomposion of a symmetric-definite-positive matrix.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-serialize", #[cfg_attr(
serde(bound(serialize = "DefaultAllocator: Allocator<N, D>, feature = "serde-serialize",
MatrixN<N, D>: serde::Serialize")))] serde(
#[cfg_attr(feature = "serde-serialize", bound(
serde(bound(deserialize = "DefaultAllocator: Allocator<N, D>, serialize = "DefaultAllocator: Allocator<N, D>,
MatrixN<N, D>: serde::Deserialize<'de>")))] MatrixN<N, D>: serde::Serialize"
)
)
)]
#[cfg_attr(
feature = "serde-serialize",
serde(
bound(
deserialize = "DefaultAllocator: Allocator<N, D>,
MatrixN<N, D>: serde::Deserialize<'de>"
)
)
)]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Cholesky<N: Real, D: Dim> pub struct Cholesky<N: Real, D: Dim>
where where

View File

@ -1,9 +1,9 @@
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, SquareMatrix}; use base::allocator::Allocator;
use core::dimension::DimMin; use base::dimension::DimMin;
use core::storage::Storage; use base::storage::Storage;
use core::allocator::Allocator; use base::{DefaultAllocator, SquareMatrix};
use linalg::LU; use linalg::LU;

View File

@ -1,64 +1,79 @@
#[cfg(feature = "serde-serialize")] #[cfg(feature = "serde-serialize")]
use serde; use serde;
use std::fmt::Display;
use std::cmp;
use num_complex::Complex;
use alga::general::Real; use alga::general::Real;
use num_complex::Complex;
use std::cmp;
use std::fmt::Display;
use std::ops::MulAssign; use std::ops::MulAssign;
use core::{DefaultAllocator, SquareMatrix, VectorN, MatrixN, Hessenberg, Unit, Vector2, Vector3};
use core::dimension::{Dim, DimSub, DimDiff, Dynamic, U1, U2, U3};
use core::storage::Storage;
use constraint::{ShapeConstraint, DimEq};
use allocator::Allocator; use allocator::Allocator;
use base::dimension::{Dim, DimDiff, DimSub, Dynamic, U1, U2, U3};
use base::storage::Storage;
use base::{DefaultAllocator, Hessenberg, MatrixN, SquareMatrix, Unit, Vector2, Vector3, VectorN};
use constraint::{DimEq, ShapeConstraint};
use geometry::{Reflection, UnitComplex};
use linalg::householder; use linalg::householder;
use linalg::RealSchur; use linalg::RealSchur;
use geometry::{Reflection, UnitComplex};
/// Eigendecomposition of a matrix with real eigenvalues. /// Eigendecomposition of a matrix with real eigenvalues.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-serialize", #[cfg_attr(
serde(bound(serialize = feature = "serde-serialize",
"DefaultAllocator: Allocator<N, D>, serde(
bound(
serialize = "DefaultAllocator: Allocator<N, D>,
VectorN<N, D>: serde::Serialize, VectorN<N, D>: serde::Serialize,
MatrixN<N, D>: serde::Serialize")))] MatrixN<N, D>: serde::Serialize"
#[cfg_attr(feature = "serde-serialize", )
serde(bound(deserialize = )
"DefaultAllocator: Allocator<N, D>, )]
#[cfg_attr(
feature = "serde-serialize",
serde(
bound(
deserialize = "DefaultAllocator: Allocator<N, D>,
VectorN<N, D>: serde::Serialize, VectorN<N, D>: serde::Serialize,
MatrixN<N, D>: serde::Deserialize<'de>")))] MatrixN<N, D>: serde::Deserialize<'de>"
)
)
)]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct RealEigen<N: Real, D: Dim> pub struct RealEigen<N: Real, D: Dim>
where DefaultAllocator: Allocator<N, D, D> + where
Allocator<N, D> { DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
{
pub eigenvectors: MatrixN<N, D>, pub eigenvectors: MatrixN<N, D>,
pub eigenvalues: VectorN<N, D> pub eigenvalues: VectorN<N, D>,
} }
impl<N: Real, D: Dim> Copy for RealEigen<N, D> impl<N: Real, D: Dim> Copy for RealEigen<N, D>
where DefaultAllocator: Allocator<N, D, D> + where
Allocator<N, D>, DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
MatrixN<N, D>: Copy, MatrixN<N, D>: Copy,
VectorN<N, D>: Copy { } VectorN<N, D>: Copy,
{
}
impl<N: Real, D: Dim> RealEigen<N, D> impl<N: Real, D: Dim> RealEigen<N, D>
where D: DimSub<U1>, // For Hessenberg. where
D: DimSub<U1>, // For Hessenberg.
ShapeConstraint: DimEq<Dynamic, DimDiff<D, U1>>, // For Hessenberg. ShapeConstraint: DimEq<Dynamic, DimDiff<D, U1>>, // For Hessenberg.
DefaultAllocator: Allocator<N, D, DimDiff<D, U1>> + // For Hessenberg. DefaultAllocator: Allocator<N, D, DimDiff<D, U1>>
Allocator<N, DimDiff<D, U1>> + // For Hessenberg. + Allocator<N, DimDiff<D, U1>>
Allocator<N, D, D> + + Allocator<N, D, D>
Allocator<N, D>, + Allocator<N, D>,
// XXX: for debug // XXX: for debug
DefaultAllocator: Allocator<usize, D, D>, DefaultAllocator: Allocator<usize, D, D>,
MatrixN<N, D>: Display { MatrixN<N, D>: Display,
{
/// Computes the eigendecomposition of a diagonalizable matrix with real eigenvalues. /// Computes the eigendecomposition of a diagonalizable matrix with real eigenvalues.
pub fn new(m: MatrixN<N, D>) -> Option<RealEigen<N, D>> { pub fn new(m: MatrixN<N, D>) -> Option<RealEigen<N, D>> {
assert!(m.is_square(), "Unable to compute the eigendecomposition of a non-square matrix."); assert!(
m.is_square(),
"Unable to compute the eigendecomposition of a non-square matrix."
);
let dim = m.nrows(); let dim = m.nrows();
let (mut eigenvectors, mut eigenvalues) = RealSchur::new(m, 0).unwrap().unpack(); let (mut eigenvectors, mut eigenvalues) = RealSchur::new(m, 0).unwrap().unpack();
@ -99,7 +114,7 @@ impl<N: Real, D: Dim> RealEigen<N, D>
Some(RealEigen { Some(RealEigen {
eigenvectors: eigenvectors, eigenvectors: eigenvectors,
eigenvalues: eigenvalues.diagonal() eigenvalues: eigenvalues.diagonal(),
}) })
} }
} }

View File

@ -2,27 +2,39 @@
use serde; use serde;
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, Matrix, MatrixMN, MatrixN}; use allocator::Allocator;
use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN};
use constraint::{SameNumberOfRows, ShapeConstraint};
use dimension::{Dim, DimMin, DimMinimum}; use dimension::{Dim, DimMin, DimMinimum};
use storage::{Storage, StorageMut}; use storage::{Storage, StorageMut};
use allocator::Allocator;
use constraint::{SameNumberOfRows, ShapeConstraint};
use linalg::lu; use linalg::lu;
use linalg::PermutationSequence; use linalg::PermutationSequence;
/// LU decomposition with full row and column pivoting. /// LU decomposition with full row and column pivoting.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-serialize", #[cfg_attr(
serde(bound(serialize = "DefaultAllocator: Allocator<N, R, C> + feature = "serde-serialize",
serde(
bound(
serialize = "DefaultAllocator: Allocator<N, R, C> +
Allocator<(usize, usize), DimMinimum<R, C>>, Allocator<(usize, usize), DimMinimum<R, C>>,
MatrixMN<N, R, C>: serde::Serialize, MatrixMN<N, R, C>: serde::Serialize,
PermutationSequence<DimMinimum<R, C>>: serde::Serialize")))] PermutationSequence<DimMinimum<R, C>>: serde::Serialize"
#[cfg_attr(feature = "serde-serialize", )
serde(bound(deserialize = "DefaultAllocator: Allocator<N, R, C> + )
)]
#[cfg_attr(
feature = "serde-serialize",
serde(
bound(
deserialize = "DefaultAllocator: Allocator<N, R, C> +
Allocator<(usize, usize), DimMinimum<R, C>>, Allocator<(usize, usize), DimMinimum<R, C>>,
MatrixMN<N, R, C>: serde::Deserialize<'de>, MatrixMN<N, R, C>: serde::Deserialize<'de>,
PermutationSequence<DimMinimum<R, C>>: serde::Deserialize<'de>")))] PermutationSequence<DimMinimum<R, C>>: serde::Deserialize<'de>"
)
)
)]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct FullPivLU<N: Real, R: DimMin<C>, C: Dim> pub struct FullPivLU<N: Real, R: DimMin<C>, C: Dim>
where where

View File

@ -3,9 +3,9 @@
use alga::general::Real; use alga::general::Real;
use num_complex::Complex; use num_complex::Complex;
use core::Vector; use base::dimension::U2;
use core::storage::Storage; use base::storage::Storage;
use core::dimension::U2; use base::Vector;
use geometry::UnitComplex; use geometry::UnitComplex;

View File

@ -2,26 +2,38 @@
use serde; use serde;
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, MatrixMN, MatrixN, SquareMatrix, VectorN}; use allocator::Allocator;
use base::{DefaultAllocator, MatrixMN, MatrixN, SquareMatrix, VectorN};
use constraint::{DimEq, ShapeConstraint};
use dimension::{DimDiff, DimSub, Dynamic, U1}; use dimension::{DimDiff, DimSub, Dynamic, U1};
use storage::Storage; use storage::Storage;
use allocator::Allocator;
use constraint::{DimEq, ShapeConstraint};
use linalg::householder; use linalg::householder;
/// Hessenberg decomposition of a general matrix. /// Hessenberg decomposition of a general matrix.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-serialize", #[cfg_attr(
serde(bound(serialize = "DefaultAllocator: Allocator<N, D, D> + feature = "serde-serialize",
serde(
bound(
serialize = "DefaultAllocator: Allocator<N, D, D> +
Allocator<N, DimDiff<D, U1>>, Allocator<N, DimDiff<D, U1>>,
MatrixN<N, D>: serde::Serialize, MatrixN<N, D>: serde::Serialize,
VectorN<N, DimDiff<D, U1>>: serde::Serialize")))] VectorN<N, DimDiff<D, U1>>: serde::Serialize"
#[cfg_attr(feature = "serde-serialize", )
serde(bound(deserialize = "DefaultAllocator: Allocator<N, D, D> + )
)]
#[cfg_attr(
feature = "serde-serialize",
serde(
bound(
deserialize = "DefaultAllocator: Allocator<N, D, D> +
Allocator<N, DimDiff<D, U1>>, Allocator<N, DimDiff<D, U1>>,
MatrixN<N, D>: serde::Deserialize<'de>, MatrixN<N, D>: serde::Deserialize<'de>,
VectorN<N, DimDiff<D, U1>>: serde::Deserialize<'de>")))] VectorN<N, DimDiff<D, U1>>: serde::Deserialize<'de>"
)
)
)]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Hessenberg<N: Real, D: DimSub<U1>> pub struct Hessenberg<N: Real, D: DimSub<U1>>
where where

View File

@ -1,10 +1,10 @@
//! Construction of householder elementary reflections. //! Construction of householder elementary reflections.
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, MatrixMN, MatrixN, Unit, Vector, VectorN}; use allocator::Allocator;
use base::{DefaultAllocator, MatrixMN, MatrixN, Unit, Vector, VectorN};
use dimension::Dim; use dimension::Dim;
use storage::{Storage, StorageMut}; use storage::{Storage, StorageMut};
use allocator::Allocator;
use geometry::Reflection; use geometry::Reflection;

View File

@ -1,9 +1,9 @@
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, MatrixN, SquareMatrix}; use base::{DefaultAllocator, MatrixN, SquareMatrix};
use core::dimension::Dim; use base::dimension::Dim;
use core::storage::{Storage, StorageMut}; use base::storage::{Storage, StorageMut};
use core::allocator::Allocator; use base::allocator::Allocator;
use linalg::lu; use linalg::lu;

View File

@ -1,28 +1,40 @@
#[cfg(feature = "serde-serialize")] #[cfg(feature = "serde-serialize")]
use serde; use serde;
use std::mem;
use alga::general::{Field, Real}; use alga::general::{Field, Real};
use core::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar};
use dimension::{Dim, DimMin, DimMinimum};
use storage::{Storage, StorageMut};
use allocator::{Allocator, Reallocator}; use allocator::{Allocator, Reallocator};
use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar};
use constraint::{SameNumberOfRows, ShapeConstraint}; use constraint::{SameNumberOfRows, ShapeConstraint};
use dimension::{Dim, DimMin, DimMinimum};
use std::mem;
use storage::{Storage, StorageMut};
use linalg::PermutationSequence; use linalg::PermutationSequence;
/// LU decomposition with partial (row) pivoting. /// LU decomposition with partial (row) pivoting.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-serialize", #[cfg_attr(
serde(bound(serialize = "DefaultAllocator: Allocator<N, R, C> + feature = "serde-serialize",
serde(
bound(
serialize = "DefaultAllocator: Allocator<N, R, C> +
Allocator<(usize, usize), DimMinimum<R, C>>, Allocator<(usize, usize), DimMinimum<R, C>>,
MatrixMN<N, R, C>: serde::Serialize, MatrixMN<N, R, C>: serde::Serialize,
PermutationSequence<DimMinimum<R, C>>: serde::Serialize")))] PermutationSequence<DimMinimum<R, C>>: serde::Serialize"
#[cfg_attr(feature = "serde-serialize", )
serde(bound(deserialize = "DefaultAllocator: Allocator<N, R, C> + )
)]
#[cfg_attr(
feature = "serde-serialize",
serde(
bound(
deserialize = "DefaultAllocator: Allocator<N, R, C> +
Allocator<(usize, usize), DimMinimum<R, C>>, Allocator<(usize, usize), DimMinimum<R, C>>,
MatrixMN<N, R, C>: serde::Deserialize<'de>, MatrixMN<N, R, C>: serde::Deserialize<'de>,
PermutationSequence<DimMinimum<R, C>>: serde::Deserialize<'de>")))] PermutationSequence<DimMinimum<R, C>>: serde::Deserialize<'de>"
)
)
)]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct LU<N: Real, R: DimMin<C>, C: Dim> pub struct LU<N: Real, R: DimMin<C>, C: Dim>
where where

View File

@ -1,22 +1,34 @@
#[cfg(feature = "serde-serialize")] #[cfg(feature = "serde-serialize")]
use serde; use serde;
use num::One;
use alga::general::ClosedNeg; use alga::general::ClosedNeg;
use num::One;
use core::{DefaultAllocator, Matrix, Scalar, VectorN}; use allocator::Allocator;
use base::{DefaultAllocator, Matrix, Scalar, VectorN};
use dimension::{Dim, DimName, Dynamic, U1}; use dimension::{Dim, DimName, Dynamic, U1};
use storage::StorageMut; use storage::StorageMut;
use allocator::Allocator;
/// A sequence of row or column permutations. /// A sequence of row or column permutations.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-serialize", #[cfg_attr(
serde(bound(serialize = "DefaultAllocator: Allocator<(usize, usize), D>, feature = "serde-serialize",
VectorN<(usize, usize), D>: serde::Serialize")))] serde(
#[cfg_attr(feature = "serde-serialize", bound(
serde(bound(deserialize = "DefaultAllocator: Allocator<(usize, usize), D>, serialize = "DefaultAllocator: Allocator<(usize, usize), D>,
VectorN<(usize, usize), D>: serde::Deserialize<'de>")))] VectorN<(usize, usize), D>: serde::Serialize"
)
)
)]
#[cfg_attr(
feature = "serde-serialize",
serde(
bound(
deserialize = "DefaultAllocator: Allocator<(usize, usize), D>,
VectorN<(usize, usize), D>: serde::Deserialize<'de>"
)
)
)]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct PermutationSequence<D: Dim> pub struct PermutationSequence<D: Dim>
where where

View File

@ -2,7 +2,7 @@
use serde; use serde;
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Unit, VectorN}; use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Unit, VectorN};
use dimension::{Dim, DimMin, DimMinimum, U1}; use dimension::{Dim, DimMin, DimMinimum, U1};
use storage::{Storage, StorageMut}; use storage::{Storage, StorageMut};
use allocator::{Allocator, Reallocator}; use allocator::{Allocator, Reallocator};

View File

@ -1,28 +1,40 @@
#[cfg(feature = "serde-serialize")] #[cfg(feature = "serde-serialize")]
use serde; use serde;
use std::cmp;
use num_complex::Complex;
use alga::general::Real; use alga::general::Real;
use num_complex::Complex;
use std::cmp;
use core::{DefaultAllocator, MatrixN, SquareMatrix, Unit, Vector2, Vector3, VectorN};
use core::dimension::{Dim, DimDiff, DimSub, Dynamic, U1, U2, U3};
use core::storage::Storage;
use constraint::{DimEq, ShapeConstraint};
use allocator::Allocator; use allocator::Allocator;
use base::dimension::{Dim, DimDiff, DimSub, Dynamic, U1, U2, U3};
use base::storage::Storage;
use base::{DefaultAllocator, MatrixN, SquareMatrix, Unit, Vector2, Vector3, VectorN};
use constraint::{DimEq, ShapeConstraint};
use geometry::{Reflection, UnitComplex};
use linalg::householder; use linalg::householder;
use linalg::Hessenberg; use linalg::Hessenberg;
use geometry::{Reflection, UnitComplex};
/// Real Schur decomposition of a square matrix. /// Real Schur decomposition of a square matrix.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-serialize", #[cfg_attr(
serde(bound(serialize = "DefaultAllocator: Allocator<N, D, D>, feature = "serde-serialize",
MatrixN<N, D>: serde::Serialize")))] serde(
#[cfg_attr(feature = "serde-serialize", bound(
serde(bound(deserialize = "DefaultAllocator: Allocator<N, D, D>, serialize = "DefaultAllocator: Allocator<N, D, D>,
MatrixN<N, D>: serde::Deserialize<'de>")))] MatrixN<N, D>: serde::Serialize"
)
)
)]
#[cfg_attr(
feature = "serde-serialize",
serde(
bound(
deserialize = "DefaultAllocator: Allocator<N, D, D>,
MatrixN<N, D>: serde::Deserialize<'de>"
)
)
)]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct RealSchur<N: Real, D: Dim> pub struct RealSchur<N: Real, D: Dim>
where where

View File

@ -1,10 +1,10 @@
use alga::general::Real; use alga::general::Real;
use core::{DefaultAllocator, Matrix, MatrixMN, SquareMatrix, Vector}; use base::allocator::Allocator;
use core::dimension::{Dim, U1}; use base::constraint::{SameNumberOfRows, ShapeConstraint};
use core::storage::{Storage, StorageMut}; use base::dimension::{Dim, U1};
use core::allocator::Allocator; use base::storage::{Storage, StorageMut};
use core::constraint::{SameNumberOfRows, ShapeConstraint}; use base::{DefaultAllocator, Matrix, MatrixMN, SquareMatrix, Vector};
impl<N: Real, D: Dim, S: Storage<N, D, D>> SquareMatrix<N, D, S> { impl<N: Real, D: Dim, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
/// Computes the solution of the linear system `self . x = b` where `x` is the unknown and only /// Computes the solution of the linear system `self . x = b` where `x` is the unknown and only

Some files were not shown because too many files have changed in this diff Show More