Skip to main content

BlockData

Struct BlockData 

Source
pub struct BlockData { /* private fields */ }

Implementations§

Source§

impl BlockData

Source

pub fn new(rows: usize, cols: usize, data: &[f64]) -> Self

Source

pub fn from_data(data: DMatrix<f64>, dtype: BlockDataType) -> Self

Source

pub fn from_element(nrows: usize, ncols: usize, scalar: f64) -> Self

Source

pub fn from_scalar(scalar: f64) -> Self

Source

pub fn from_row_slice(nrows: usize, ncols: usize, data: &[f64]) -> Self

Source

pub fn from_bytes(byte_data: &[u8]) -> Self

Source

pub fn scalar_sizeof(scalar: f64, block: &BlockData) -> Self

Source

pub fn from_vector(data: &[f64]) -> Self

Source

pub fn from_matrix(matrix_slice: &[&[f64]]) -> Self

Source

pub fn zeros_sizeof(block: &BlockData) -> Self

Source

pub fn ones_sizeof(block: &BlockData) -> Self

Source

pub fn scalar_from_bool(value: bool) -> Self

Source

pub fn fix_non_finite(&mut self)

Source

pub fn slice(&mut self, r0: usize, c0: usize, rows: usize, cols: usize) -> Self

Source

pub fn as_col_slice(&self) -> &[f64]

Source

pub fn set(&mut self, index: usize, value: f64)

Source

pub fn at(&self, index: usize) -> f64

Source

pub fn ref_at(&self, index: usize) -> &f64

Source

pub fn ref_at_mut(&mut self, index: usize) -> &mut f64

Source

pub fn at_rc(&self, r: usize, c: usize) -> f64

Source

pub fn get_type(&self) -> BlockDataType

Source

pub fn set_type(&mut self, new_type: BlockDataType)

Source

pub fn scalar(&self) -> f64

Source

pub fn get_data(&self) -> &DMatrix<f64>

Source

pub fn set_data(&mut self, data: DMatrix<f64>)

Source

pub fn maybe_reset(&mut self, reset_signal: &BlockData)

Source

pub fn compare(&self, other: &BlockData) -> BlockTypeRelationship

Source

pub fn vector(&self) -> DMatrix<f64>

Source

pub fn boolean(&self) -> Self

Source

pub fn norm(&self) -> f64

Source

pub fn vector_magnitude(&self) -> Self

Source

pub fn vector_magnitude_rows(&self) -> Self

Source

pub fn any(&self) -> bool

Source

pub fn all(&self) -> bool

Source

pub fn set_scalar(&mut self, new_scalar_value: f64)

Source

pub fn set_bytes(&mut self, byte_data: &[u8])

Source

pub fn set_scalar_bool(&mut self, value: bool)

Source

pub fn nrows(&self) -> usize

Source

pub fn ncols(&self) -> usize

Source

pub fn size(&self) -> (usize, usize)

Source

pub fn n_elements(&self) -> usize

Source

pub fn same_size(&self, other: &BlockData) -> bool

Source

pub fn inner_dims_same(&self, other: &BlockData) -> bool

Source

pub fn component_mul(&self, other: &BlockData) -> Self

Source

pub fn component_set(&mut self, condition: &BlockData, assign: &BlockData)

Source

pub fn component_or(first: &BlockData, other: &BlockData) -> Self

Source

pub fn component_and(first: &BlockData, other: &BlockData) -> Self

Source

pub fn component_bitand(&self, rhs: &BlockData) -> Self

Source

pub fn component_bitor(&self, rhs: &BlockData) -> Self

Source

pub fn component_bitxor(&self, rhs: &BlockData) -> Self

Source

pub fn component_lshift(&self, bits: i32) -> Self

Source

pub fn component_rshift(&self, bits: i32) -> Self

Source

pub fn component_bitnot(&self) -> Self

Source

pub fn component_eq(first: &BlockData, other: &BlockData) -> Self

Source

pub fn component_neq(first: &BlockData, other: &BlockData) -> Self

Source

pub fn component_gt(first: &BlockData, other: &BlockData) -> Self

Source

pub fn component_gte(first: &BlockData, other: &BlockData) -> Self

Source

pub fn component_lt(first: &BlockData, other: &BlockData) -> Self

Source

pub fn component_lte(first: &BlockData, other: &BlockData) -> Self

Source

pub fn powf(&self, coefficient: &BlockData) -> Self

Source

pub fn sign(&self) -> Self

Source

pub fn abs(&self) -> Self

Source

pub fn transpose(&self) -> Self

Source

pub fn determinant(&self) -> Self

Source

pub fn cross(&self, other: &BlockData) -> Self

Source

pub fn dot(&self, other: &BlockData) -> Self

Source

pub fn inverse(&self) -> Option<Self>

Source

pub fn pseudo_inverse(&self, epsilon: f64) -> Option<Self>

Source

pub fn to_bytes(&self) -> Vec<u8>

