parent
35ae97dc29
commit
20bb99c312
|
@ -108,7 +108,7 @@ impl<N: Clone + Copy> DMat<N> {
|
|||
}
|
||||
|
||||
impl<N> DMat<N> {
|
||||
/// Builds a matrix using an initialization function.
|
||||
/// Builds a matrix filled with the results of a function applied to each of its component coordinates.
|
||||
#[inline(always)]
|
||||
pub fn from_fn<F: FnMut(usize, usize) -> N>(nrows: usize, ncols: usize, mut f: F) -> DMat<N> {
|
||||
DMat {
|
||||
|
|
|
@ -54,7 +54,7 @@ impl<N: Clone> DVec<N> {
|
|||
}
|
||||
|
||||
impl<N> DVec<N> {
|
||||
/// Builds a vector filled with the result of a function.
|
||||
/// Builds a vector filled with the results of a function applied to each of its component coordinates.
|
||||
#[inline(always)]
|
||||
pub fn from_fn<F: FnMut(usize) -> N>(dim: usize, mut f: F) -> DVec<N> {
|
||||
DVec { at: (0..dim).map(|i| f(i)).collect() }
|
||||
|
|
Loading…
Reference in New Issue