Type Alias extendr_api::wrapper::matrix::RMatrix

source ·
pub type RMatrix<T> = RArray<T, [usize; 2]>;

Aliased Type§

struct RMatrix<T> { /* private fields */ }

Implementations§

source§

impl<'a, T: ToVectorValue + 'a> RMatrix<T>where Robj: AsTypedSlice<'a, T>,

source

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 have
  • ncols - the number of columns the returned matrix will have
  • f - 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 as u32, f64, i.e. see ToVectorValue. It accepts two arguments:
    • r - the current row of the entry we are creating
    • c - the current column of the entry we are creating
source

pub fn nrows(&self) -> usize

Get the number of rows.

source

pub fn ncols(&self) -> usize

Get the number of columns.

Trait Implementations§

source§

impl<'a, T: 'a> TryFrom<Robj> for RMatrix<T>where Robj: AsTypedSlice<'a, T>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.