Source

pub fn to_raw_bytes(&self) -> Vec<u8>

Returns a Vector of bytes representing the raw data

Source

pub fn to_json(&self) -> Value

Returns the serde:json::Value equivalent of this data

Source

pub fn stringify(&self) -> String

Returns the data represented as a valid JSON string

Source

pub fn raw_string(&self) -> String

Return the raw data represented as a string

This will attempt to convert internal vector data to utf-8. This behaves the same as stringify for all data types other than byte arrays, which will attempt to convert to a string.

Source

pub fn iter(&self) -> MatrixIter<'_, f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>

Source

pub fn map<F: FnMut(f64) -> f64>(&self, f: F) -> Self

Source

pub fn sum(&self) -> f64

Source

pub fn mean(&self) -> f64

Source

pub fn max(&self) -> f64

Source

pub fn min(&self) -> f64

Source

pub fn argmax(&self) -> f64

Source

pub fn argmin(&self) -> f64

Source

pub fn sorted(&self, ascending: bool) -> Self

Source

pub fn median(&self) -> f64

Source

pub fn sup(&self, other: &BlockData) -> Self

Source

pub fn inf(&self, other: &BlockData) -> Self

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn or(&self, other: &BlockData) -> Self

Source

pub fn and(&self, other: &BlockData) -> Self

Source

pub fn eq(&self, other: &BlockData) -> Self

Source

pub fn neq(&self, other: &BlockData) -> Self

Source

pub fn gt(&self, other: &BlockData) -> Self

Source

pub fn gte(&self, other: &BlockData) -> Self

Source

pub fn lt(&self, other: &BlockData) -> Self

Source

pub fn lte(&self, other: &BlockData) -> Self

Source

pub fn logical_not(&self) -> Self

Source

pub fn ltz(&self) -> Self

Source

pub fn ltez(&self) -> Self

Source

pub fn gtz(&self) -> Self

Source

pub fn gtez(&self) -> Self

Source

pub fn eqz(&self) -> Self

Trait Implementations§

Source§

impl AbsDiffEq for BlockData

Source§

type Epsilon = f64

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more
Source§

fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Source§

fn abs_diff_ne(&self, other: &Self, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
Source§

impl Add<&BlockData> for BlockData

Source§

type Output = BlockData

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &BlockData) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for &BlockData

Source§

type Output = BlockData

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &BlockData) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign<&BlockData> for BlockData

Source§

fn add_assign(&mut self, rhs: &BlockData)

Performs the += operation. Read more
Source§

impl BitAnd for &BlockData

Source§

type Output = BlockData

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &BlockData) -> Self::Output

Performs the & operation. Read more
Source§

impl BitAnd for BlockData

Source§

type Output = BlockData

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: BlockData) -> Self::Output

Performs the & operation. Read more
Source§

impl BitOr for &BlockData

Source§

type Output = BlockData

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &BlockData) -> Self::Output

Performs the | operation. Read more
Source§

impl BitOr for BlockData

Source§

type Output = BlockData

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: BlockData) -> Self::Output

Performs the | operation. Read more
Source§

impl BitXor for &BlockData

Source§

type Output = BlockData

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &BlockData) -> Self::Output

Performs the ^ operation. Read more
Source§

impl BitXor for BlockData

Source§

type Output = BlockData

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: BlockData) -> Self::Output

Performs the ^ operation. Read more
Source§

impl BlockDataRead for &BlockData

Source§

fn get_scalar(&self) -> f64

Retrieve a scalar value
Source§

fn get_matrix(&self) -> (usize, usize, &[f64])

Retrieve a matrix value as a tuple of (nrows, ncols, &f64) Data is output in column-major order For example, the matrix: | 1.0 2.0 | | 3.0 4.0 | Read more
Source§

impl BlockDataRead for BlockData

Source§

fn get_scalar(&self) -> f64

Retrieve a scalar value
Source§

fn get_matrix(&self) -> (usize, usize, &[f64])

Retrieve a matrix value as a tuple of (nrows, ncols, &f64) Data is output in column-major order For example, the matrix: | 1.0 2.0 | | 3.0 4.0 | Read more
Source§

impl BlockDataWrite for &mut BlockData

Source§

fn set_scalar_value(&mut self, scalar: f64)

Set a scalar value
Source§

fn set_matrix_value(&mut self, nrows: usize, ncols: usize, data: &[f64])

Set a matrix value Data is input in column-major order For example, set_matrix_value(2, 2, &[1.0, 3.0, 2.0, 4.0]) would set the matrixdata to: | 1.0 2.0 | | 3.0 4.0 |
Source§

impl Clone for BlockData

Source§

fn clone(&self) -> BlockData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BlockData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div<f64> for &BlockData

Source§

type Output = BlockData

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<f64> for BlockData

Source§

type Output = BlockData

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for &BlockData

Source§

type Output = BlockData

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &BlockData) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for BlockData

