Matrix

Struct Matrix 

Source
pub struct Matrix<N: CddNumber = DefaultNumber> { /* private fields */ }

Implementations§

Source§

impl<N: CddNumber> Matrix<N>

Source

pub fn new( rows: usize, cols: usize, repr: Representation, num_type: NumberType, ) -> CddResult<Self>

Source

pub fn rows(&self) -> usize

Source

pub fn cols(&self) -> usize

Source

pub fn representation(&self) -> Representation

Source

pub fn number_type(&self) -> NumberType

Source

pub fn as_raw(&self) -> *mut c_void

Source

pub unsafe fn from_raw(ptr: *mut c_void) -> Self

§Safety
  • ptr must be a non-null dd_MatrixPtr compatible with the backend N.
  • The pointer must be valid for the lifetime of this wrapper and must be owned by this wrapper (it will be freed on drop).
Source

pub fn clone_cdd(&self) -> CddResult<Self>

Source

pub fn set(&mut self, row: usize, col: usize, value: &N)

Source

pub fn get(&self, row: usize, col: usize) -> N

Source

pub fn set_real(&mut self, row: usize, col: usize, value: f64)

Source

pub fn get_real(&self, row: usize, col: usize) -> f64

Source

pub fn set_generator_type(&mut self, row: usize, is_vertex: bool)

Source

pub fn set_objective_real(&mut self, coeffs: &[f64])

Source

pub fn from_vertices<const D: usize>(vertices: &[[N; D]]) -> CddResult<Self>

Source

pub fn from_vertex_rows(vertices: &[Vec<N>]) -> CddResult<Self>

Build a generator matrix from a dynamic list of vertices.

The ambient dimension is determined from the first vertex. All vertices must have the same length.

Source

pub fn append_rows_in_place(&mut self, rows: &Matrix<N>) -> CddResult<()>

Source

pub fn append_rows(&self, rows: &Matrix<N>) -> CddResult<Self>

Source

pub fn append_row(&self, coords: &[N], is_vertex: bool) -> CddResult<Self>

Source

pub fn remove_row(&mut self, row: usize) -> CddResult<()>

Source

pub fn is_row_redundant(&self, row: usize) -> CddResult<bool>

Source

pub fn redundant_rows(&self) -> CddResult<Vec<usize>>

Source

pub fn canonicalize(&self) -> CddResult<CanonicalForm<N>>

Source§

impl<N: CddNumber> Matrix<N>

Source

pub fn convert<M: CddNumber>(&self) -> CddResult<Matrix<M>>

Trait Implementations§

Source§

impl<N: Debug + CddNumber> Debug for Matrix<N>

Source§

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

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

impl<N: CddNumber> Drop for Matrix<N>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<Matrix<CddFloat>> for Matrix<f64>

Available on crate features f64 and gmp only.
Source§

fn from(value: Matrix<CddFloat>) -> Self

Converts to this type from the input type.
Source§

impl From<Matrix<CddFloat>> for Matrix<CddRational>

Available on crate features gmp and gmprational only.
Source§

fn from(value: Matrix<CddFloat>) -> Self

Converts to this type from the input type.
Source§

impl From<Matrix<CddRational>> for Matrix<f64>

Available on crate features f64 and gmprational only.
Source§

fn from(value: Matrix<CddRational>) -> Self

Converts to this type from the input type.
Source§

impl From<Matrix<CddRational>> for Matrix<CddFloat>

Available on crate features gmp and gmprational only.
Source§

fn from(value: Matrix<CddRational>) -> Self

Converts to this type from the input type.
Source§

impl From<Matrix> for Matrix<CddFloat>

Available on crate features f64 and gmp only.
Source§

fn from(value: Matrix<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<Matrix> for Matrix<CddRational>

Available on crate features f64 and gmprational only.
Source§

fn from(value: Matrix<f64>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<N> Freeze for Matrix<N>

§

impl<N> RefUnwindSafe for Matrix<N>
where N: RefUnwindSafe,

§

impl<N = f64> !Send for Matrix<N>

§

impl<N = f64> !Sync for Matrix<N>

§

impl<N> Unpin for Matrix<N>
where N: Unpin,

§

impl<N> UnwindSafe for Matrix<N>
where N: UnwindSafe,

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> 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, 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.