Add DVector::from(Vec).
This commit is contained in:
parent
27f788fbd8
commit
857ce13b63
|
@ -1,3 +1,6 @@
|
|||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||
use alloc::vec::Vec;
|
||||
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use crate::base::storage::Owned;
|
||||
#[cfg(feature = "arbitrary")]
|
||||
|
@ -297,7 +300,7 @@ where
|
|||
/// assert_eq!(matrix_storage_ptr, vec_ptr);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
pub fn from_vec_generic(nrows: R, ncols: C, data: Vec<N>) -> Self {
|
||||
Self::from_iterator_generic(nrows, ncols, data)
|
||||
}
|
||||
|
@ -719,7 +722,7 @@ macro_rules! impl_constructors_from_data(
|
|||
/// dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
pub fn from_vec($($args: usize,)* $data: Vec<N>) -> Self {
|
||||
Self::from_vec_generic($($gargs, )* $data)
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||
use alloc::vec::Vec;
|
||||
#[cfg(feature = "mint")]
|
||||
use mint;
|
||||
use simba::scalar::{SubsetOf, SupersetOf};
|
||||
|
@ -20,12 +22,12 @@ use crate::base::dimension::{
|
|||
};
|
||||
use crate::base::iter::{MatrixIter, MatrixIterMut};
|
||||
use crate::base::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut};
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
use crate::base::VecStorage;
|
||||
use crate::base::{
|
||||
ArrayStorage, DVectorSlice, DVectorSliceMut, DefaultAllocator, Matrix, MatrixMN, MatrixSlice,
|
||||
MatrixSliceMut, Scalar,
|
||||
};
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
use crate::base::{DVector, VecStorage};
|
||||
use crate::base::{SliceStorage, SliceStorageMut};
|
||||
use crate::constraint::DimEq;
|
||||
|
||||
|
@ -545,6 +547,14 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
impl<'a, N: Scalar> From<Vec<N>> for DVector<N> {
|
||||
#[inline]
|
||||
fn from(vec: Vec<N>) -> Self {
|
||||
Self::from_vec(vec)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, N: Scalar + Copy, R: Dim, C: Dim, S: ContiguousStorage<N, R, C>> Into<&'a [N]>
|
||||
for &'a Matrix<N, R, C, S>
|
||||
{
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use simba::simd::SimdValue;
|
||||
|
||||
use crate::base::allocator::Allocator;
|
||||
|
|
Loading…
Reference in New Issue