Source§

type Output = BlockData

The resulting type after applying the / operator.
Source§

fn div(self, rhs: BlockData) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign<&BlockData> for BlockData

Source§

fn div_assign(&mut self, rhs: &BlockData)

Performs the /= operation. Read more
Source§

impl DivAssign<f64> for BlockData

Source§

fn div_assign(&mut self, rhs: f64)

Performs the /= operation. Read more
Source§

impl FromPass<ByteSliceSignal> for BlockData

Source§

impl<const NROWS: usize, const NCOLS: usize, T: Scalar> FromPass<Matrix<NROWS, NCOLS, T>> for BlockData

Source§

fn from_pass(pass: PassBy<'_, Matrix<NROWS, NCOLS, T>>) -> Self

Source§

impl FromPass<bool> for BlockData

Source§

fn from_pass(pass: PassBy<'_, bool>) -> Self

Source§

impl FromPass<f32> for BlockData

Source§

fn from_pass(pass: f32) -> Self

Source§

impl FromPass<f64> for BlockData

Source§

fn from_pass(pass: f64) -> Self

Source§

impl FromPass<i16> for BlockData

Source§

fn from_pass(pass: i16) -> Self

Source§

impl FromPass<i32> for BlockData

Source§

fn from_pass(pass: i32) -> Self

Source§

impl FromPass<i8> for BlockData

Source§

fn from_pass(pass: i8) -> Self

Source§

impl FromPass<u16> for BlockData

Source§

fn from_pass(pass: u16) -> Self

Source§

impl FromPass<u32> for BlockData

Source§

fn from_pass(pass: u32) -> Self

Source§

impl FromPass<u8> for BlockData

Source§

fn from_pass(pass: u8) -> Self

Source§

impl Index<usize> for BlockData

Source§

type Output = f64

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<usize> for BlockData

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl Mul<&BlockData> for f64

Source§

type Output = BlockData

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &BlockData) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<BlockData> for f64

Source§

type Output = BlockData

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: BlockData) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<f64> for &BlockData

Source§

type Output = BlockData

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<f64> for BlockData

Source§

type Output = BlockData

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for &BlockData

Source§

type Output = BlockData

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &BlockData) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<&BlockData> for BlockData

Source§

fn mul_assign(&mut self, rhs: &BlockData)

Performs the *= operation. Read more
Source§

impl PartialEq for BlockData

Source§

fn eq(&self, other: &BlockData) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RelativeEq for BlockData

Source§

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
Source§

fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
Source§

fn relative_ne( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of RelativeEq::relative_eq.
Source§

impl Shl<i32> for &BlockData

Source§

type Output = BlockData

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: i32) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<i32> for BlockData

Source§

type Output = BlockData

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: i32) -> Self::Output

Performs the << operation. Read more
Source§

impl Shr<i32> for &BlockData

Source§

type Output = BlockData

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: i32) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<i32> for BlockData

Source§

type Output = BlockData

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: i32) -> Self::Output

Performs the >> operation. Read more
Source§

impl Sub<&BlockData> for BlockData

Source§

type Output = BlockData

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &BlockData) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<BlockData> for &BlockData

Source§

type Output = BlockData

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: BlockData) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for &BlockData

Source§

type Output = BlockData

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign<&BlockData> for BlockData

Source§

fn sub_assign(&mut self, rhs: &BlockData)

Performs the -= operation. Read more
Source§

impl<const N: usize> ToPass<[f64; N]> for BlockData

Source§

fn to_pass(&self) -> [f64; N]

Source§

impl<const N: usize> ToPass<[u8; N]> for BlockData

Source§

fn to_pass(&self) -> [u8; N]

Source§

impl<const NROWS: usize, const NCOLS: usize> ToPass<Matrix<NROWS, NCOLS, bool>> for BlockData

Source§

fn to_pass(&self) -> Matrix<NROWS, NCOLS, bool>

Source§

impl<const NROWS: usize, const NCOLS: usize> ToPass<Matrix<NROWS, NCOLS, f64>> for BlockData

Source§

fn to_pass(&self) -> Matrix<NROWS, NCOLS, f64>

Source§

impl ToPass<bool> for BlockData

Source§

fn to_pass(&self) -> bool

Source§

impl ToPass<f64> for BlockData

Source§

fn to_pass(&self) -> f64

Source§

impl StructuralPartialEq for BlockData

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

Source§

impl<T, Right> ClosedAddAssign<Right> for T
where T: ClosedAdd<Right> + AddAssign<Right>,

Source§

impl<T, Right> ClosedDiv<Right> for T
where T: Div<Right, Output = T> + DivAssign<Right>,

Source§

impl<T, Right> ClosedDivAssign<Right> for T
where T: ClosedDiv<Right> + DivAssign<Right>,

Source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

Source§

impl<T, Right> ClosedSubAssign<Right> for T
where T: ClosedSub<Right> + SubAssign<Right>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,