parent
1f2ef4bb44
commit
b83c3b857b
|
@ -34,7 +34,7 @@ use base::Scalar;
|
||||||
*/
|
*/
|
||||||
/// A array-based statically sized matrix data storage.
|
/// A array-based statically sized matrix data storage.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct MatrixArray<N, R, C>
|
pub struct ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
R: DimName,
|
R: DimName,
|
||||||
C: DimName,
|
C: DimName,
|
||||||
|
@ -44,7 +44,11 @@ where
|
||||||
data: GenericArray<N, Prod<R::Value, C::Value>>,
|
data: GenericArray<N, Prod<R::Value, C::Value>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N, R, C> Hash for MatrixArray<N, R, C>
|
#[deprecated(note="renamed to `ArrayStorage`")]
|
||||||
|
/// Renamed to [ArrayStorage].
|
||||||
|
pub type MatrixArray<N, R, C> = ArrayStorage<N, R, C>;
|
||||||
|
|
||||||
|
impl<N, R, C> Hash for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: Hash,
|
N: Hash,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -57,7 +61,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N, R, C> Deref for MatrixArray<N, R, C>
|
impl<N, R, C> Deref for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
R: DimName,
|
R: DimName,
|
||||||
C: DimName,
|
C: DimName,
|
||||||
|
@ -72,7 +76,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N, R, C> DerefMut for MatrixArray<N, R, C>
|
impl<N, R, C> DerefMut for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
R: DimName,
|
R: DimName,
|
||||||
C: DimName,
|
C: DimName,
|
||||||
|
@ -85,7 +89,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N, R, C> Debug for MatrixArray<N, R, C>
|
impl<N, R, C> Debug for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: Debug,
|
N: Debug,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -99,7 +103,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N, R, C> Copy for MatrixArray<N, R, C>
|
impl<N, R, C> Copy for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: Copy,
|
N: Copy,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -109,7 +113,7 @@ where
|
||||||
GenericArray<N, Prod<R::Value, C::Value>>: Copy,
|
GenericArray<N, Prod<R::Value, C::Value>>: Copy,
|
||||||
{}
|
{}
|
||||||
|
|
||||||
impl<N, R, C> Clone for MatrixArray<N, R, C>
|
impl<N, R, C> Clone for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: Clone,
|
N: Clone,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -119,13 +123,13 @@ where
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
MatrixArray {
|
ArrayStorage {
|
||||||
data: self.data.clone(),
|
data: self.data.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N, R, C> Eq for MatrixArray<N, R, C>
|
impl<N, R, C> Eq for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: Eq,
|
N: Eq,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -134,7 +138,7 @@ where
|
||||||
Prod<R::Value, C::Value>: ArrayLength<N>,
|
Prod<R::Value, C::Value>: ArrayLength<N>,
|
||||||
{}
|
{}
|
||||||
|
|
||||||
impl<N, R, C> PartialEq for MatrixArray<N, R, C>
|
impl<N, R, C> PartialEq for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: PartialEq,
|
N: PartialEq,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -148,7 +152,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<N, R, C> Storage<N, R, C> for MatrixArray<N, R, C>
|
unsafe impl<N, R, C> Storage<N, R, C> for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: Scalar,
|
N: Scalar,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -200,7 +204,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<N, R, C> StorageMut<N, R, C> for MatrixArray<N, R, C>
|
unsafe impl<N, R, C> StorageMut<N, R, C> for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: Scalar,
|
N: Scalar,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -220,7 +224,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<N, R, C> ContiguousStorage<N, R, C> for MatrixArray<N, R, C>
|
unsafe impl<N, R, C> ContiguousStorage<N, R, C> for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: Scalar,
|
N: Scalar,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -230,7 +234,7 @@ where
|
||||||
DefaultAllocator: Allocator<N, R, C, Buffer = Self>,
|
DefaultAllocator: Allocator<N, R, C, Buffer = Self>,
|
||||||
{}
|
{}
|
||||||
|
|
||||||
unsafe impl<N, R, C> ContiguousStorageMut<N, R, C> for MatrixArray<N, R, C>
|
unsafe impl<N, R, C> ContiguousStorageMut<N, R, C> for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: Scalar,
|
N: Scalar,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -247,7 +251,7 @@ where
|
||||||
*/
|
*/
|
||||||
// XXX: open an issue for GenericArray so that it implements serde traits?
|
// XXX: open an issue for GenericArray so that it implements serde traits?
|
||||||
#[cfg(feature = "serde-serialize")]
|
#[cfg(feature = "serde-serialize")]
|
||||||
impl<N, R, C> Serialize for MatrixArray<N, R, C>
|
impl<N, R, C> Serialize for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: Scalar + Serialize,
|
N: Scalar + Serialize,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -268,7 +272,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde-serialize")]
|
#[cfg(feature = "serde-serialize")]
|
||||||
impl<'a, N, R, C> Deserialize<'a> for MatrixArray<N, R, C>
|
impl<'a, N, R, C> Deserialize<'a> for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: Scalar + Deserialize<'a>,
|
N: Scalar + Deserialize<'a>,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -278,18 +282,18 @@ where
|
||||||
{
|
{
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where D: Deserializer<'a> {
|
where D: Deserializer<'a> {
|
||||||
deserializer.deserialize_seq(MatrixArrayVisitor::new())
|
deserializer.deserialize_seq(ArrayStorageVisitor::new())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde-serialize")]
|
#[cfg(feature = "serde-serialize")]
|
||||||
/// A visitor that produces a matrix array.
|
/// A visitor that produces a matrix array.
|
||||||
struct MatrixArrayVisitor<N, R, C> {
|
struct ArrayStorageVisitor<N, R, C> {
|
||||||
marker: PhantomData<(N, R, C)>,
|
marker: PhantomData<(N, R, C)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde-serialize")]
|
#[cfg(feature = "serde-serialize")]
|
||||||
impl<N, R, C> MatrixArrayVisitor<N, R, C>
|
impl<N, R, C> ArrayStorageVisitor<N, R, C>
|
||||||
where
|
where
|
||||||
N: Scalar,
|
N: Scalar,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -299,14 +303,14 @@ where
|
||||||
{
|
{
|
||||||
/// Construct a new sequence visitor.
|
/// Construct a new sequence visitor.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
MatrixArrayVisitor {
|
ArrayStorageVisitor {
|
||||||
marker: PhantomData,
|
marker: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde-serialize")]
|
#[cfg(feature = "serde-serialize")]
|
||||||
impl<'a, N, R, C> Visitor<'a> for MatrixArrayVisitor<N, R, C>
|
impl<'a, N, R, C> Visitor<'a> for ArrayStorageVisitor<N, R, C>
|
||||||
where
|
where
|
||||||
N: Scalar + Deserialize<'a>,
|
N: Scalar + Deserialize<'a>,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -314,14 +318,14 @@ where
|
||||||
R::Value: Mul<C::Value>,
|
R::Value: Mul<C::Value>,
|
||||||
Prod<R::Value, C::Value>: ArrayLength<N>,
|
Prod<R::Value, C::Value>: ArrayLength<N>,
|
||||||
{
|
{
|
||||||
type Value = MatrixArray<N, R, C>;
|
type Value = ArrayStorage<N, R, C>;
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
|
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
|
||||||
formatter.write_str("a matrix array")
|
formatter.write_str("a matrix array")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn visit_seq<V>(self, mut visitor: V) -> Result<MatrixArray<N, R, C>, V::Error>
|
fn visit_seq<V>(self, mut visitor: V) -> Result<ArrayStorage<N, R, C>, V::Error>
|
||||||
where V: SeqAccess<'a> {
|
where V: SeqAccess<'a> {
|
||||||
let mut out: Self::Value = unsafe { mem::uninitialized() };
|
let mut out: Self::Value = unsafe { mem::uninitialized() };
|
||||||
let mut curr = 0;
|
let mut curr = 0;
|
||||||
|
@ -340,7 +344,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "abomonation-serialize")]
|
#[cfg(feature = "abomonation-serialize")]
|
||||||
impl<N, R, C> Abomonation for MatrixArray<N, R, C>
|
impl<N, R, C> Abomonation for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
R: DimName,
|
R: DimName,
|
||||||
C: DimName,
|
C: DimName,
|
|
@ -18,7 +18,7 @@ use base::iter::{MatrixIter, MatrixIterMut};
|
||||||
use base::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut};
|
use base::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut};
|
||||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||||
use base::MatrixVec;
|
use base::MatrixVec;
|
||||||
use base::{DefaultAllocator, Matrix, MatrixArray, MatrixMN, MatrixSlice, MatrixSliceMut, Scalar};
|
use base::{DefaultAllocator, Matrix, ArrayStorage, MatrixMN, MatrixSlice, MatrixSliceMut, 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>
|
||||||
|
@ -336,7 +336,7 @@ impl_from_into_mint_2D!(
|
||||||
);
|
);
|
||||||
|
|
||||||
impl<'a, N, R, C, RStride, CStride> From<MatrixSlice<'a, N, R, C, RStride, CStride>>
|
impl<'a, N, R, C, RStride, CStride> From<MatrixSlice<'a, N, R, C, RStride, CStride>>
|
||||||
for Matrix<N, R, C, MatrixArray<N, R, C>>
|
for Matrix<N, R, C, ArrayStorage<N, R, C>>
|
||||||
where
|
where
|
||||||
N: Scalar,
|
N: Scalar,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
@ -380,7 +380,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, N, R, C, RStride, CStride> From<MatrixSliceMut<'a, N, R, C, RStride, CStride>>
|
impl<'a, N, R, C, RStride, CStride> From<MatrixSliceMut<'a, N, R, C, RStride, CStride>>
|
||||||
for Matrix<N, R, C, MatrixArray<N, R, C>>
|
for Matrix<N, R, C, ArrayStorage<N, R, C>>
|
||||||
where
|
where
|
||||||
N: Scalar,
|
N: Scalar,
|
||||||
R: DimName,
|
R: DimName,
|
||||||
|
|
|
@ -18,7 +18,7 @@ use base::allocator::{Allocator, Reallocator};
|
||||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||||
use base::dimension::Dynamic;
|
use base::dimension::Dynamic;
|
||||||
use base::dimension::{Dim, DimName};
|
use base::dimension::{Dim, DimName};
|
||||||
use base::matrix_array::MatrixArray;
|
use base::array_storage::ArrayStorage;
|
||||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||||
use base::matrix_vec::MatrixVec;
|
use base::matrix_vec::MatrixVec;
|
||||||
use base::storage::{Storage, StorageMut};
|
use base::storage::{Storage, StorageMut};
|
||||||
|
@ -42,7 +42,7 @@ where
|
||||||
R::Value: Mul<C::Value>,
|
R::Value: Mul<C::Value>,
|
||||||
Prod<R::Value, C::Value>: ArrayLength<N>,
|
Prod<R::Value, C::Value>: ArrayLength<N>,
|
||||||
{
|
{
|
||||||
type Buffer = MatrixArray<N, R, C>;
|
type Buffer = ArrayStorage<N, R, C>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn allocate_uninitialized(_: R, _: C) -> Self::Buffer {
|
unsafe fn allocate_uninitialized(_: R, _: C) -> Self::Buffer {
|
||||||
|
@ -157,7 +157,7 @@ where
|
||||||
rto: RTo,
|
rto: RTo,
|
||||||
cto: CTo,
|
cto: CTo,
|
||||||
buf: <Self as Allocator<N, RFrom, CFrom>>::Buffer,
|
buf: <Self as Allocator<N, RFrom, CFrom>>::Buffer,
|
||||||
) -> MatrixArray<N, RTo, CTo>
|
) -> ArrayStorage<N, RTo, CTo>
|
||||||
{
|
{
|
||||||
let mut res = <Self as Allocator<N, RTo, CTo>>::allocate_uninitialized(rto, cto);
|
let mut res = <Self as Allocator<N, RTo, CTo>>::allocate_uninitialized(rto, cto);
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ where
|
||||||
unsafe fn reallocate_copy(
|
unsafe fn reallocate_copy(
|
||||||
rto: Dynamic,
|
rto: Dynamic,
|
||||||
cto: CTo,
|
cto: CTo,
|
||||||
buf: MatrixArray<N, RFrom, CFrom>,
|
buf: ArrayStorage<N, RFrom, CFrom>,
|
||||||
) -> MatrixVec<N, Dynamic, CTo>
|
) -> MatrixVec<N, Dynamic, CTo>
|
||||||
{
|
{
|
||||||
let mut res = <Self as Allocator<N, Dynamic, CTo>>::allocate_uninitialized(rto, cto);
|
let mut res = <Self as Allocator<N, Dynamic, CTo>>::allocate_uninitialized(rto, cto);
|
||||||
|
@ -214,7 +214,7 @@ where
|
||||||
unsafe fn reallocate_copy(
|
unsafe fn reallocate_copy(
|
||||||
rto: RTo,
|
rto: RTo,
|
||||||
cto: Dynamic,
|
cto: Dynamic,
|
||||||
buf: MatrixArray<N, RFrom, CFrom>,
|
buf: ArrayStorage<N, RFrom, CFrom>,
|
||||||
) -> MatrixVec<N, RTo, Dynamic>
|
) -> MatrixVec<N, RTo, Dynamic>
|
||||||
{
|
{
|
||||||
let mut res = <Self as Allocator<N, RTo, Dynamic>>::allocate_uninitialized(rto, cto);
|
let mut res = <Self as Allocator<N, RTo, Dynamic>>::allocate_uninitialized(rto, cto);
|
||||||
|
|
|
@ -20,7 +20,7 @@ mod conversion;
|
||||||
mod edition;
|
mod edition;
|
||||||
mod matrix;
|
mod matrix;
|
||||||
mod matrix_alga;
|
mod matrix_alga;
|
||||||
mod matrix_array;
|
mod array_storage;
|
||||||
mod matrix_slice;
|
mod matrix_slice;
|
||||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||||
mod matrix_vec;
|
mod matrix_vec;
|
||||||
|
@ -41,7 +41,7 @@ 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_array::*;
|
pub use self::array_storage::*;
|
||||||
pub use self::matrix_slice::*;
|
pub use self::matrix_slice::*;
|
||||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||||
pub use self::matrix_vec::*;
|
pub use self::matrix_vec::*;
|
||||||
|
|
Loading…
Reference in New Issue