# [−][src]Trait cgmath::SquareMatrix

    pub trait SquareMatrix where
        Self::Scalar: BaseFloat,
        Self: One,
        Self: Product<Self>,
        Self: Matrix<Column = Self::ColumnRow, Row = Self::ColumnRow, Transpose = Self>,
        Self: Mul<Self::ColumnRow, Output = Self::ColumnRow>,
        Self: Mul<Self, Output = Self>, {
        type ColumnRow: VectorSpace<Scalar = Self::Scalar> + Array<Element = Self::Scalar>;
        fn from_value(value: Self::Scalar) -> Self;
        fn from_diagonal(diagonal: Self::ColumnRow) -> Self;
        fn transpose_self(&mut self);
        fn determinant(&self) -> Self::Scalar;
        fn diagonal(&self) -> Self::ColumnRow;
        fn invert(&self) -> Option<Self>;
        fn is_diagonal(&self) -> bool;
        fn is_symmetric(&self) -> bool;

        fn identity() -> Self { ... }
        fn trace(&self) -> Self::Scalar { ... }
        fn is_invertible(&self) -> bool { ... }
        fn is_identity(&self) -> bool { ... }
    }

A column-major major matrix where the rows and column vectors are of the same dimensions.

## Associated Types

### `type ColumnRow: VectorSpace<Scalar = Self::Scalar> + Array<Element = Self::Scalar>`

The row/column vector of the matrix.

This is used to constrain the column and rows to be of the same type in lieu of equality constraints being implemented for `where` clauses. Once those are added, this type will likely go away.

Loading content...

## Required methods

### `fn from_value(value: Self::Scalar) -> Self`

Create a new diagonal matrix using the supplied value.

### `fn from_diagonal(diagonal: Self::ColumnRow) -> Self`

Create a matrix from a non-uniform scale

### `fn transpose_self(&mut self)`

Transpose this matrix in-place.

### `fn determinant(&self) -> Self::Scalar`

Take the determinant of this matrix.

### `fn diagonal(&self) -> Self::ColumnRow`

Return a vector containing the diagonal of this matrix.

### `fn invert(&self) -> Option<Self>`

Invert this matrix, returning a new matrix. `m.mul_m(m.invert())` is the identity matrix. Returns `None` if this matrix is not invertible (has a determinant of zero).

### `fn is_diagonal(&self) -> bool`

Test if this is a diagonal matrix. That is, every element outside of the diagonal is 0.

### `fn is_symmetric(&self) -> bool`

Test if this matrix is symmetric. That is, it is equal to its transpose.

Loading content...

## Provided methods

### `fn identity() -> Self`

The identity matrix. Multiplying this matrix with another should have no effect.

Note that this is exactly the same as `One::one`. The term 'identity matrix' is more common though, so we provide this method as an alternative.

### `fn trace(&self) -> Self::Scalar`

Return the trace of this matrix. That is, the sum of the diagonal.

### `fn is_invertible(&self) -> bool`

Test if this matrix is invertible.

### `fn is_identity(&self) -> bool`

Test if this matrix is the identity matrix. That is, it is diagonal and every element in the diagonal is one.

Loading content...

## Implementors

### `impl<S: BaseFloat> SquareMatrix for Matrix2<S>`[src]

#### `type ColumnRow = Vector2<S>`

#### `fn from_value(value: S) -> Matrix2<S>`[src]

#### `fn from_diagonal(value: Vector2<S>) -> Matrix2<S>`[src]

#### `fn transpose_self(&mut self)`[src]

#### `fn determinant(&self) -> S`[src]

#### `fn diagonal(&self) -> Vector2<S>`[src]

#### `fn invert(&self) -> Option<Matrix2<S>>`[src]

#### `fn is_diagonal(&self) -> bool`[src]

#### `fn is_symmetric(&self) -> bool`[src]

### `impl<S: BaseFloat> SquareMatrix for Matrix3<S>`[src]

#### `type ColumnRow = Vector3<S>`

#### `fn from_value(value: S) -> Matrix3<S>`[src]

#### `fn from_diagonal(value: Vector3<S>) -> Matrix3<S>`[src]

#### `fn transpose_self(&mut self)`[src]

#### `fn determinant(&self) -> S`[src]

#### `fn diagonal(&self) -> Vector3<S>`[src]

#### `fn invert(&self) -> Option<Matrix3<S>>`[src]

#### `fn is_diagonal(&self) -> bool`[src]

#### `fn is_symmetric(&self) -> bool`[src]

### `impl<S: BaseFloat> SquareMatrix for Matrix4<S>`[src]

#### `type ColumnRow = Vector4<S>`

#### `fn from_value(value: S) -> Matrix4<S>`[src]

#### `fn from_diagonal(value: Vector4<S>) -> Matrix4<S>`[src]

#### `fn transpose_self(&mut self)`[src]

#### `fn determinant(&self) -> S`[src]

#### `fn diagonal(&self) -> Vector4<S>`[src]

#### `fn invert(&self) -> Option<Matrix4<S>>`[src]

#### `fn is_diagonal(&self) -> bool`[src]

#### `fn is_symmetric(&self) -> bool`[src]

Loading content...

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)