pub struct Matrix<const R: usize, const C: usize> {
    pub rows: [[f64; C]; R],
}
Expand description

A mathematical matrix structure

Fields

rows: [[f64; C]; R]

Implementations

Adds the arguments and return the sum as a new Matrix

Adds the arguments and then returns the sum as a new Matrix

Divides corresponding entries and returns the quotient as a new Matrix

Divides each entry by the scalar and then returns a new Matrix

Multiplies the arguments and then returns the product as a new Matrix

Multiplies entries and returns the Hadamard product as a new Matrix

https://en.wikipedia.org/wiki/Hadamard_product_(matrices)

Multiplies all entries by -1.0 and then returns the new negated Matrix

Makes a new Matrix with all entries set to the argument

Subtracts the 2nd from the 1st and returns the difference as a new Matrix

Subtracts the 2nd from the 1st and returns the difference as a new Matrix

Subtracts the 2nd from the 1st and returns the difference as a new Matrix

Makes a square matrix with the diagonal values set to 1.0 and all others 0

Adds the argument entries to all corresponding entries and returns self

Adds the scalar to all entries and then returns a reference to self

Divides corresponding entries and then returns a reference to self

Divides each entry by the argument and then returns a reference to self

source

pub fn get_entry(&self, indices: Indices) -> f64

Returns the entry at the position given by the indices

Returns a reference to a row of entries, indexed from zero

Returns false if any difference magnitude is greater than the tolerance.

The tolerance should be a positive number.

Returns true if the other Matrix has the exact same entries

Multiplies with a square matrix and then returns a reference to self

Multiplies corresponding entries and then returns a reference to self

This result is known as the Hadamard Product:
https://en.wikipedia.org/wiki/Hadamard_product_(matrices)

Multiplies all entries by the scalar and then returns a reference to self

Multiplies all entries by -1.0 and then returns a reference to self

source

pub fn set_entry(&mut self, indices: Indices, value: f64) -> &mut Self

Sets the entry at the position given by the indices and then returns self

Returns a new Matrix that is a submatrix of self

Subtracts all entries from the scalar and then returns a reference to self

Subtracts the argument entries from corresponding entries and returns self

Subtracts the scalar from all entries and then returns a reference to self

Calculates the sum of all of the entries in the Matrix

Returns a new Matrix with the rows and columns switched.

Trait Implementations

The resulting type after applying the + operator.
Performs the + operation. Read more
The resulting type after applying the + operator.
Performs the + operation. Read more
The resulting type after applying the + operator.
Performs the + operation. Read more
The resulting type after applying the + operator.
Performs the + operation. Read more
The resulting type after applying the + operator.
Performs the + operation. Read more
The resulting type after applying the + operator.
Performs the + operation. Read more
The resulting type after applying the + operator.
Performs the + operation. Read more
The resulting type after applying the + operator.
Performs the + operation. Read more
Performs the += operation. Read more
Performs the += operation. Read more
Performs the += operation. Read more
Performs the += operation. Read more
Performs the += operation. Read more
Performs the += operation. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Makes a new Matrix of all zero entries

The resulting type after applying the / operator.
Performs the / operation. Read more
The resulting type after applying the / operator.
Performs the / operation. Read more
Performs the /= operation. Read more
Performs the /= operation. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
Performs the *= operation. Read more
Performs the *= operation. Read more
Performs the *= operation. Read more
Performs the *= operation. Read more
Performs the *= operation. Read more
Performs the *= operation. Read more
The resulting type after applying the - operator.
Performs the unary - operation. Read more
The resulting type after applying the - operator.
Performs the unary - operation. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
Performs the -= operation. Read more
Performs the -= operation. Read more
Performs the -= operation. Read more
Performs the -= operation. Read more
Performs the -= operation. Read more
Performs the -= operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.