Type Definition extendr_api::wrapper::matrix::RMatrix
source · pub type RMatrix<T> = RArray<T, [usize; 2]>;
Implementations§
source§impl<'a, T: ToVectorValue + 'a> RMatrix<T>where
Robj: AsTypedSlice<'a, T>,
impl<'a, T: ToVectorValue + 'a> RMatrix<T>where Robj: AsTypedSlice<'a, T>,
sourcepub fn new_matrix<F: Clone + FnMut(usize, usize) -> T>(
nrows: usize,
ncols: usize,
f: F
) -> Self
pub fn new_matrix<F: Clone + FnMut(usize, usize) -> T>( nrows: usize, ncols: usize, f: F ) -> Self
Create a new matrix wrapper.
Arguments
nrows
- the number of rows the returned matrix will havencols
- the number of columns the returned matrix will havef
- a function that will be called for each entry of the matrix in order to populate it with values. It must return a scalar value that can be converted to an R scalar, such asu32
,f64
, i.e. see ToVectorValue. It accepts two arguments:r
- the current row of the entry we are creatingc
- the current column of the entry we are creating