pub struct FunVec<D, T, F, C = UnboundedCard<D>>{ /* private fields */ }
Expand description
A functional vector of dimension D
and cardinality C
having T
scalar elements.
So much generics, but the important bit is:
- any
FunVec<D, T, F, C>
implementsNVec<D, T>
hence,
- any
FunVec<D1, T, F, C>
implementsV1<T>
, - any
FunVec<D2, T, F, C>
implementsV2<T>
, - and so on.
Examples will hopefully clarify.
§Examples
use orx_v::*;
use std::collections::HashMap;
#[derive(Clone, Copy)]
struct Geocode(i32, i32);
fn compute_using_coordinates<V: V1<Geocode>>(geocodes: V) { /* todo */ }
// we can pass a Vec of coordinates
compute_using_coordinates(&vec![Geocode(0, 0), Geocode(1, 1)]);
// or we can pass a functional vector
let geocodes = V.d1().fun(|[i]| Geocode(i as i32, i as i32));
compute_using_coordinates(geocodes);
// also see sparse (V.d1().sparse(Geocode(0, 0)))
let known_geocodes: HashMap<usize, Geocode> = [(3, Geocode(1, 1)), (7, Geocode(2, 1))].into_iter().collect();
let geocodes = V.d1().fun(|[i]| match known_geocodes.get(&i) {
Some(geo) => *geo,
None => Geocode(0, 0),
});
compute_using_coordinates(geocodes);
// the functional vectors are unbounded on construction
assert!(geocodes.is_unbounded());
assert_eq!(geocodes.card([]), usize::MAX);
The function of the functional geocodes vector can be anything that can compute a geocode based on its index. This is exactly the same in higher dimensional vectors.
If we break down all generic parameters:
D = D1
since it is a 1-dimensional vector,T = Geocode
which is the scalar that the vector returns,F
is any function implementingFn([usize; 1]) -> T
, we can never type its name,C = UnboundedCard<D1>
.
You might guess that, all functional vectors in the above examples are capable of computing
a geocode for any given index. Their domains are unbounded; hence, the generic cardinality
parameter is C = UnboundedCard<D1>
. This makes sense at one hand; however, having a bounded
domain is often more practical on the other hand. We can introduce bounds to the domain of
the functional vector by using:
bounded
if the vector is of dimensionD1
,with_rectangular_bounds
orwith_variable_bounds
otherwise.
Implementations§
Source§impl<T, F> FunVec<D1, T, F, UnboundedCard<D1>>
impl<T, F> FunVec<D1, T, F, UnboundedCard<D1>>
Sourcepub fn bounded(self, num_elements: usize) -> FunVec<D1, T, F, CardD1>
pub fn bounded(self, num_elements: usize) -> FunVec<D1, T, F, CardD1>
Converts an unbounded functional vector into one with a provided bound.
Note that in practice, unbounded cardinality corresponds to a length of usize::MAX.
One needs to be careful in using the all
method which would iterate over the
entire 0..usize::MAX range unless it is stopped on a condition such as in find
method or limited by methods such as take
.
With bounded
method, domain of the vector is defined.
§Examples
use orx_v::*;
// [0, 10, 20, 30]
let v1 = V.d1().fun(|[i]| 10 * i as i32).bounded(4);
assert_eq!(v1.card([]), 4);
assert_eq!(v1.all().collect::<Vec<_>>(), vec![0, 10, 20, 30]);
assert_eq!(v1.equality(&[0, 10, 20, 30]), Equality::Equal);
assert_eq!(v1.all().sum::<i32>(), 60);
assert_eq!(v1.in_bounds([7]), false);
assert_eq!(v1.try_at([7]), None);
assert_eq!(v1.at([7]), 70); // (!) un-compromised performance
(!) un-compromised performance
Main reason to add bounds to a sparse vector is to set its domain.
However, calling at
with an out-of-bounds index can still produce a valid
element in order not to compromise performance.
If we want to check whether or not an index is in bounds or not, we can
use the in_bounds
or card
methods, or use try_at
instead which would
return None
if the index is out of bounds.
Source§impl<T, F> FunVec<D2, T, F, UnboundedCard<D2>>
impl<T, F> FunVec<D2, T, F, UnboundedCard<D2>>
Sourcepub fn with_rectangular_bounds(
self,
dimensions: [usize; 2],
) -> FunVec<D2, T, F, RectangularCardD2>
pub fn with_rectangular_bounds( self, dimensions: [usize; 2], ) -> FunVec<D2, T, F, RectangularCardD2>
Converts an unbounded functional vector into one with rectangular bounds as in matrices:
- the vector has
dimensions[0]
children, and - each children has
dimensions[1]
elements.
Note that in practice, unbounded cardinality corresponds to a length of usize::MAX.
One needs to be careful in using the all
method which would iterate over the
entire 0..usize::MAX range unless it is stopped on a condition such as in find
method or limited by methods such as take
.
With with_rectangular_bounds
or with_variable_bounds
methods, domain of the vector
is defined.
§Examples
use orx_v::*;
// 2x3 => [ [0, 1, 2], [100, 101, 102] ]
let v2 = V.d2().fun(|[i, j]| (100 * i + j) as i64).with_rectangular_bounds([2, 3]);
assert_eq!(v2.card([]), 2);
assert_eq!(v2.card([0]), 3);
assert_eq!(v2.card([1]), 3);
assert_eq!(v2.at([1, 2]), 102);
assert_eq!(v2.all().collect::<Vec<_>>(), vec![0, 1, 2, 100, 101, 102]);
let row1 = v2.child(1);
assert_eq!(row1.card([]), 3);
assert_eq!(row1.at([0]), 100);
assert_eq!(row1.all().collect::<Vec<_>>(), vec![100, 101, 102]);
assert_eq!(v2.in_bounds([100, 72]), false);
assert_eq!(v2.try_at([100, 72]), None);
assert_eq!(v2.at([100, 72]), 100 * 100 + 72); // (!) un-compromised performance
(!) un-compromised performance
Main reason to add bounds to a sparse vector is to set its domain.
However, calling at
with an out-of-bounds index can still produce a valid
element in order not to compromise performance.
If we want to check whether or not an index is in bounds or not, we can
use the in_bounds
or card
methods, or use try_at
instead which would
return None
if the index is out of bounds.
Sourcepub fn with_variable_bounds<C>(
self,
cardinality: C,
) -> FunVec<D2, T, F, VariableCardD2<C>>
pub fn with_variable_bounds<C>( self, cardinality: C, ) -> FunVec<D2, T, F, VariableCardD2<C>>
Converts an unbounded functional vector into one with variable bounds as in jagged arrays:
- the vector has
cardinality.card([])
children, and - i-th child has
cardinality.at([i])
elements.
Note that in practice, unbounded cardinality corresponds to a length of usize::MAX.
One needs to be careful in using the all
method which would iterate over the
entire 0..usize::MAX range unless it is stopped on a condition such as in find
method or limited by methods such as take
.
With with_rectangular_bounds
or with_variable_bounds
methods, domain of the vector
is defined.
§Examples
use orx_v::*;
// jagged => [ [0, 1], [100, 101, 102], [200] ]
let num_cols = vec![2, 3, 1];
let v2 = V.d2().fun(|[i, j]| (100 * i + j) as i64).with_variable_bounds(num_cols);
assert_eq!(v2.card([]), 3);
assert_eq!(v2.card([0]), 2);
assert_eq!(v2.card([1]), 3);
assert_eq!(v2.card([2]), 1);
assert_eq!(v2.at([0, 1]), 1);
assert_eq!(v2.at([1, 2]), 102);
assert_eq!(
v2.equality(&[vec![0, 1], vec![100, 101, 102], vec![200]]),
Equality::Equal,
);
// jagged => [ [0, 1], [100, 101, 102], [200, 201], [300, 301, 302] ]
let num_cols = V.d1().fun(|[i]| match i % 2 == 0 {
true => 2,
false => 3,
}).bounded(4);
let v2 = V.d2().fun(|[i, j]| (100 * i + j) as i64).with_variable_bounds(num_cols);
assert_eq!(v2.card([]), 4);
assert_eq!(v2.card([0]), 2);
assert_eq!(v2.card([1]), 3);
assert_eq!(v2.card([2]), 2);
assert_eq!(v2.card([3]), 3);
assert_eq!(v2.at([0, 1]), 1);
assert_eq!(v2.at([1, 2]), 102);
assert_eq!(
v2.equality(&[vec![0, 1], vec![100, 101, 102], vec![200, 201], vec![300, 301, 302]]),
Equality::Equal,
);
assert_eq!(v2.in_bounds([100, 72]), false);
assert_eq!(v2.try_at([100, 72]), None);
assert_eq!(v2.at([100, 72]), 100 * 100 + 72); // (!) un-compromised performance
(!) un-compromised performance
Main reason to add bounds to a sparse vector is to set its domain.
However, calling at
with an out-of-bounds index can still produce a valid
element in order not to compromise performance.
If we want to check whether or not an index is in bounds or not, we can
use the in_bounds
or card
methods, or use try_at
instead which would
return None
if the index is out of bounds.
Source§impl<T, F> FunVec<D3, T, F, UnboundedCard<D3>>
impl<T, F> FunVec<D3, T, F, UnboundedCard<D3>>
Sourcepub fn with_rectangular_bounds(
self,
dimensions: [usize; 3],
) -> FunVec<D3, T, F, RectangularCardD3>
pub fn with_rectangular_bounds( self, dimensions: [usize; 3], ) -> FunVec<D3, T, F, RectangularCardD3>
Converts an unbounded functional vector into one with rectangular bounds as in
multi-dimensional matrices. The matrix has
dimensions[0]
x dimensions[1]
x dimensions[2]
elements.
Note that in practice, unbounded cardinality corresponds to a length of usize::MAX.
One needs to be careful in using the all
method which would iterate over the
entire 0..usize::MAX range unless it is stopped on a condition such as in find
method or limited by methods such as take
.
With with_rectangular_bounds
or with_variable_bounds
methods, domain of the vector
is defined.
§Examples
use orx_v::*;
// 2x3 => [ [0, 1, 2], [100, 101, 102] ]
let v2 = V.d2().fun(|[i, j]| (100 * i + j) as i64).with_rectangular_bounds([2, 3]);
assert_eq!(v2.card([]), 2);
assert_eq!(v2.card([0]), 3);
assert_eq!(v2.card([1]), 3);
assert_eq!(v2.at([1, 2]), 102);
assert_eq!(v2.all().collect::<Vec<_>>(), vec![0, 1, 2, 100, 101, 102]);
let row1 = v2.child(1);
assert_eq!(row1.card([]), 3);
assert_eq!(row1.at([0]), 100);
assert_eq!(row1.all().collect::<Vec<_>>(), vec![100, 101, 102]);
assert_eq!(v2.in_bounds([100, 72]), false);
assert_eq!(v2.try_at([100, 72]), None);
assert_eq!(v2.at([100, 72]), 100 * 100 + 72); // (!) un-compromised performance
(!) un-compromised performance
Main reason to add bounds to a sparse vector is to set its domain.
However, calling at
with an out-of-bounds index can still produce a valid
element in order not to compromise performance.
If we want to check whether or not an index is in bounds or not, we can
use the in_bounds
or card
methods, or use try_at
instead which would
return None
if the index is out of bounds.
Sourcepub fn with_variable_bounds<C>(
self,
cardinality: C,
) -> FunVec<D3, T, F, VariableCardD3<C>>
pub fn with_variable_bounds<C>( self, cardinality: C, ) -> FunVec<D3, T, F, VariableCardD3<C>>
Converts an unbounded functional vector into one with variable bounds as in jagged arrays:
- the vector has
cardinality.card([])
children, and - i-th child has
cardinality.card([i])
children, and - j-th child of the i-th child has
cardinality.at([i, j])
elements.
Note that in practice, unbounded cardinality corresponds to a length of usize::MAX.
One needs to be careful in using the all
method which would iterate over the
entire 0..usize::MAX range unless it is stopped on a condition such as in find
method or limited by methods such as take
.
With with_rectangular_bounds
or with_variable_bounds
methods, domain of the vector
is defined.
§Examples
use orx_v::*;
// jagged => [ [0, 1], [100, 101, 102], [200] ]
let num_cols = vec![2, 3, 1];
let v2 = V.d2().fun(|[i, j]| (100 * i + j) as i64).with_variable_bounds(num_cols);
assert_eq!(v2.card([]), 3);
assert_eq!(v2.card([0]), 2);
assert_eq!(v2.card([1]), 3);
assert_eq!(v2.card([2]), 1);
assert_eq!(v2.at([0, 1]), 1);
assert_eq!(v2.at([1, 2]), 102);
assert_eq!(
v2.equality(&[vec![0, 1], vec![100, 101, 102], vec![200]]),
Equality::Equal,
);
// jagged => [ [0, 1], [100, 101, 102], [200, 201], [300, 301, 302] ]
let num_cols = V.d1().fun(|[i]| match i % 2 == 0 {
true => 2,
false => 3,
}).bounded(4);
let v2 = V.d2().fun(|[i, j]| (100 * i + j) as i64).with_variable_bounds(num_cols);
assert_eq!(v2.card([]), 4);
assert_eq!(v2.card([0]), 2);
assert_eq!(v2.card([1]), 3);
assert_eq!(v2.card([2]), 2);
assert_eq!(v2.card([3]), 3);
assert_eq!(v2.at([0, 1]), 1);
assert_eq!(v2.at([1, 2]), 102);
assert_eq!(
v2.equality(&[vec![0, 1], vec![100, 101, 102], vec![200, 201], vec![300, 301, 302]]),
Equality::Equal,
);
assert_eq!(v2.in_bounds([100, 72]), false);
assert_eq!(v2.try_at([100, 72]), None);
assert_eq!(v2.at([100, 72]), 100 * 100 + 72); // (!) un-compromised performance
(!) un-compromised performance
Main reason to add bounds to a sparse vector is to set its domain.
However, calling at
with an out-of-bounds index can still produce a valid
element in order not to compromise performance.
If we want to check whether or not an index is in bounds or not, we can
use the in_bounds
or card
methods, or use try_at
instead which would
return None
if the index is out of bounds.
Source§impl<T, F> FunVec<D4, T, F, UnboundedCard<D4>>
impl<T, F> FunVec<D4, T, F, UnboundedCard<D4>>
Sourcepub fn with_rectangular_bounds(
self,
dimensions: [usize; 4],
) -> FunVec<D4, T, F, RectangularCardD4>
pub fn with_rectangular_bounds( self, dimensions: [usize; 4], ) -> FunVec<D4, T, F, RectangularCardD4>
Converts an unbounded functional vector into one with rectangular bounds as in
multi-dimensional matrices. The matrix has
dimensions[0]
x dimensions[1]
x dimensions[2]
x dimensions[3]
elements.
Note that in practice, unbounded cardinality corresponds to a length of usize::MAX.
One needs to be careful in using the all
method which would iterate over the
entire 0..usize::MAX range unless it is stopped on a condition such as in find
method or limited by methods such as take
.
With with_rectangular_bounds
or with_variable_bounds
methods, domain of the vector
is defined.
§Examples
use orx_v::*;
// 2x3 => [ [0, 1, 2], [100, 101, 102] ]
let v2 = V.d2().fun(|[i, j]| (100 * i + j) as i64).with_rectangular_bounds([2, 3]);
assert_eq!(v2.card([]), 2);
assert_eq!(v2.card([0]), 3);
assert_eq!(v2.card([1]), 3);
assert_eq!(v2.at([1, 2]), 102);
assert_eq!(v2.all().collect::<Vec<_>>(), vec![0, 1, 2, 100, 101, 102]);
let row1 = v2.child(1);
assert_eq!(row1.card([]), 3);
assert_eq!(row1.at([0]), 100);
assert_eq!(row1.all().collect::<Vec<_>>(), vec![100, 101, 102]);
assert_eq!(v2.in_bounds([100, 72]), false);
assert_eq!(v2.try_at([100, 72]), None);
assert_eq!(v2.at([100, 72]), 100 * 100 + 72); // (!) un-compromised performance
(!) un-compromised performance
Main reason to add bounds to a sparse vector is to set its domain.
However, calling at
with an out-of-bounds index can still produce a valid
element in order not to compromise performance.
If we want to check whether or not an index is in bounds or not, we can
use the in_bounds
or card
methods, or use try_at
instead which would
return None
if the index is out of bounds.
Sourcepub fn with_variable_bounds<C>(
self,
cardinality: C,
) -> FunVec<D4, T, F, VariableCardD4<C>>
pub fn with_variable_bounds<C>( self, cardinality: C, ) -> FunVec<D4, T, F, VariableCardD4<C>>
Converts an unbounded functional vector into one with variable bounds as in jagged arrays:
- the vector has
cardinality.card([])
children, and - i-th child has
cardinality.card([i])
children, and - j-th child of the
i
-th child hascardinality.card([i, j])
children, and - k-th child of the
[i,j]
-th child hascardinality.at([i, j, k])
elements.
Note that in practice, unbounded cardinality corresponds to a length of usize::MAX.
One needs to be careful in using the all
method which would iterate over the
entire 0..usize::MAX range unless it is stopped on a condition such as in find
method or limited by methods such as take
.
With with_rectangular_bounds
or with_variable_bounds
methods, domain of the vector
is defined.
§Examples
use orx_v::*;
// jagged => [ [0, 1], [100, 101, 102], [200] ]
let num_cols = vec![2, 3, 1];
let v2 = V.d2().fun(|[i, j]| (100 * i + j) as i64).with_variable_bounds(num_cols);
assert_eq!(v2.card([]), 3);
assert_eq!(v2.card([0]), 2);
assert_eq!(v2.card([1]), 3);
assert_eq!(v2.card([2]), 1);
assert_eq!(v2.at([0, 1]), 1);
assert_eq!(v2.at([1, 2]), 102);
assert_eq!(
v2.equality(&[vec![0, 1], vec![100, 101, 102], vec![200]]),
Equality::Equal,
);
// jagged => [ [0, 1], [100, 101, 102], [200, 201], [300, 301, 302] ]
let num_cols = V.d1().fun(|[i]| match i % 2 == 0 {
true => 2,
false => 3,
}).bounded(4);
let v2 = V.d2().fun(|[i, j]| (100 * i + j) as i64).with_variable_bounds(num_cols);
assert_eq!(v2.card([]), 4);
assert_eq!(v2.card([0]), 2);
assert_eq!(v2.card([1]), 3);
assert_eq!(v2.card([2]), 2);
assert_eq!(v2.card([3]), 3);
assert_eq!(v2.at([0, 1]), 1);
assert_eq!(v2.at([1, 2]), 102);
assert_eq!(
v2.equality(&[vec![0, 1], vec![100, 101, 102], vec![200, 201], vec![300, 301, 302]]),
Equality::Equal,
);
assert_eq!(v2.in_bounds([100, 72]), false);
assert_eq!(v2.try_at([100, 72]), None);
assert_eq!(v2.at([100, 72]), 100 * 100 + 72); // (!) un-compromised performance
(!) un-compromised performance
Main reason to add bounds to a sparse vector is to set its domain.
However, calling at
with an out-of-bounds index can still produce a valid
element in order not to compromise performance.
If we want to check whether or not an index is in bounds or not, we can
use the in_bounds
or card
methods, or use try_at
instead which would
return None
if the index is out of bounds.
Trait Implementations§
Source§impl<D, T, F, C> IntoCached<D, T> for FunVec<D, T, F, C>
impl<D, T, F, C> IntoCached<D, T> for FunVec<D, T, F, C>
Source§fn into_cached(self) -> CachedVec<D, T, Self, DefaultCache<D, T>>
fn into_cached(self) -> CachedVec<D, T, Self, DefaultCache<D, T>>
NVec<D, T>
into a cached vector which maintains an internal cache. Read moreSource§impl<D, T, F, C> NVec<D, T> for FunVec<D, T, F, C>
impl<D, T, F, C> NVec<D, T> for FunVec<D, T, F, C>
Source§fn at(&self, idx: impl IntoIdx<D>) -> T
fn at(&self, idx: impl IntoIdx<D>) -> T
idx
-th position of the vector. Read moreSource§fn child(&self, i: <D as Dim>::ChildIdx) -> impl NVec<<D as Dim>::PrevDim, T>
fn child(&self, i: <D as Dim>::ChildIdx) -> impl NVec<<D as Dim>::PrevDim, T>
i
-th child of the vector. Read moreSource§fn all(&self) -> impl Iterator<Item = T>
fn all(&self) -> impl Iterator<Item = T>
Source§fn num_children(&self) -> usize
fn num_children(&self) -> usize
Source§fn card(&self, idx: impl Into<D::CardIdx>) -> usize
fn card(&self, idx: impl Into<D::CardIdx>) -> usize
Source§fn is_bounded(&self) -> bool
fn is_bounded(&self) -> bool
Source§fn is_rectangular(&self) -> bool
fn is_rectangular(&self) -> bool
D
has the same number of children
at a given lower dimension for all indices. Read moreSource§fn is_unbounded(&self) -> bool
fn is_unbounded(&self) -> bool
Source§fn in_bounds(&self, idx: impl Into<D::LeqIdx>) -> bool
fn in_bounds(&self, idx: impl Into<D::LeqIdx>) -> bool
idx
is in bounds. Read moreSource§fn card_equality(&self, other: &impl NVec<D, T>) -> CardEquality<D>
fn card_equality(&self, other: &impl NVec<D, T>) -> CardEquality<D>
other
: Read moreSource§fn try_at(&self, idx: impl IntoIdx<D>) -> Option<T>
fn try_at(&self, idx: impl IntoIdx<D>) -> Option<T>
idx
-th position of the vector if the
index is in_bounds
; returns None otherwise. Read moreSource§fn equality(&self, other: &impl NVec<D, T>) -> Equality<D>where
T: PartialEq,
fn equality(&self, other: &impl NVec<D, T>) -> Equality<D>where
T: PartialEq,
other
: Read moreimpl<D, T: Copy, F, C> Copy for FunVec<D, T, F, C>
Auto Trait Implementations§
impl<D, T, F, C> Freeze for FunVec<D, T, F, C>
impl<D, T, F, C> RefUnwindSafe for FunVec<D, T, F, C>
impl<D, T, F, C> Send for FunVec<D, T, F, C>
impl<D, T, F, C> Sync for FunVec<D, T, F, C>
impl<D, T, F, C> Unpin for FunVec<D, T, F, C>
impl<D, T, F, C> UnwindSafe for FunVec<D, T, F, C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, V> IntoJagged<T> for V
impl<T, V> IntoJagged<T> for V
Source§fn into_jagged<I>(self, row_end_indices: I) -> FlatJagged<Self, I, T>
fn into_jagged<I>(self, row_end_indices: I) -> FlatJagged<Self, I, T>
D1
vector into a jagged D2
vector where each row is
identified by row_end_indices
. Read moreSource§fn as_jagged<I>(&self, row_end_indices: I) -> FlatJagged<&Self, I, T>
fn as_jagged<I>(&self, row_end_indices: I) -> FlatJagged<&Self, I, T>
D1
vector, creates a jagged D2
vector view where each row is
identified by row_end_indices
. Read moreSource§fn as_jagged_mut<I>(
&mut self,
row_end_indices: I,
) -> FlatJagged<&mut Self, I, T>
fn as_jagged_mut<I>( &mut self, row_end_indices: I, ) -> FlatJagged<&mut Self, I, T>
D1
vector, creates a mutable jagged D2
vector view where each row is
identified by row_end_indices
. Read moreSource§fn into_jagged_from_row_lengths<I>(
self,
row_lengths: &I,
) -> FlatJagged<Self, Vec<usize>, T>
fn into_jagged_from_row_lengths<I>( self, row_lengths: &I, ) -> FlatJagged<Self, Vec<usize>, T>
Source§fn as_jagged_from_row_lengths<I>(
&self,
row_lengths: &I,
) -> FlatJagged<&Self, Vec<usize>, T>
fn as_jagged_from_row_lengths<I>( &self, row_lengths: &I, ) -> FlatJagged<&Self, Vec<usize>, T>
D1
vector, creates a jagged D2
vector view where each row is
identified by row_lengths
. Read moreSource§fn as_jagged_mut_from_row_lengths<I>(
&mut self,
row_lengths: &I,
) -> FlatJagged<&mut Self, Vec<usize>, T>
fn as_jagged_mut_from_row_lengths<I>( &mut self, row_lengths: &I, ) -> FlatJagged<&mut Self, Vec<usize>, T>
D1
vector, creates a mutable jagged D2
vector view where each row is
identified by row_lengths
. Read moreSource§fn into_jagged_with_uniform_lengths(
self,
uniform_length: usize,
) -> FlatJagged<Self, UniformEndIndices, T>
fn into_jagged_with_uniform_lengths( self, uniform_length: usize, ) -> FlatJagged<Self, UniformEndIndices, T>
D1
vector into a jagged D2
vector where each row has the given
uniform_length
, except that the last row might have fewer elements if the
cardinality of the D1
vector is not divisible by the uniform length. Read moreSource§fn as_jagged_with_uniform_lengths(
&self,
uniform_length: usize,
) -> FlatJagged<&Self, UniformEndIndices, T>
fn as_jagged_with_uniform_lengths( &self, uniform_length: usize, ) -> FlatJagged<&Self, UniformEndIndices, T>
D1
vector, creates a jagged D2
vector view where each row has
the given uniform_length
, except that the last row might have fewer elements
if the cardinality of the D1
vector is not divisible by the uniform length. Read moreSource§fn as_jagged_mut_with_uniform_lengths(
&mut self,
uniform_length: usize,
) -> FlatJagged<&mut Self, UniformEndIndices, T>
fn as_jagged_mut_with_uniform_lengths( &mut self, uniform_length: usize, ) -> FlatJagged<&mut Self, UniformEndIndices, T>
D1
vector, creates a mutable jagged D2
vector view where each row has
the given uniform_length
, except that the last row might have fewer elements
if the cardinality of the D1
vector is not divisible by the uniform length. Read moreSource§impl<T, V> V1AsMatrix<T> for V
impl<T, V> V1AsMatrix<T> for V
Source§fn v1_into_matrix(
self,
num_rows: usize,
num_cols: usize,
) -> V1Matrix<T, Self, V1LayoutRowMajor>
fn v1_into_matrix( self, num_rows: usize, num_cols: usize, ) -> V1Matrix<T, Self, V1LayoutRowMajor>
D1
vector into a row-major matrix. Read moreSource§fn v1_as_matrix(
&self,
num_rows: usize,
num_cols: usize,
) -> V1Matrix<T, &Self, V1LayoutRowMajor>
fn v1_as_matrix( &self, num_rows: usize, num_cols: usize, ) -> V1Matrix<T, &Self, V1LayoutRowMajor>
D1
vector. Read moreSource§fn v1_as_matrix_mut(
&mut self,
num_rows: usize,
num_cols: usize,
) -> V1Matrix<T, &mut Self, V1LayoutRowMajor>
fn v1_as_matrix_mut( &mut self, num_rows: usize, num_cols: usize, ) -> V1Matrix<T, &mut Self, V1LayoutRowMajor>
D1
vector. Read moreSource§fn v1_into_matrix_col_major(
self,
num_rows: usize,
num_cols: usize,
) -> V1Matrix<T, Self, V1LayoutColMajor>
fn v1_into_matrix_col_major( self, num_rows: usize, num_cols: usize, ) -> V1Matrix<T, Self, V1LayoutColMajor>
D1
vector into a column-major matrix. Read moreSource§fn v1_as_matrix_col_major(
&self,
num_rows: usize,
num_cols: usize,
) -> V1Matrix<T, &Self, V1LayoutColMajor>
fn v1_as_matrix_col_major( &self, num_rows: usize, num_cols: usize, ) -> V1Matrix<T, &Self, V1LayoutColMajor>
D1
vector. Read moreSource§fn v1_as_matrix_col_major_mut(
&mut self,
num_rows: usize,
num_cols: usize,
) -> V1Matrix<T, &mut Self, V1LayoutColMajor>
fn v1_as_matrix_col_major_mut( &mut self, num_rows: usize, num_cols: usize, ) -> V1Matrix<T, &mut Self, V1LayoutColMajor>
D1
vector. Read moreSource§impl<T, V> V2AsMatrix<T> for V
impl<T, V> V2AsMatrix<T> for V
Source§fn into_matrix(self) -> V2MatrixRowMajor<T, Self>
fn into_matrix(self) -> V2MatrixRowMajor<T, Self>
D2
vector into a row-major matrix. Read moreSource§fn as_matrix(&self) -> V2MatrixRowMajor<T, &Self>
fn as_matrix(&self) -> V2MatrixRowMajor<T, &Self>
D2
vector. Read moreSource§fn as_matrix_mut(&mut self) -> V2MatrixRowMajor<T, &mut Self>
fn as_matrix_mut(&mut self) -> V2MatrixRowMajor<T, &mut Self>
D2
vector. Read moreSource§fn into_matrix_col_major(self) -> V2MatrixColMajor<T, Self>
fn into_matrix_col_major(self) -> V2MatrixColMajor<T, Self>
D2
vector into a column-major matrix. Read moreSource§fn as_matrix_col_major(&self) -> V2MatrixColMajor<T, &Self>
fn as_matrix_col_major(&self) -> V2MatrixColMajor<T, &Self>
D2
vector. Read moreSource§fn as_matrix_col_major_mut(&mut self) -> V2MatrixColMajor<T, &mut Self>
fn as_matrix_col_major_mut(&mut self) -> V2MatrixColMajor<T, &mut Self>
D2
vector. Read more