Struct MatrixOnSemiring

Source
pub struct MatrixOnSemiring<R: Semiring> { /* private fields */ }
Expand description

半環上の行列

Implementations§

Source§

impl<R: Semiring> MatrixOnSemiring<R>
where R::Element: Copy,

Source

pub fn zero(semiring: R, h: usize, w: usize) -> Self

h×wの零行列を作る。

Source

pub fn unit(semiring: R, size: usize) -> Self

size×sizeの単位行列を作る。

Source

pub fn from_vec<T>(semiring: R, a: Vec<Vec<T>>) -> Self
where T: Into<R::Element>,

Vec<Vec<T>>からMatrixOnRingを作る。

Source

pub fn times(self, n: u64) -> Self

selfn回足した行列を求める。

Source

pub fn get(&self, i: usize, j: usize) -> Option<&R::Element>

ij列の要素への参照を返す。

Source

pub fn get_mut(&mut self, i: usize, j: usize) -> Option<&mut R::Element>

ij列の要素への可変参照を返す。

Source§

impl<R: Semiring + Clone> MatrixOnSemiring<R>
where R::Element: Copy,

Source

pub fn pow(self, p: u64) -> Option<Self>

行列のp乗を求める。

Source§

impl<R: Ring + Clone> MatrixOnSemiring<R>
where R::Element: Copy,

Source

pub fn strassen_mul(self, b: Self) -> Self

Strassenのアルゴリズムによる行列乗算

Trait Implementations§

Source§

impl<R: Semiring + Clone> Add for MatrixOnSemiring<R>
where R::Element: Copy,

Source§

type Output = MatrixOnSemiring<R>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<R: Semiring + Clone> AddAssign for MatrixOnSemiring<R>
where R::Element: Copy,

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<R: Semiring> AsRef<[Vec<<R as Semiring>::Element>]> for MatrixOnSemiring<R>

Source§

fn as_ref(&self) -> &[Vec<R::Element>]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<R: Clone + Semiring> Clone for MatrixOnSemiring<R>
where R::Element: Clone,

Source§

fn clone(&self) -> MatrixOnSemiring<R>

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<R: Debug + Semiring> Debug for MatrixOnSemiring<R>
where R::Element: Debug,

Source§

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

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

impl<R: Semiring> From<MatrixOnSemiring<R>> for Vec<Vec<R::Element>>

Source§

fn from(value: MatrixOnSemiring<R>) -> Self

Converts to this type from the input type.
Source§

impl<R: Semiring> Index<usize> for MatrixOnSemiring<R>

Source§

type Output = [<R as Semiring>::Element]

The returned type after indexing.
Source§

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

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

impl<R: Semiring> Matrix for MatrixOnSemiring<R>

Source§

fn width(&self) -> usize

行列の列数を返す。
Source§

fn height(&self) -> usize

行列の行数を返す。
Source§

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

行数の行数と列数のペアを返す。
Source§

fn is_square(&self) -> bool

行列が正方であるかどうかを判定する。
Source§

impl<R: Semiring> MatrixTranspose for MatrixOnSemiring<R>
where R::Element: Copy,

Source§

type Output = MatrixOnSemiring<R>

転置行列の型
Source§

fn transpose(self) -> Self::Output

転置した行列を返す。
Source§

impl<R: Semiring + Clone> Mul for MatrixOnSemiring<R>
where R::Element: Copy,

Source§

type Output = MatrixOnSemiring<R>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<R: Semiring + Clone> MulAssign for MatrixOnSemiring<R>
where R::Element: Copy,

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl<R: Ring> Neg for MatrixOnSemiring<R>
where R::Element: Copy,

Source§

type Output = MatrixOnSemiring<R>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<R: PartialEq + Semiring> PartialEq for MatrixOnSemiring<R>
where R::Element: PartialEq,

Source§

fn eq(&self, other: &MatrixOnSemiring<R>) -> 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<R: Ring + Clone> Sub for MatrixOnSemiring<R>
where R::Element: Copy,

Source§

type Output = MatrixOnSemiring<R>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<R: Ring + Clone> SubAssign for MatrixOnSemiring<R>
where R::Element: Copy,

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<R: Semiring> TryAdd for MatrixOnSemiring<R>
where R::Element: Copy,

Source§

type Output = MatrixOnSemiring<R>

返り値の型
Source§

fn try_add(self, rhs: Self) -> Option<Self::Output>

失敗可能性のある足し算を行う。
Source§

impl<R: Semiring + Clone> TryMul for MatrixOnSemiring<R>
where R::Element: Copy,

Source§

type Output = MatrixOnSemiring<R>

返り値の型
Source§

fn try_mul(self, rhs: Self) -> Option<Self::Output>

失敗可能性のある掛け算を行う。
Source§

impl<R: Ring> TrySub for MatrixOnSemiring<R>
where R::Element: Copy,

Source§

type Output = MatrixOnSemiring<R>

返り値の型
Source§

fn try_sub(self, rhs: Self) -> Option<Self::Output>

失敗可能性のある引き算を行う。
Source§

impl<R: Eq + Semiring> Eq for MatrixOnSemiring<R>
where R::Element: Eq,

Source§

impl<R: Semiring> StructuralPartialEq for MatrixOnSemiring<R>

Auto Trait Implementations§

§

impl<R> Freeze for MatrixOnSemiring<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for MatrixOnSemiring<R>

§

impl<R> Send for MatrixOnSemiring<R>
where R: Send, <R as Semiring>::Element: Send,

§

impl<R> Sync for MatrixOnSemiring<R>
where R: Sync, <R as Semiring>::Element: Sync,

§

impl<R> Unpin for MatrixOnSemiring<R>
where R: Unpin, <R as Semiring>::Element: Unpin,

§

impl<R> UnwindSafe for MatrixOnSemiring<R>

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