forked from M-Labs/nalgebra
Move core/* to base/* + add conditional compilation to dynamics matrices when no_std is enabled.
This commit is contained in:
parent
88055dfc45
commit
ca093fad29
14
CHANGELOG.md
14
CHANGELOG.md
@ -5,7 +5,21 @@ documented here.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [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
|
||||
* 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
|
||||
necessary to avoid the `incoherent_fundamental_impls` lint that is going to become a hard error.
|
||||
### Added
|
||||
|
20
Cargo.toml
20
Cargo.toml
@ -16,24 +16,26 @@ name = "nalgebra"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [ "matrixmultiply" ]
|
||||
arbitrary = [ "quickcheck" ]
|
||||
serde-serialize = [ "serde", "serde_derive", "num-complex/serde" ]
|
||||
abomonation-serialize = [ "abomonation" ]
|
||||
debug = [ ]
|
||||
|
||||
[dependencies]
|
||||
typenum = "1.7"
|
||||
generic-array = "0.8"
|
||||
rand = "0.4"
|
||||
num-traits = "0.1"
|
||||
num-complex = { version = "0.1", default-features = false }
|
||||
approx = "0.1"
|
||||
alga = "0.5"
|
||||
matrixmultiply = "0.1"
|
||||
typenum = "1.10"
|
||||
generic-array = "0.11"
|
||||
rand = { version = "0.4", default-features = false }
|
||||
num-traits = { version = "0.2", default-features = false }
|
||||
num-complex = { version = "0.2.0-git", git = "https://github.com/rust-num/num-complex", default-features = false }
|
||||
approx = { version = "0.1", default-features = false }
|
||||
alga = { version = "0.5", default-features = false }
|
||||
matrixmultiply = { version = "0.1", optional = true }
|
||||
serde = { version = "1.0", optional = true }
|
||||
serde_derive = { version = "1.0", optional = true }
|
||||
abomonation = { version = "0.4", optional = true }
|
||||
mint = { version = "0.4.2", optional = true }
|
||||
mint = { version = "0.5", optional = true }
|
||||
|
||||
[dependencies.quickcheck]
|
||||
optional = true
|
||||
|
@ -1,7 +1,8 @@
|
||||
use core::Matrix;
|
||||
use core::dimension::{Dynamic, U1, U2, U3, U4, U5, U6};
|
||||
use core::matrix_vec::MatrixVec;
|
||||
use core::storage::Owned;
|
||||
use base::dimension::{Dynamic, U1, U2, U3, U4, U5, U6};
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
use base::matrix_vec::MatrixVec;
|
||||
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>;
|
||||
|
||||
/// A dynamically sized column-major matrix.
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
pub type DMatrix<N> = MatrixN<N, Dynamic>;
|
||||
|
||||
/// 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.
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
pub type DVector<N> = Matrix<N, Dynamic, U1, MatrixVec<N, Dynamic, U1>>;
|
||||
|
||||
/// A statically sized D-dimensional column vector.
|
||||
@ -140,6 +143,7 @@ pub type Vector6<N> = VectorN<N, U6>;
|
||||
*
|
||||
*/
|
||||
/// A dynamically sized row vector.
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
pub type RowDVector<N> = Matrix<N, U1, Dynamic, MatrixVec<N, U1, Dynamic>>;
|
||||
|
||||
/// A statically sized D-dimensional row vector.
|
@ -1,6 +1,6 @@
|
||||
use core::Matrix;
|
||||
use core::dimension::{Dynamic, U1, U2, U3, U4, U5, U6};
|
||||
use core::matrix_slice::{SliceStorage, SliceStorageMut};
|
||||
use base::Matrix;
|
||||
use base::dimension::{Dynamic, U1, U2, U3, U4, U5, U6};
|
||||
use base::matrix_slice::{SliceStorage, SliceStorageMut};
|
||||
|
||||
/*
|
||||
*
|
@ -2,10 +2,10 @@
|
||||
|
||||
use std::any::Any;
|
||||
|
||||
use core::{DefaultAllocator, Scalar};
|
||||
use core::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use core::dimension::{Dim, U1};
|
||||
use core::storage::ContiguousStorageMut;
|
||||
use base::{DefaultAllocator, Scalar};
|
||||
use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use base::dimension::{Dim, U1};
|
||||
use base::storage::ContiguousStorageMut;
|
||||
|
||||
/// A matrix allocator of a memory buffer that may contain `R::to_usize() * C::to_usize()`
|
||||
/// elements of type `N`.
|
@ -1,14 +1,16 @@
|
||||
use std::mem;
|
||||
use num::{One, Signed, Zero};
|
||||
use matrixmultiply;
|
||||
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 core::dimension::{Dim, Dynamic, U1, U2, U3, U4};
|
||||
use core::constraint::{AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows,
|
||||
ShapeConstraint};
|
||||
use core::storage::{Storage, StorageMut};
|
||||
use core::allocator::Allocator;
|
||||
use base::allocator::Allocator;
|
||||
use base::constraint::{
|
||||
AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint,
|
||||
};
|
||||
use base::dimension::{Dim, Dynamic, U1, U2, U3, U4};
|
||||
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> {
|
||||
/// Computes the index of the vector component with the largest absolute value.
|
||||
@ -457,7 +459,12 @@ where
|
||||
+ SameNumberOfColumns<C1, 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 (nrows3, ncols3) = b.shape();
|
||||
|
||||
@ -531,13 +538,16 @@ where
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for j1 in 0..ncols1 {
|
||||
// FIXME: avoid bound checks.
|
||||
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.
|
||||
/// `alpha` and `beta` are scalar.
|
||||
@ -698,10 +708,8 @@ where
|
||||
S2: StorageMut<N, D2>,
|
||||
S3: Storage<N, D3, D3>,
|
||||
S4: Storage<N, R4, C4>,
|
||||
ShapeConstraint: DimEq<D3, R4>
|
||||
+ DimEq<D1, C4>
|
||||
+ DimEq<D2, D3>
|
||||
+ AreMultipliable<C4, R4, D2, U1>,
|
||||
ShapeConstraint:
|
||||
DimEq<D3, R4> + DimEq<D1, C4> + DimEq<D2, D3> + AreMultipliable<C4, R4, D2, U1>,
|
||||
{
|
||||
work.gemv(N::one(), mid, &rhs.column(0), N::zero());
|
||||
self.column_mut(0).gemv_tr(alpha, &rhs, work, beta);
|
@ -7,11 +7,11 @@
|
||||
|
||||
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};
|
||||
use core::dimension::{DimName, DimNameDiff, DimNameSub, U1};
|
||||
use core::storage::{Storage, StorageMut};
|
||||
use core::allocator::Allocator;
|
||||
use base::dimension::{DimName, DimNameDiff, DimNameSub, U1};
|
||||
use base::storage::{Storage, StorageMut};
|
||||
use base::allocator::Allocator;
|
||||
use geometry::{Isometry, IsometryMatrix3, Orthographic3, Perspective3, Point, Point3, Rotation2,
|
||||
Rotation3};
|
||||
|
@ -1,15 +1,15 @@
|
||||
// Non-convensional componentwise operators.
|
||||
|
||||
use std::ops::{Add, Mul};
|
||||
use num::{Signed, Zero};
|
||||
use std::ops::{Add, Mul};
|
||||
|
||||
use alga::general::{ClosedDiv, ClosedMul};
|
||||
|
||||
use core::{DefaultAllocator, Matrix, MatrixMN, MatrixSum, Scalar};
|
||||
use core::dimension::Dim;
|
||||
use core::storage::{Storage, StorageMut};
|
||||
use core::allocator::{Allocator, SameShapeAllocator};
|
||||
use core::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use base::allocator::{Allocator, SameShapeAllocator};
|
||||
use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use base::dimension::Dim;
|
||||
use base::storage::{Storage, StorageMut};
|
||||
use base::{DefaultAllocator, Matrix, MatrixMN, MatrixSum, Scalar};
|
||||
|
||||
/// The type of the result of a matrix componentwise operation.
|
||||
pub type MatrixComponentOp<N, R1, C1, R2, C2> = MatrixSum<N, R1, C1, R2, C2>;
|
@ -1,6 +1,6 @@
|
||||
//! 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.
|
||||
pub struct ShapeConstraint;
|
@ -1,5 +1,5 @@
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use core::storage::Owned;
|
||||
use base::storage::Owned;
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use quickcheck::{Arbitrary, Gen};
|
||||
|
||||
@ -10,10 +10,10 @@ use typenum::{self, Cmp, Greater};
|
||||
|
||||
use alga::general::{ClosedAdd, ClosedMul};
|
||||
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::{Dim, DimName, Dynamic, U1, U2, U3, U4, U5, U6};
|
||||
use core::storage::Storage;
|
||||
use core::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar, Unit, Vector, VectorN};
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{Dim, DimName, Dynamic, U1, U2, U3, U4, U5, U6};
|
||||
use base::storage::Storage;
|
||||
use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar, Unit, Vector, VectorN};
|
||||
|
||||
/*
|
||||
*
|
||||
@ -228,6 +228,7 @@ where
|
||||
|
||||
/// Creates a matrix filled with random values.
|
||||
#[inline]
|
||||
#[cfg(feature = "std")]
|
||||
pub fn new_random_generic(nrows: R, ncols: C) -> Self
|
||||
where
|
||||
N: Rand,
|
||||
@ -384,6 +385,7 @@ macro_rules! impl_constructors(
|
||||
|
||||
/// Creates a matrix filled with random values.
|
||||
#[inline]
|
||||
#[cfg(feature = "std")]
|
||||
pub fn new_random($($args: usize),*) -> Self {
|
||||
Self::new_random_generic($($gargs),*)
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
use core::dimension::{Dim, DimName, Dynamic, U1};
|
||||
use core::matrix_slice::{SliceStorage, SliceStorageMut};
|
||||
use core::{MatrixSliceMN, MatrixSliceMutMN, Scalar};
|
||||
use base::dimension::{Dim, DimName, Dynamic, U1};
|
||||
use base::matrix_slice::{SliceStorage, SliceStorageMut};
|
||||
use base::{MatrixSliceMN, MatrixSliceMutMN, Scalar};
|
||||
|
||||
/*
|
||||
*
|
@ -1,6 +1,6 @@
|
||||
use core::{MatrixSliceMN, MatrixSliceMutMN, Scalar};
|
||||
use core::dimension::{Dim, DimName, Dynamic, U1};
|
||||
use core::matrix_slice::{SliceStorage, SliceStorageMut};
|
||||
use base::dimension::{Dim, DimName, Dynamic, U1};
|
||||
use base::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.
|
||||
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`.
|
||||
#[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(
|
||||
data: &'a [N],
|
||||
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.
|
||||
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`.
|
||||
#[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(
|
||||
data: &'a [N],
|
||||
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."
|
||||
);
|
||||
|
||||
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.
|
||||
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`.
|
||||
#[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(
|
||||
data: &'a mut [N],
|
||||
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.
|
||||
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`.
|
||||
#[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(
|
||||
data: &'a mut [N],
|
||||
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.
|
||||
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`.
|
||||
#[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 {
|
||||
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.
|
||||
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`.
|
||||
#[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 {
|
||||
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.
|
||||
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`.
|
||||
#[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(
|
||||
data: &'a mut [N],
|
||||
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.
|
||||
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`.
|
||||
#[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 {
|
||||
Self::from_slice_with_strides_generic(data, nrows, ncols, U1, nrows)
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
use std::ptr;
|
||||
use std::mem;
|
||||
use std::convert::{AsMut, AsRef, From, Into};
|
||||
use alga::general::{SubsetOf, SupersetOf};
|
||||
#[cfg(feature = "mint")]
|
||||
use mint;
|
||||
use std::convert::{AsMut, AsRef, From, Into};
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
use core::{DefaultAllocator, Matrix, MatrixMN, Scalar};
|
||||
use core::dimension::{Dim, U1, U10, U11, U12, U13, U14, U15, U16, U2, U3, U4, U5, U6, U7, U8, U9};
|
||||
use core::iter::{MatrixIter, MatrixIterMut};
|
||||
use core::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use core::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut};
|
||||
use core::allocator::{Allocator, SameShapeAllocator};
|
||||
use base::allocator::{Allocator, SameShapeAllocator};
|
||||
use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use base::dimension::{Dim, U1, U10, U11, U12, U13, U14, U15, U16, U2, U3, U4, U5, U6, U7, U8, U9};
|
||||
use base::iter::{MatrixIter, MatrixIterMut};
|
||||
use base::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut};
|
||||
use base::{DefaultAllocator, Matrix, MatrixMN, Scalar};
|
||||
|
||||
// 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>
|
||||
@ -21,9 +21,8 @@ where
|
||||
C2: Dim,
|
||||
N1: Scalar,
|
||||
N2: Scalar + SupersetOf<N1>,
|
||||
DefaultAllocator: Allocator<N2, R2, C2>
|
||||
+ Allocator<N1, R1, C1>
|
||||
+ SameShapeAllocator<N1, R1, C1, R2, C2>,
|
||||
DefaultAllocator:
|
||||
Allocator<N2, R2, C2> + Allocator<N1, R1, C1> + SameShapeAllocator<N1, R1, C1, R2, C2>,
|
||||
ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>,
|
||||
{
|
||||
#[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
|
||||
for &'a mut Matrix<N, R, C, S> {
|
||||
for &'a mut Matrix<N, R, C, S>
|
||||
{
|
||||
type Item = &'a mut N;
|
||||
type IntoIter = MatrixIterMut<'a, N, R, C, S>;
|
||||
|
@ -7,9 +7,9 @@
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
use core::{Matrix, Scalar};
|
||||
use core::dimension::{U1, U2, U3, U4, U5, U6};
|
||||
use core::storage::{ContiguousStorage, ContiguousStorageMut};
|
||||
use base::{Matrix, Scalar};
|
||||
use base::dimension::{U1, U2, U3, U4, U5, U6};
|
||||
use base::storage::{ContiguousStorage, ContiguousStorageMut};
|
||||
|
||||
/*
|
||||
*
|
@ -3,20 +3,21 @@
|
||||
//! 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.
|
||||
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::cmp;
|
||||
use std::mem;
|
||||
use std::ops::Mul;
|
||||
use std::ptr;
|
||||
|
||||
use typenum::Prod;
|
||||
use generic_array::ArrayLength;
|
||||
use typenum::Prod;
|
||||
|
||||
use core::Scalar;
|
||||
use core::dimension::{Dim, DimName, Dynamic};
|
||||
use core::allocator::{Allocator, Reallocator};
|
||||
use core::storage::{Storage, StorageMut};
|
||||
use core::matrix_array::MatrixArray;
|
||||
use core::matrix_vec::MatrixVec;
|
||||
use base::allocator::{Allocator, Reallocator};
|
||||
use base::dimension::{Dim, DimName, Dynamic};
|
||||
use base::matrix_array::MatrixArray;
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
use base::matrix_vec::MatrixVec;
|
||||
use base::storage::{Storage, StorageMut};
|
||||
use base::Scalar;
|
||||
|
||||
/*
|
||||
*
|
||||
@ -68,6 +69,7 @@ where
|
||||
|
||||
// Dynamic - Static
|
||||
// Dynamic - Dynamic
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
impl<N: Scalar, C: Dim> Allocator<N, Dynamic, C> for DefaultAllocator {
|
||||
type Buffer = MatrixVec<N, Dynamic, C>;
|
||||
|
||||
@ -97,6 +99,7 @@ impl<N: Scalar, C: Dim> Allocator<N, Dynamic, C> for DefaultAllocator {
|
||||
}
|
||||
|
||||
// Static - Dynamic
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
impl<N: Scalar, R: DimName> Allocator<N, R, Dynamic> for DefaultAllocator {
|
||||
type Buffer = MatrixVec<N, R, Dynamic>;
|
||||
|
||||
@ -160,6 +163,7 @@ where
|
||||
}
|
||||
|
||||
// Static × Static -> Dynamic × Any
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
impl<N: Scalar, RFrom, CFrom, CTo> Reallocator<N, RFrom, CFrom, Dynamic, CTo> for DefaultAllocator
|
||||
where
|
||||
RFrom: DimName,
|
||||
@ -187,6 +191,7 @@ where
|
||||
}
|
||||
|
||||
// Static × Static -> Static × Dynamic
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
impl<N: Scalar, RFrom, CFrom, RTo> Reallocator<N, RFrom, CFrom, RTo, Dynamic> for DefaultAllocator
|
||||
where
|
||||
RFrom: DimName,
|
||||
@ -214,8 +219,10 @@ where
|
||||
}
|
||||
|
||||
// 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>
|
||||
for DefaultAllocator {
|
||||
for DefaultAllocator
|
||||
{
|
||||
#[inline]
|
||||
unsafe fn reallocate_copy(
|
||||
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>
|
||||
for DefaultAllocator {
|
||||
for DefaultAllocator
|
||||
{
|
||||
#[inline]
|
||||
unsafe fn reallocate_copy(
|
||||
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>
|
||||
for DefaultAllocator {
|
||||
for DefaultAllocator
|
||||
{
|
||||
#[inline]
|
||||
unsafe fn reallocate_copy(
|
||||
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>
|
||||
for DefaultAllocator {
|
||||
for DefaultAllocator
|
||||
{
|
||||
#[inline]
|
||||
unsafe fn reallocate_copy(
|
||||
rto: RTo,
|
@ -2,12 +2,15 @@ use num::{One, Zero};
|
||||
use std::cmp;
|
||||
use std::ptr;
|
||||
|
||||
use core::{DMatrix, DefaultAllocator, Matrix, MatrixMN, RowVector, Scalar, Vector};
|
||||
use core::dimension::{Dim, DimAdd, DimDiff, DimMin, DimMinimum, DimName, DimSub, DimSum, Dynamic,
|
||||
U1};
|
||||
use core::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use core::allocator::{Allocator, Reallocator};
|
||||
use core::storage::{Storage, StorageMut};
|
||||
use base::allocator::{Allocator, Reallocator};
|
||||
use base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use base::dimension::{
|
||||
Dim, DimAdd, DimDiff, DimMin, DimMinimum, DimName, DimSub, DimSum, Dynamic, U1,
|
||||
};
|
||||
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> {
|
||||
/// 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
|
||||
/// 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>
|
||||
where
|
||||
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(),
|
||||
);
|
||||
res = Matrix::from_data(DefaultAllocator::reallocate_copy(
|
||||
new_nrows,
|
||||
new_ncols,
|
||||
data,
|
||||
new_nrows, new_ncols, data,
|
||||
));
|
||||
} else {
|
||||
res = Matrix::from_data(DefaultAllocator::reallocate_copy(
|
||||
new_nrows,
|
||||
new_ncols,
|
||||
data,
|
||||
new_nrows, new_ncols, data,
|
||||
));
|
||||
extend_rows(
|
||||
&mut res.data.as_mut_slice(),
|
@ -3,9 +3,9 @@
|
||||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
|
||||
use core::Scalar;
|
||||
use core::dimension::Dim;
|
||||
use core::storage::{Storage, StorageMut};
|
||||
use base::Scalar;
|
||||
use base::dimension::Dim;
|
||||
use base::storage::{Storage, StorageMut};
|
||||
|
||||
macro_rules! iterator {
|
||||
(struct $Name:ident for $Storage:ident.$ptr: ident -> $Ptr:ty, $Ref:ty, $SRef: ty) => {
|
@ -16,14 +16,14 @@ use abomonation::Abomonation;
|
||||
|
||||
use alga::general::{Real, Ring};
|
||||
|
||||
use core::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR};
|
||||
use core::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use core::dimension::{Dim, DimAdd, DimSum, U1, U2, U3};
|
||||
use core::iter::{MatrixIter, MatrixIterMut};
|
||||
use core::storage::{
|
||||
use base::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR};
|
||||
use base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use base::dimension::{Dim, DimAdd, DimSum, U1, U2, U3};
|
||||
use base::iter::{MatrixIter, MatrixIterMut};
|
||||
use base::storage::{
|
||||
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.
|
||||
pub type SquareMatrix<N, D, S> = Matrix<N, D, D, S>;
|
@ -7,10 +7,10 @@ use alga::general::{AbstractGroup, AbstractGroupAbelian, AbstractLoop, AbstractM
|
||||
RingCommutative};
|
||||
use alga::linear::{FiniteDimInnerSpace, FiniteDimVectorSpace, InnerSpace, NormedSpace, VectorSpace};
|
||||
|
||||
use core::{DefaultAllocator, MatrixMN, MatrixN, Scalar};
|
||||
use core::dimension::{Dim, DimName};
|
||||
use core::storage::{Storage, StorageMut};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, MatrixMN, MatrixN, Scalar};
|
||||
use base::dimension::{Dim, DimName};
|
||||
use base::storage::{Storage, StorageMut};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
/*
|
||||
*
|
@ -19,11 +19,11 @@ use abomonation::Abomonation;
|
||||
use typenum::Prod;
|
||||
use generic_array::{ArrayLength, GenericArray};
|
||||
|
||||
use core::Scalar;
|
||||
use core::dimension::{DimName, U1};
|
||||
use core::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut};
|
||||
use core::allocator::Allocator;
|
||||
use core::default_allocator::DefaultAllocator;
|
||||
use base::Scalar;
|
||||
use base::dimension::{DimName, U1};
|
||||
use base::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut};
|
||||
use base::allocator::Allocator;
|
||||
use base::default_allocator::DefaultAllocator;
|
||||
|
||||
/*
|
||||
*
|
@ -2,12 +2,12 @@ use std::marker::PhantomData;
|
||||
use std::ops::{Range, RangeFrom, RangeFull, RangeTo};
|
||||
use std::slice;
|
||||
|
||||
use core::{Matrix, Scalar};
|
||||
use core::dimension::{Dim, DimName, Dynamic, U1};
|
||||
use core::iter::MatrixIter;
|
||||
use core::storage::{Owned, Storage, StorageMut};
|
||||
use core::allocator::Allocator;
|
||||
use core::default_allocator::DefaultAllocator;
|
||||
use base::{Matrix, Scalar};
|
||||
use base::dimension::{Dim, DimName, Dynamic, U1};
|
||||
use base::iter::MatrixIter;
|
||||
use base::storage::{Owned, Storage, StorageMut};
|
||||
use base::allocator::Allocator;
|
||||
use base::default_allocator::DefaultAllocator;
|
||||
|
||||
macro_rules! slice_storage_impl(
|
||||
($doc: expr; $Storage: ident as $SRef: ty; $T: ident.$get_addr: ident ($Ptr: ty as $Ref: ty)) => {
|
@ -1,10 +1,10 @@
|
||||
use std::ops::Deref;
|
||||
|
||||
use core::Scalar;
|
||||
use core::dimension::{Dim, DimName, Dynamic, U1};
|
||||
use core::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut};
|
||||
use core::allocator::Allocator;
|
||||
use core::default_allocator::DefaultAllocator;
|
||||
use base::allocator::Allocator;
|
||||
use base::default_allocator::DefaultAllocator;
|
||||
use base::dimension::{Dim, DimName, Dynamic, U1};
|
||||
use base::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut};
|
||||
use base::Scalar;
|
||||
|
||||
#[cfg(feature = "abomonation-serialize")]
|
||||
use abomonation::Abomonation;
|
@ -1,45 +1,47 @@
|
||||
//! [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 storage;
|
||||
pub mod coordinates;
|
||||
mod ops;
|
||||
mod blas;
|
||||
pub mod iter;
|
||||
pub mod constraint;
|
||||
pub mod coordinates;
|
||||
pub mod default_allocator;
|
||||
pub mod dimension;
|
||||
pub mod iter;
|
||||
mod ops;
|
||||
pub mod storage;
|
||||
|
||||
mod scalar;
|
||||
mod matrix;
|
||||
mod alias;
|
||||
mod alias_slice;
|
||||
mod cg;
|
||||
mod componentwise;
|
||||
mod construction;
|
||||
mod construction_slice;
|
||||
mod construction_slice_deprecated;
|
||||
mod properties;
|
||||
mod alias;
|
||||
mod alias_slice;
|
||||
mod matrix_alga;
|
||||
mod conversion;
|
||||
mod matrix_slice;
|
||||
mod matrix_array;
|
||||
mod matrix_vec;
|
||||
mod cg;
|
||||
mod unit;
|
||||
mod componentwise;
|
||||
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)]
|
||||
pub mod helper;
|
||||
|
||||
pub use self::scalar::*;
|
||||
pub use self::matrix::*;
|
||||
pub use self::scalar::*;
|
||||
pub use self::unit::*;
|
||||
|
||||
pub use self::dimension::*;
|
||||
pub use self::default_allocator::*;
|
||||
pub use self::dimension::*;
|
||||
|
||||
pub use self::alias::*;
|
||||
pub use self::alias_slice::*;
|
||||
pub use self::matrix_slice::*;
|
||||
pub use self::matrix_array::*;
|
||||
pub use self::matrix_slice::*;
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
pub use self::matrix_vec::*;
|
@ -6,12 +6,12 @@ use num::{One, Signed, Zero};
|
||||
|
||||
use alga::general::{ClosedAdd, ClosedDiv, ClosedMul, ClosedNeg, ClosedSub};
|
||||
|
||||
use core::{DefaultAllocator, Matrix, MatrixMN, MatrixN, MatrixSum, Scalar};
|
||||
use core::dimension::{Dim, DimMul, DimName, DimProd};
|
||||
use core::constraint::{AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows,
|
||||
use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, MatrixSum, Scalar};
|
||||
use base::dimension::{Dim, DimMul, DimName, DimProd};
|
||||
use base::constraint::{AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows,
|
||||
ShapeConstraint};
|
||||
use core::storage::{ContiguousStorageMut, Storage, StorageMut};
|
||||
use core::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR};
|
||||
use base::storage::{ContiguousStorageMut, Storage, StorageMut};
|
||||
use base::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR};
|
||||
|
||||
/*
|
||||
*
|
@ -4,10 +4,10 @@ use num::{One, Zero};
|
||||
|
||||
use alga::general::{ClosedAdd, ClosedMul, Real};
|
||||
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::{Dim, DimMin};
|
||||
use core::storage::Storage;
|
||||
use core::{DefaultAllocator, Matrix, Scalar, SquareMatrix};
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{Dim, DimMin};
|
||||
use base::storage::Storage;
|
||||
use base::{DefaultAllocator, Matrix, Scalar, SquareMatrix};
|
||||
|
||||
impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||
/// Indicates if this is a square matrix.
|
@ -3,10 +3,10 @@
|
||||
use std::fmt::Debug;
|
||||
use std::mem;
|
||||
|
||||
use core::Scalar;
|
||||
use core::default_allocator::DefaultAllocator;
|
||||
use core::dimension::{Dim, U1};
|
||||
use core::allocator::{Allocator, SameShapeC, SameShapeR};
|
||||
use base::Scalar;
|
||||
use base::default_allocator::DefaultAllocator;
|
||||
use base::dimension::{Dim, U1};
|
||||
use base::allocator::{Allocator, SameShapeC, SameShapeR};
|
||||
|
||||
/*
|
||||
* Aliases for allocation results.
|
@ -1,14 +1,14 @@
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use base::storage::Owned;
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use quickcheck::{Arbitrary, Gen};
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use core::storage::Owned;
|
||||
|
||||
use num_complex::Complex;
|
||||
use alga::general::Real;
|
||||
use core::{DefaultAllocator, MatrixN};
|
||||
use core::dimension::{Dim, Dynamic, U2};
|
||||
use core::allocator::Allocator;
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{Dim, Dynamic, U2};
|
||||
use base::{DefaultAllocator, MatrixN};
|
||||
use geometry::UnitComplex;
|
||||
use num_complex::Complex;
|
||||
|
||||
/// A random orthogonal matrix.
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -1,12 +1,12 @@
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use base::storage::Owned;
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use quickcheck::{Arbitrary, Gen};
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use core::storage::Owned;
|
||||
|
||||
use alga::general::Real;
|
||||
use core::{DefaultAllocator, MatrixN};
|
||||
use core::dimension::{Dim, Dynamic};
|
||||
use core::allocator::Allocator;
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{Dim, Dynamic};
|
||||
use base::{DefaultAllocator, MatrixN};
|
||||
|
||||
use debug::RandomOrthogonal;
|
||||
|
||||
|
@ -12,10 +12,10 @@ use abomonation::Abomonation;
|
||||
use alga::general::{Real, SubsetOf};
|
||||
use alga::linear::Rotation;
|
||||
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use core::storage::Owned;
|
||||
use core::{DefaultAllocator, MatrixN};
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use base::storage::Owned;
|
||||
use base::{DefaultAllocator, MatrixN};
|
||||
use geometry::{Point, Translation};
|
||||
|
||||
/// A direct isometry, i.e., a rotation followed by a translation.
|
||||
|
@ -5,9 +5,9 @@ use alga::linear::Isometry as AlgaIsometry;
|
||||
use alga::linear::{AffineTransformation, DirectIsometry, ProjectiveTransformation, Rotation,
|
||||
Similarity, Transformation};
|
||||
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::DimName;
|
||||
use core::{DefaultAllocator, VectorN};
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::DimName;
|
||||
use base::{DefaultAllocator, VectorN};
|
||||
|
||||
use geometry::{Isometry, Point, Translation};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use core::dimension::{U2, U3};
|
||||
use base::dimension::{U2, U3};
|
||||
|
||||
use geometry::{Isometry, Rotation2, Rotation3, UnitComplex, UnitQuaternion};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use quickcheck::{Arbitrary, Gen};
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use core::storage::Owned;
|
||||
use base::storage::Owned;
|
||||
|
||||
use num::One;
|
||||
use rand::{Rand, Rng};
|
||||
@ -9,9 +9,9 @@ use rand::{Rand, Rng};
|
||||
use alga::general::Real;
|
||||
use alga::linear::Rotation as AlgaRotation;
|
||||
|
||||
use core::{DefaultAllocator, Vector2, Vector3};
|
||||
use core::dimension::{DimName, U2, U3};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, Vector2, Vector3};
|
||||
use base::dimension::{DimName, U2, U3};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{Isometry, Point, Point3, Rotation, Rotation2, Rotation3, Translation, UnitComplex,
|
||||
UnitQuaternion};
|
||||
|
@ -1,9 +1,9 @@
|
||||
use alga::general::{Real, SubsetOf, SupersetOf};
|
||||
use alga::linear::Rotation;
|
||||
|
||||
use core::{DefaultAllocator, MatrixN};
|
||||
use core::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, MatrixN};
|
||||
use base::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation};
|
||||
|
||||
|
@ -3,9 +3,9 @@ use std::ops::{Div, DivAssign, Mul, MulAssign};
|
||||
use alga::general::Real;
|
||||
use alga::linear::Rotation as AlgaRotation;
|
||||
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::{DimName, U1, U3, U4};
|
||||
use core::{DefaultAllocator, Unit, VectorN};
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{DimName, U1, U3, U4};
|
||||
use base::{DefaultAllocator, Unit, VectorN};
|
||||
|
||||
use geometry::{Isometry, Point, Rotation, Translation, UnitQuaternion};
|
||||
|
||||
|
@ -7,10 +7,10 @@ use std::fmt;
|
||||
|
||||
use alga::general::Real;
|
||||
|
||||
use core::{Matrix4, Vector, Vector3};
|
||||
use core::dimension::U3;
|
||||
use core::storage::Storage;
|
||||
use core::helper;
|
||||
use base::{Matrix4, Vector, Vector3};
|
||||
use base::dimension::U3;
|
||||
use base::storage::Storage;
|
||||
use base::helper;
|
||||
|
||||
use geometry::Point3;
|
||||
|
||||
|
@ -8,10 +8,10 @@ use std::fmt;
|
||||
|
||||
use alga::general::Real;
|
||||
|
||||
use core::{Matrix4, Scalar, Vector, Vector3};
|
||||
use core::dimension::U3;
|
||||
use core::storage::Storage;
|
||||
use core::helper;
|
||||
use base::{Matrix4, Scalar, Vector, Vector3};
|
||||
use base::dimension::U3;
|
||||
use base::storage::Storage;
|
||||
use base::helper;
|
||||
|
||||
use geometry::Point3;
|
||||
|
||||
|
@ -10,10 +10,10 @@ use serde;
|
||||
#[cfg(feature = "abomonation-serialize")]
|
||||
use abomonation::Abomonation;
|
||||
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use core::iter::{MatrixIter, MatrixIterMut};
|
||||
use core::{DefaultAllocator, Scalar, VectorN};
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use base::iter::{MatrixIter, MatrixIterMut};
|
||||
use base::{DefaultAllocator, Scalar, VectorN};
|
||||
|
||||
/// A point in a n-dimensional euclidean space.
|
||||
#[repr(C)]
|
||||
|
@ -1,9 +1,9 @@
|
||||
use alga::general::{Field, JoinSemilattice, Lattice, MeetSemilattice, Real};
|
||||
use alga::linear::{AffineSpace, EuclideanSpace};
|
||||
|
||||
use core::{DefaultAllocator, Scalar, VectorN};
|
||||
use core::dimension::DimName;
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, Scalar, VectorN};
|
||||
use base::dimension::DimName;
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::Point;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -5,9 +5,9 @@ use rand::{Rand, Rng};
|
||||
use num::{Bounded, One, Zero};
|
||||
|
||||
use alga::general::ClosedDiv;
|
||||
use core::{DefaultAllocator, Scalar, VectorN};
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1, U2, U3, U4, U5, U6};
|
||||
use base::{DefaultAllocator, Scalar, VectorN};
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{DimName, DimNameAdd, DimNameSum, U1, U2, U3, U4, U5, U6};
|
||||
|
||||
use geometry::Point;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
use num::{One, Zero};
|
||||
use alga::general::{ClosedDiv, SubsetOf, SupersetOf};
|
||||
|
||||
use core::{DefaultAllocator, Matrix, Scalar, VectorN};
|
||||
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, Matrix, Scalar, VectorN};
|
||||
use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::Point;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
use core::{DefaultAllocator, Scalar};
|
||||
use core::dimension::{U1, U2, U3, U4, U5, U6};
|
||||
use core::coordinates::{X, XY, XYZ, XYZW, XYZWA, XYZWAB};
|
||||
use core::allocator::Allocator;
|
||||
use base::allocator::Allocator;
|
||||
use base::coordinates::{X, XY, XYZ, XYZW, XYZWA, XYZWAB};
|
||||
use base::dimension::{U1, U2, U3, U4, U5, U6};
|
||||
use base::{DefaultAllocator, Scalar};
|
||||
|
||||
use geometry::Point;
|
||||
|
||||
|
@ -1,14 +1,15 @@
|
||||
use std::ops::{Add, AddAssign, Div, DivAssign, Index, IndexMut, Mul, MulAssign, Neg, Sub,
|
||||
SubAssign};
|
||||
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 core::{DefaultAllocator, Matrix, Scalar, Vector, VectorSum};
|
||||
use core::dimension::{Dim, DimName, U1};
|
||||
use core::constraint::{AreMultipliable, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use core::storage::Storage;
|
||||
use core::allocator::{Allocator, SameShapeAllocator};
|
||||
use base::allocator::{Allocator, SameShapeAllocator};
|
||||
use base::constraint::{AreMultipliable, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use base::dimension::{Dim, DimName, U1};
|
||||
use base::storage::Storage;
|
||||
use base::{DefaultAllocator, Matrix, Scalar, Vector, VectorSum};
|
||||
|
||||
use geometry::Point;
|
||||
|
||||
|
@ -4,7 +4,7 @@ use std::fmt;
|
||||
use std::hash;
|
||||
|
||||
#[cfg(feature = "serde-serialize")]
|
||||
use core::storage::Owned;
|
||||
use base::storage::Owned;
|
||||
#[cfg(feature = "serde-serialize")]
|
||||
use serde;
|
||||
|
||||
@ -13,9 +13,9 @@ use abomonation::Abomonation;
|
||||
|
||||
use alga::general::Real;
|
||||
|
||||
use core::dimension::{U1, U3, U4};
|
||||
use core::storage::{CStride, RStride};
|
||||
use core::{Matrix3, MatrixN, MatrixSlice, MatrixSliceMut, Unit, Vector3, Vector4};
|
||||
use base::dimension::{U1, U3, U4};
|
||||
use base::storage::{CStride, RStride};
|
||||
use base::{Matrix3, MatrixN, MatrixSlice, MatrixSliceMut, Unit, Vector3, Vector4};
|
||||
|
||||
use geometry::Rotation;
|
||||
|
||||
|
@ -7,7 +7,7 @@ use alga::linear::{AffineTransformation, DirectIsometry, FiniteDimVectorSpace, I
|
||||
NormedSpace, OrthogonalTransformation, ProjectiveTransformation, Rotation,
|
||||
Similarity, Transformation, VectorSpace};
|
||||
|
||||
use core::{Vector3, Vector4};
|
||||
use base::{Vector3, Vector4};
|
||||
use geometry::{Point3, Quaternion, UnitQuaternion};
|
||||
|
||||
impl<N: Real> Identity<Multiplicative> for Quaternion<N> {
|
||||
|
@ -1,18 +1,18 @@
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use quickcheck::{Arbitrary, Gen};
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use core::storage::Owned;
|
||||
use base::storage::Owned;
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use core::dimension::U4;
|
||||
use base::dimension::U4;
|
||||
|
||||
use rand::{Rand, Rng};
|
||||
use num::{One, Zero};
|
||||
|
||||
use alga::general::Real;
|
||||
|
||||
use core::{Unit, Vector, Vector3, Vector4};
|
||||
use core::storage::Storage;
|
||||
use core::dimension::U3;
|
||||
use base::{Unit, Vector, Vector3, Vector4};
|
||||
use base::storage::Storage;
|
||||
use base::dimension::U3;
|
||||
|
||||
use geometry::{Quaternion, Rotation, UnitQuaternion};
|
||||
|
||||
|
@ -6,8 +6,8 @@ use alga::linear::Rotation as AlgaRotation;
|
||||
#[cfg(feature = "mint")]
|
||||
use mint;
|
||||
|
||||
use core::{Matrix4, Vector4};
|
||||
use core::dimension::U3;
|
||||
use base::{Matrix4, Vector4};
|
||||
use base::dimension::U3;
|
||||
use geometry::{Isometry, Point3, Quaternion, Rotation, Rotation3, Similarity, SuperTCategoryOf,
|
||||
TAffine, Transform, Translation, UnitQuaternion};
|
||||
|
||||
|
@ -3,7 +3,7 @@ use std::ops::{Deref, DerefMut};
|
||||
|
||||
use alga::general::Real;
|
||||
|
||||
use core::coordinates::IJKW;
|
||||
use base::coordinates::IJKW;
|
||||
|
||||
use geometry::Quaternion;
|
||||
|
||||
|
@ -55,10 +55,10 @@ use std::ops::{Add, AddAssign, Div, DivAssign, Index, IndexMut, Mul, MulAssign,
|
||||
|
||||
use alga::general::Real;
|
||||
|
||||
use core::{DefaultAllocator, Unit, Vector, Vector3};
|
||||
use core::storage::Storage;
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::{U1, U3, U4};
|
||||
use base::{DefaultAllocator, Unit, Vector, Vector3};
|
||||
use base::storage::Storage;
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{U1, U3, U4};
|
||||
|
||||
use geometry::{Point3, Quaternion, Rotation, UnitQuaternion};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use alga::general::Real;
|
||||
use core::{DefaultAllocator, Matrix, Scalar, Unit, Vector};
|
||||
use core::constraint::{AreMultipliable, DimEq, SameNumberOfRows, ShapeConstraint};
|
||||
use core::allocator::Allocator;
|
||||
use base::allocator::Allocator;
|
||||
use base::constraint::{AreMultipliable, DimEq, SameNumberOfRows, ShapeConstraint};
|
||||
use base::{DefaultAllocator, Matrix, Scalar, Unit, Vector};
|
||||
use dimension::{Dim, DimName, U1};
|
||||
use storage::{Storage, StorageMut};
|
||||
|
||||
|
@ -7,16 +7,16 @@ use std::hash;
|
||||
use serde;
|
||||
|
||||
#[cfg(feature = "serde-serialize")]
|
||||
use core::storage::Owned;
|
||||
use base::storage::Owned;
|
||||
|
||||
#[cfg(feature = "abomonation-serialize")]
|
||||
use abomonation::Abomonation;
|
||||
|
||||
use alga::general::Real;
|
||||
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use core::{DefaultAllocator, MatrixN, Scalar};
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use base::{DefaultAllocator, MatrixN, Scalar};
|
||||
|
||||
/// A rotation matrix.
|
||||
#[repr(C)]
|
||||
|
@ -4,9 +4,9 @@ use alga::general::{AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid,
|
||||
use alga::linear::{self, AffineTransformation, DirectIsometry, Isometry, OrthogonalTransformation,
|
||||
ProjectiveTransformation, Similarity, Transformation};
|
||||
|
||||
use core::{DefaultAllocator, VectorN};
|
||||
use core::dimension::DimName;
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, VectorN};
|
||||
use base::dimension::DimName;
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{Point, Rotation};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use core::dimension::{U2, U3};
|
||||
use base::dimension::{U2, U3};
|
||||
|
||||
use geometry::Rotation;
|
||||
|
||||
|
@ -2,9 +2,9 @@ use num::{One, Zero};
|
||||
|
||||
use alga::general::{ClosedAdd, ClosedMul};
|
||||
|
||||
use core::{DefaultAllocator, MatrixN, Scalar};
|
||||
use core::dimension::DimName;
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, MatrixN, Scalar};
|
||||
use base::dimension::DimName;
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::Rotation;
|
||||
|
||||
|
@ -6,9 +6,9 @@ use alga::linear::Rotation as AlgaRotation;
|
||||
#[cfg(feature = "mint")]
|
||||
use mint;
|
||||
|
||||
use core::{DefaultAllocator, MatrixN};
|
||||
use core::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, MatrixN};
|
||||
use base::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{Isometry, Point, Rotation, Rotation2, Rotation3, Similarity, SuperTCategoryOf,
|
||||
TAffine, Transform, Translation, UnitComplex, UnitQuaternion};
|
||||
|
@ -21,11 +21,11 @@ use num::{One, Zero};
|
||||
|
||||
use alga::general::{ClosedAdd, ClosedMul};
|
||||
|
||||
use core::{DefaultAllocator, Matrix, MatrixMN, Scalar};
|
||||
use core::dimension::{Dim, DimName, U1};
|
||||
use core::constraint::{AreMultipliable, ShapeConstraint};
|
||||
use core::storage::Storage;
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, Matrix, MatrixMN, Scalar};
|
||||
use base::dimension::{Dim, DimName, U1};
|
||||
use base::constraint::{AreMultipliable, ShapeConstraint};
|
||||
use base::storage::Storage;
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{Point, Rotation};
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use quickcheck::{Arbitrary, Gen};
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use core::storage::Owned;
|
||||
use base::storage::Owned;
|
||||
|
||||
use std::ops::Neg;
|
||||
use num::Zero;
|
||||
use rand::{Rand, Rng};
|
||||
use alga::general::Real;
|
||||
|
||||
use core::{MatrixN, Unit, Vector, Vector1, Vector3, VectorN};
|
||||
use core::dimension::{U1, U2, U3};
|
||||
use core::storage::Storage;
|
||||
use base::{MatrixN, Unit, Vector, Vector1, Vector3, VectorN};
|
||||
use base::dimension::{U1, U2, U3};
|
||||
use base::storage::Storage;
|
||||
|
||||
use geometry::{Rotation2, Rotation3, UnitComplex};
|
||||
|
||||
|
@ -11,10 +11,10 @@ use abomonation::Abomonation;
|
||||
use alga::general::{Real, SubsetOf};
|
||||
use alga::linear::Rotation;
|
||||
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use core::storage::Owned;
|
||||
use core::{DefaultAllocator, MatrixN};
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use base::storage::Owned;
|
||||
use base::{DefaultAllocator, MatrixN};
|
||||
use geometry::{Isometry, Point, Translation};
|
||||
|
||||
/// A similarity, i.e., an uniform scaling, followed by a rotation, followed by a translation.
|
||||
|
@ -3,9 +3,9 @@ use alga::general::{AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid,
|
||||
use alga::linear::{AffineTransformation, ProjectiveTransformation, Rotation, Transformation};
|
||||
use alga::linear::Similarity as AlgaSimilarity;
|
||||
|
||||
use core::{DefaultAllocator, VectorN};
|
||||
use core::dimension::DimName;
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, VectorN};
|
||||
use base::dimension::DimName;
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{Point, Similarity, Translation};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use core::dimension::{U2, U3};
|
||||
use base::dimension::{U2, U3};
|
||||
|
||||
use geometry::{Rotation2, Rotation3, Similarity, UnitComplex, UnitQuaternion};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use quickcheck::{Arbitrary, Gen};
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use core::storage::Owned;
|
||||
use base::storage::Owned;
|
||||
|
||||
use num::One;
|
||||
use rand::{Rand, Rng};
|
||||
@ -9,9 +9,9 @@ use rand::{Rand, Rng};
|
||||
use alga::general::Real;
|
||||
use alga::linear::Rotation as AlgaRotation;
|
||||
|
||||
use core::{DefaultAllocator, Vector2, Vector3};
|
||||
use core::dimension::{DimName, U2, U3};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, Vector2, Vector3};
|
||||
use base::dimension::{DimName, U2, U3};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{Isometry, Point, Point3, Rotation2, Rotation3, Similarity, Translation,
|
||||
UnitComplex, UnitQuaternion};
|
||||
|
@ -1,9 +1,9 @@
|
||||
use alga::general::{Real, SubsetOf, SupersetOf};
|
||||
use alga::linear::Rotation;
|
||||
|
||||
use core::{DefaultAllocator, MatrixN};
|
||||
use core::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, MatrixN};
|
||||
use base::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation};
|
||||
|
||||
|
@ -3,9 +3,9 @@ use std::ops::{Div, DivAssign, Mul, MulAssign};
|
||||
use alga::general::Real;
|
||||
use alga::linear::Rotation as AlgaRotation;
|
||||
|
||||
use core::{DefaultAllocator, VectorN};
|
||||
use core::dimension::{DimName, U1, U3, U4};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, VectorN};
|
||||
use base::dimension::{DimName, U1, U3, U4};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{Isometry, Point, Rotation, Similarity, Translation, UnitQuaternion};
|
||||
|
||||
|
@ -7,10 +7,10 @@ use serde;
|
||||
|
||||
use alga::general::Real;
|
||||
|
||||
use core::{DefaultAllocator, MatrixN};
|
||||
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use core::storage::Owned;
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, MatrixN};
|
||||
use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use base::storage::Owned;
|
||||
use base::allocator::Allocator;
|
||||
|
||||
/// Trait implemented by phantom types identifying the projective transformation type.
|
||||
///
|
||||
@ -350,7 +350,7 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use core::Matrix4;
|
||||
use base::Matrix4;
|
||||
|
||||
#[test]
|
||||
fn checks_homogeneous_invariants_of_square_identity_matrix() {
|
||||
|
@ -2,9 +2,9 @@ use alga::general::{AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid,
|
||||
AbstractQuasigroup, AbstractSemigroup, Identity, Inverse, Multiplicative, Real};
|
||||
use alga::linear::{ProjectiveTransformation, Transformation};
|
||||
|
||||
use core::{DefaultAllocator, VectorN};
|
||||
use core::dimension::{DimNameAdd, DimNameSum, U1};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, VectorN};
|
||||
use base::dimension::{DimNameAdd, DimNameSum, U1};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{Point, SubTCategoryOf, TCategory, TProjective, Transform};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use core::dimension::{U2, U3};
|
||||
use base::dimension::{U2, U3};
|
||||
|
||||
use geometry::{TAffine, TGeneral, TProjective, Transform};
|
||||
|
||||
|
@ -2,9 +2,9 @@ use num::One;
|
||||
|
||||
use alga::general::Real;
|
||||
|
||||
use core::{DefaultAllocator, MatrixN};
|
||||
use core::dimension::{DimNameAdd, DimNameSum, U1};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, MatrixN};
|
||||
use base::dimension::{DimNameAdd, DimNameSum, U1};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{TCategory, Transform};
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
use alga::general::{Real, SubsetOf};
|
||||
|
||||
use core::{DefaultAllocator, MatrixN};
|
||||
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, MatrixN};
|
||||
use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{SuperTCategoryOf, TCategory, Transform};
|
||||
|
||||
|
@ -3,9 +3,9 @@ use std::ops::{Div, DivAssign, Index, IndexMut, Mul, MulAssign};
|
||||
|
||||
use alga::general::{ClosedAdd, ClosedMul, Real, SubsetOf};
|
||||
|
||||
use core::{DefaultAllocator, MatrixN, Scalar, VectorN};
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1, U3, U4};
|
||||
use base::{DefaultAllocator, MatrixN, Scalar, VectorN};
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{DimName, DimNameAdd, DimNameSum, U1, U3, U4};
|
||||
|
||||
use geometry::{Isometry, Point, Rotation, Similarity, SubTCategoryOf, SuperTCategoryOf, TAffine,
|
||||
TCategory, TCategoryMul, TGeneral, TProjective, Transform, Translation,
|
||||
|
@ -11,10 +11,10 @@ use abomonation::Abomonation;
|
||||
|
||||
use alga::general::{ClosedNeg, Real};
|
||||
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use core::storage::Owned;
|
||||
use core::{DefaultAllocator, MatrixN, Scalar, VectorN};
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use base::storage::Owned;
|
||||
use base::{DefaultAllocator, MatrixN, Scalar, VectorN};
|
||||
|
||||
/// A translation.
|
||||
#[repr(C)]
|
||||
|
@ -5,9 +5,9 @@ use alga::linear::{AffineTransformation, DirectIsometry, Isometry, ProjectiveTra
|
||||
Similarity, Transformation};
|
||||
use alga::linear::Translation as AlgaTranslation;
|
||||
|
||||
use core::{DefaultAllocator, VectorN};
|
||||
use core::dimension::DimName;
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, VectorN};
|
||||
use base::dimension::DimName;
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{Point, Translation};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use core::dimension::{U2, U3};
|
||||
use base::dimension::{U2, U3};
|
||||
|
||||
use geometry::Translation;
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use quickcheck::{Arbitrary, Gen};
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use core::storage::Owned;
|
||||
use base::storage::Owned;
|
||||
|
||||
use num::{One, Zero};
|
||||
use rand::{Rand, Rng};
|
||||
|
||||
use alga::general::ClosedAdd;
|
||||
|
||||
use core::{DefaultAllocator, Scalar, VectorN};
|
||||
use core::dimension::{DimName, U1, U2, U3, U4, U5, U6};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, Scalar, VectorN};
|
||||
use base::dimension::{DimName, U1, U2, U3, U4, U5, U6};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::Translation;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
use alga::general::{Real, SubsetOf, SupersetOf};
|
||||
use alga::linear::Rotation;
|
||||
|
||||
use core::{DefaultAllocator, MatrixN, Scalar, VectorN};
|
||||
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, MatrixN, Scalar, VectorN};
|
||||
use base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation};
|
||||
|
||||
|
@ -2,10 +2,10 @@ use std::ops::{Div, DivAssign, Mul, MulAssign};
|
||||
|
||||
use alga::general::{ClosedAdd, ClosedSub};
|
||||
|
||||
use core::{DefaultAllocator, Scalar};
|
||||
use core::dimension::{DimName, U1};
|
||||
use core::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use core::allocator::{Allocator, SameShapeAllocator};
|
||||
use base::{DefaultAllocator, Scalar};
|
||||
use base::dimension::{DimName, U1};
|
||||
use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use base::allocator::{Allocator, SameShapeAllocator};
|
||||
|
||||
use geometry::{Point, Translation};
|
||||
|
||||
|
@ -3,7 +3,7 @@ use num_complex::Complex;
|
||||
use std::fmt;
|
||||
|
||||
use alga::general::Real;
|
||||
use core::{Matrix2, Matrix3, Unit, Vector1};
|
||||
use base::{Matrix2, Matrix3, Unit, Vector1};
|
||||
use geometry::Rotation2;
|
||||
|
||||
/// A complex number with a norm equal to 1.
|
||||
|
@ -4,9 +4,9 @@ use alga::general::{AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid,
|
||||
use alga::linear::{AffineTransformation, DirectIsometry, Isometry, OrthogonalTransformation,
|
||||
ProjectiveTransformation, Rotation, Similarity, Transformation};
|
||||
|
||||
use core::{DefaultAllocator, Vector2};
|
||||
use core::allocator::Allocator;
|
||||
use core::dimension::U2;
|
||||
use base::{DefaultAllocator, Vector2};
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::U2;
|
||||
use geometry::{Point2, UnitComplex};
|
||||
|
||||
/*
|
||||
|
@ -6,10 +6,10 @@ use num_complex::Complex;
|
||||
use rand::{Rand, Rng};
|
||||
|
||||
use alga::general::Real;
|
||||
use core::{DefaultAllocator, Unit, Vector};
|
||||
use core::dimension::{U1, U2};
|
||||
use core::storage::Storage;
|
||||
use core::allocator::Allocator;
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::{U1, U2};
|
||||
use base::storage::Storage;
|
||||
use base::{DefaultAllocator, Unit, Vector};
|
||||
use geometry::{Rotation, UnitComplex};
|
||||
|
||||
impl<N: Real> UnitComplex<N> {
|
||||
|
@ -4,10 +4,12 @@ use num_complex::Complex;
|
||||
use alga::general::{Real, SubsetOf, SupersetOf};
|
||||
use alga::linear::Rotation as AlgaRotation;
|
||||
|
||||
use core::Matrix3;
|
||||
use core::dimension::U2;
|
||||
use geometry::{Isometry, Point2, Rotation2, Similarity, SuperTCategoryOf, TAffine, Transform,
|
||||
Translation, UnitComplex};
|
||||
use base::dimension::U2;
|
||||
use base::Matrix3;
|
||||
use geometry::{
|
||||
Isometry, Point2, Rotation2, Similarity, SuperTCategoryOf, TAffine, Transform, Translation,
|
||||
UnitComplex,
|
||||
};
|
||||
|
||||
/*
|
||||
* This file provides the following conversions:
|
||||
|
@ -1,11 +1,11 @@
|
||||
use std::ops::{Div, DivAssign, Mul, MulAssign};
|
||||
|
||||
use alga::general::Real;
|
||||
use core::allocator::Allocator;
|
||||
use core::constraint::{DimEq, ShapeConstraint};
|
||||
use core::dimension::{Dim, U1, U2};
|
||||
use core::storage::{Storage, StorageMut};
|
||||
use core::{DefaultAllocator, Matrix, Unit, Vector, Vector2};
|
||||
use base::allocator::Allocator;
|
||||
use base::constraint::{DimEq, ShapeConstraint};
|
||||
use base::dimension::{Dim, U1, U2};
|
||||
use base::storage::{Storage, StorageMut};
|
||||
use base::{DefaultAllocator, Matrix, Unit, Vector, Vector2};
|
||||
use geometry::{Isometry, Point2, Rotation, Similarity, Translation, UnitComplex};
|
||||
|
||||
/*
|
||||
|
20
src/lib.rs
20
src/lib.rs
@ -84,6 +84,7 @@ an optimized set of tools for computer graphics and physics. Those features incl
|
||||
#![deny(missing_docs)]
|
||||
#![warn(incoherent_fundamental_impls)]
|
||||
#![doc(html_root_url = "http://nalgebra.org/rustdoc")]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
#[cfg(feature = "arbitrary")]
|
||||
extern crate quickcheck;
|
||||
@ -103,6 +104,7 @@ extern crate mint;
|
||||
#[macro_use]
|
||||
extern crate approx;
|
||||
extern crate generic_array;
|
||||
#[cfg(feature = "std")]
|
||||
extern crate matrixmultiply;
|
||||
extern crate num_complex;
|
||||
extern crate num_traits as num;
|
||||
@ -111,20 +113,30 @@ extern crate typenum;
|
||||
|
||||
extern crate alga;
|
||||
|
||||
pub mod core;
|
||||
#[cfg(not(feature = "std"))]
|
||||
extern crate core as std;
|
||||
|
||||
pub mod base;
|
||||
#[cfg(feature = "debug")]
|
||||
pub mod debug;
|
||||
pub mod geometry;
|
||||
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 linalg::*;
|
||||
|
||||
use std::cmp::{self, Ordering, PartialOrd};
|
||||
|
||||
use alga::general::{Additive, AdditiveGroup, Identity, Inverse, JoinSemilattice, Lattice,
|
||||
MeetSemilattice, Multiplicative, SupersetOf};
|
||||
use alga::general::{
|
||||
Additive, AdditiveGroup, Identity, Inverse, JoinSemilattice, Lattice, MeetSemilattice,
|
||||
Multiplicative, SupersetOf,
|
||||
};
|
||||
use alga::linear::SquareMatrix as AlgaSquareMatrix;
|
||||
use alga::linear::{EuclideanSpace, FiniteDimVectorSpace, InnerSpace, NormedSpace};
|
||||
use num::Signed;
|
||||
|
@ -1,12 +1,12 @@
|
||||
//! Functions for balancing a matrix.
|
||||
|
||||
use std::ops::{DivAssign, MulAssign};
|
||||
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 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
|
||||
/// the corresponding diagonal transformation.
|
||||
|
@ -2,33 +2,45 @@
|
||||
use serde;
|
||||
|
||||
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 storage::Storage;
|
||||
use allocator::Allocator;
|
||||
use constraint::{DimEq, ShapeConstraint};
|
||||
|
||||
use linalg::householder;
|
||||
use geometry::Reflection;
|
||||
use linalg::householder;
|
||||
|
||||
/// The bidiagonalization of a general matrix.
|
||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(serialize = "DimMinimum<R, C>: DimSub<U1>,
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
serialize = "DimMinimum<R, C>: DimSub<U1>,
|
||||
DefaultAllocator: Allocator<N, R, C> +
|
||||
Allocator<N, DimMinimum<R, C>> +
|
||||
Allocator<N, DimDiff<DimMinimum<R, C>, U1>>,
|
||||
MatrixMN<N, R, C>: serde::Serialize,
|
||||
VectorN<N, DimMinimum<R, C>>: serde::Serialize,
|
||||
VectorN<N, DimDiff<DimMinimum<R, C>, U1>>: serde::Serialize")))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(deserialize = "DimMinimum<R, C>: DimSub<U1>,
|
||||
VectorN<N, DimDiff<DimMinimum<R, C>, U1>>: serde::Serialize"
|
||||
)
|
||||
)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
deserialize = "DimMinimum<R, C>: DimSub<U1>,
|
||||
DefaultAllocator: Allocator<N, R, C> +
|
||||
Allocator<N, DimMinimum<R, C>> +
|
||||
Allocator<N, DimDiff<DimMinimum<R, C>, U1>>,
|
||||
MatrixMN<N, 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)]
|
||||
pub struct Bidiagonal<N: Real, R: DimMin<C>, C: Dim>
|
||||
where
|
||||
|
@ -3,20 +3,32 @@ use serde;
|
||||
|
||||
use alga::general::Real;
|
||||
|
||||
use core::{DefaultAllocator, Matrix, MatrixMN, MatrixN, SquareMatrix};
|
||||
use constraint::{SameNumberOfRows, ShapeConstraint};
|
||||
use storage::{Storage, StorageMut};
|
||||
use allocator::Allocator;
|
||||
use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, SquareMatrix};
|
||||
use constraint::{SameNumberOfRows, ShapeConstraint};
|
||||
use dimension::{Dim, DimSub, Dynamic};
|
||||
use storage::{Storage, StorageMut};
|
||||
|
||||
/// The Cholesky decomposion of a symmetric-definite-positive matrix.
|
||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(serialize = "DefaultAllocator: Allocator<N, D>,
|
||||
MatrixN<N, D>: serde::Serialize")))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(deserialize = "DefaultAllocator: Allocator<N, D>,
|
||||
MatrixN<N, D>: serde::Deserialize<'de>")))]
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
serialize = "DefaultAllocator: Allocator<N, D>,
|
||||
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)]
|
||||
pub struct Cholesky<N: Real, D: Dim>
|
||||
where
|
||||
|
@ -1,9 +1,9 @@
|
||||
use alga::general::Real;
|
||||
|
||||
use core::{DefaultAllocator, SquareMatrix};
|
||||
use core::dimension::DimMin;
|
||||
use core::storage::Storage;
|
||||
use core::allocator::Allocator;
|
||||
use base::allocator::Allocator;
|
||||
use base::dimension::DimMin;
|
||||
use base::storage::Storage;
|
||||
use base::{DefaultAllocator, SquareMatrix};
|
||||
|
||||
use linalg::LU;
|
||||
|
||||
|
@ -1,64 +1,79 @@
|
||||
#[cfg(feature = "serde-serialize")]
|
||||
use serde;
|
||||
|
||||
use std::fmt::Display;
|
||||
use std::cmp;
|
||||
use num_complex::Complex;
|
||||
use alga::general::Real;
|
||||
use num_complex::Complex;
|
||||
use std::cmp;
|
||||
use std::fmt::Display;
|
||||
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 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::RealSchur;
|
||||
use geometry::{Reflection, UnitComplex};
|
||||
|
||||
|
||||
/// Eigendecomposition of a matrix with real eigenvalues.
|
||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(serialize =
|
||||
"DefaultAllocator: Allocator<N, D>,
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
serialize = "DefaultAllocator: Allocator<N, D>,
|
||||
VectorN<N, D>: serde::Serialize,
|
||||
MatrixN<N, D>: serde::Serialize")))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(deserialize =
|
||||
"DefaultAllocator: Allocator<N, D>,
|
||||
MatrixN<N, D>: serde::Serialize"
|
||||
)
|
||||
)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
deserialize = "DefaultAllocator: Allocator<N, D>,
|
||||
VectorN<N, D>: serde::Serialize,
|
||||
MatrixN<N, D>: serde::Deserialize<'de>")))]
|
||||
MatrixN<N, D>: serde::Deserialize<'de>"
|
||||
)
|
||||
)
|
||||
)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct RealEigen<N: Real, D: Dim>
|
||||
where DefaultAllocator: Allocator<N, D, D> +
|
||||
Allocator<N, D> {
|
||||
where
|
||||
DefaultAllocator: Allocator<N, D, D> + Allocator<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>
|
||||
where DefaultAllocator: Allocator<N, D, D> +
|
||||
Allocator<N, D>,
|
||||
where
|
||||
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
|
||||
MatrixN<N, D>: Copy,
|
||||
VectorN<N, D>: Copy { }
|
||||
VectorN<N, D>: Copy,
|
||||
{
|
||||
}
|
||||
|
||||
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.
|
||||
DefaultAllocator: Allocator<N, D, DimDiff<D, U1>> + // For Hessenberg.
|
||||
Allocator<N, DimDiff<D, U1>> + // For Hessenberg.
|
||||
Allocator<N, D, D> +
|
||||
Allocator<N, D>,
|
||||
DefaultAllocator: Allocator<N, D, DimDiff<D, U1>>
|
||||
+ Allocator<N, DimDiff<D, U1>>
|
||||
+ Allocator<N, D, D>
|
||||
+ Allocator<N, D>,
|
||||
// XXX: for debug
|
||||
DefaultAllocator: Allocator<usize, D, D>,
|
||||
MatrixN<N, D>: Display {
|
||||
|
||||
MatrixN<N, D>: Display,
|
||||
{
|
||||
/// Computes the eigendecomposition of a diagonalizable matrix with real eigenvalues.
|
||||
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 (mut eigenvectors, mut eigenvalues) = RealSchur::new(m, 0).unwrap().unpack();
|
||||
@ -99,7 +114,7 @@ impl<N: Real, D: Dim> RealEigen<N, D>
|
||||
|
||||
Some(RealEigen {
|
||||
eigenvectors: eigenvectors,
|
||||
eigenvalues: eigenvalues.diagonal()
|
||||
eigenvalues: eigenvalues.diagonal(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -2,27 +2,39 @@
|
||||
use serde;
|
||||
|
||||
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 storage::{Storage, StorageMut};
|
||||
use allocator::Allocator;
|
||||
use constraint::{SameNumberOfRows, ShapeConstraint};
|
||||
|
||||
use linalg::lu;
|
||||
use linalg::PermutationSequence;
|
||||
|
||||
/// LU decomposition with full row and column pivoting.
|
||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(serialize = "DefaultAllocator: Allocator<N, R, C> +
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
serialize = "DefaultAllocator: Allocator<N, R, C> +
|
||||
Allocator<(usize, usize), DimMinimum<R, C>>,
|
||||
MatrixMN<N, R, C>: serde::Serialize,
|
||||
PermutationSequence<DimMinimum<R, C>>: serde::Serialize")))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(deserialize = "DefaultAllocator: Allocator<N, R, C> +
|
||||
PermutationSequence<DimMinimum<R, C>>: serde::Serialize"
|
||||
)
|
||||
)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
deserialize = "DefaultAllocator: Allocator<N, R, C> +
|
||||
Allocator<(usize, usize), DimMinimum<R, C>>,
|
||||
MatrixMN<N, R, C>: serde::Deserialize<'de>,
|
||||
PermutationSequence<DimMinimum<R, C>>: serde::Deserialize<'de>")))]
|
||||
PermutationSequence<DimMinimum<R, C>>: serde::Deserialize<'de>"
|
||||
)
|
||||
)
|
||||
)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct FullPivLU<N: Real, R: DimMin<C>, C: Dim>
|
||||
where
|
||||
|
@ -3,9 +3,9 @@
|
||||
use alga::general::Real;
|
||||
use num_complex::Complex;
|
||||
|
||||
use core::Vector;
|
||||
use core::storage::Storage;
|
||||
use core::dimension::U2;
|
||||
use base::dimension::U2;
|
||||
use base::storage::Storage;
|
||||
use base::Vector;
|
||||
|
||||
use geometry::UnitComplex;
|
||||
|
||||
|
@ -2,26 +2,38 @@
|
||||
use serde;
|
||||
|
||||
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 storage::Storage;
|
||||
use allocator::Allocator;
|
||||
use constraint::{DimEq, ShapeConstraint};
|
||||
|
||||
use linalg::householder;
|
||||
|
||||
/// Hessenberg decomposition of a general matrix.
|
||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(serialize = "DefaultAllocator: Allocator<N, D, D> +
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
serialize = "DefaultAllocator: Allocator<N, D, D> +
|
||||
Allocator<N, DimDiff<D, U1>>,
|
||||
MatrixN<N, D>: serde::Serialize,
|
||||
VectorN<N, DimDiff<D, U1>>: serde::Serialize")))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(deserialize = "DefaultAllocator: Allocator<N, D, D> +
|
||||
VectorN<N, DimDiff<D, U1>>: serde::Serialize"
|
||||
)
|
||||
)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
deserialize = "DefaultAllocator: Allocator<N, D, D> +
|
||||
Allocator<N, DimDiff<D, U1>>,
|
||||
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)]
|
||||
pub struct Hessenberg<N: Real, D: DimSub<U1>>
|
||||
where
|
||||
|
@ -1,10 +1,10 @@
|
||||
//! Construction of householder elementary reflections.
|
||||
|
||||
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 storage::{Storage, StorageMut};
|
||||
use allocator::Allocator;
|
||||
|
||||
use geometry::Reflection;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
use alga::general::Real;
|
||||
|
||||
use core::{DefaultAllocator, MatrixN, SquareMatrix};
|
||||
use core::dimension::Dim;
|
||||
use core::storage::{Storage, StorageMut};
|
||||
use core::allocator::Allocator;
|
||||
use base::{DefaultAllocator, MatrixN, SquareMatrix};
|
||||
use base::dimension::Dim;
|
||||
use base::storage::{Storage, StorageMut};
|
||||
use base::allocator::Allocator;
|
||||
|
||||
use linalg::lu;
|
||||
|
||||
|
@ -1,28 +1,40 @@
|
||||
#[cfg(feature = "serde-serialize")]
|
||||
use serde;
|
||||
|
||||
use std::mem;
|
||||
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 base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar};
|
||||
use constraint::{SameNumberOfRows, ShapeConstraint};
|
||||
use dimension::{Dim, DimMin, DimMinimum};
|
||||
use std::mem;
|
||||
use storage::{Storage, StorageMut};
|
||||
|
||||
use linalg::PermutationSequence;
|
||||
|
||||
/// LU decomposition with partial (row) pivoting.
|
||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(serialize = "DefaultAllocator: Allocator<N, R, C> +
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
serialize = "DefaultAllocator: Allocator<N, R, C> +
|
||||
Allocator<(usize, usize), DimMinimum<R, C>>,
|
||||
MatrixMN<N, R, C>: serde::Serialize,
|
||||
PermutationSequence<DimMinimum<R, C>>: serde::Serialize")))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(deserialize = "DefaultAllocator: Allocator<N, R, C> +
|
||||
PermutationSequence<DimMinimum<R, C>>: serde::Serialize"
|
||||
)
|
||||
)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
deserialize = "DefaultAllocator: Allocator<N, R, C> +
|
||||
Allocator<(usize, usize), DimMinimum<R, C>>,
|
||||
MatrixMN<N, R, C>: serde::Deserialize<'de>,
|
||||
PermutationSequence<DimMinimum<R, C>>: serde::Deserialize<'de>")))]
|
||||
PermutationSequence<DimMinimum<R, C>>: serde::Deserialize<'de>"
|
||||
)
|
||||
)
|
||||
)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct LU<N: Real, R: DimMin<C>, C: Dim>
|
||||
where
|
||||
|
@ -1,22 +1,34 @@
|
||||
#[cfg(feature = "serde-serialize")]
|
||||
use serde;
|
||||
|
||||
use num::One;
|
||||
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 storage::StorageMut;
|
||||
use allocator::Allocator;
|
||||
|
||||
/// A sequence of row or column permutations.
|
||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(serialize = "DefaultAllocator: Allocator<(usize, usize), D>,
|
||||
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>")))]
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
serialize = "DefaultAllocator: Allocator<(usize, usize), D>,
|
||||
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)]
|
||||
pub struct PermutationSequence<D: Dim>
|
||||
where
|
||||
|
@ -2,7 +2,7 @@
|
||||
use serde;
|
||||
|
||||
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 storage::{Storage, StorageMut};
|
||||
use allocator::{Allocator, Reallocator};
|
||||
|
@ -1,28 +1,40 @@
|
||||
#[cfg(feature = "serde-serialize")]
|
||||
use serde;
|
||||
|
||||
use std::cmp;
|
||||
use num_complex::Complex;
|
||||
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 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::Hessenberg;
|
||||
use geometry::{Reflection, UnitComplex};
|
||||
|
||||
/// Real Schur decomposition of a square matrix.
|
||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(serialize = "DefaultAllocator: Allocator<N, D, D>,
|
||||
MatrixN<N, D>: serde::Serialize")))]
|
||||
#[cfg_attr(feature = "serde-serialize",
|
||||
serde(bound(deserialize = "DefaultAllocator: Allocator<N, D, D>,
|
||||
MatrixN<N, D>: serde::Deserialize<'de>")))]
|
||||
#[cfg_attr(
|
||||
feature = "serde-serialize",
|
||||
serde(
|
||||
bound(
|
||||
serialize = "DefaultAllocator: Allocator<N, D, D>,
|
||||
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)]
|
||||
pub struct RealSchur<N: Real, D: Dim>
|
||||
where
|
||||
|
@ -1,10 +1,10 @@
|
||||
use alga::general::Real;
|
||||
|
||||
use core::{DefaultAllocator, Matrix, MatrixMN, SquareMatrix, Vector};
|
||||
use core::dimension::{Dim, U1};
|
||||
use core::storage::{Storage, StorageMut};
|
||||
use core::allocator::Allocator;
|
||||
use core::constraint::{SameNumberOfRows, ShapeConstraint};
|
||||
use base::allocator::Allocator;
|
||||
use base::constraint::{SameNumberOfRows, ShapeConstraint};
|
||||
use base::dimension::{Dim, U1};
|
||||
use base::storage::{Storage, StorageMut};
|
||||
use base::{DefaultAllocator, Matrix, MatrixMN, SquareMatrix, Vector};
|
||||
|
||||
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
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user