## gov.sandia.cognition.math.matrix Interface DiagonalMatrix

All Superinterfaces:
Cloneable, CloneableSerializable, Iterable<MatrixEntry>, Matrix, Ring<Matrix>, Serializable, Vectorizable
All Known Implementing Classes:
DiagonalMatrixMTJ

`public interface DiagonalMatrixextends Matrix`

Interface describing a diagonal matrix. That is, a square Matrix with arbitrary values along the diagonal, and zero on the off-diagonal entries.

Since:
2.1
Author:
Kevin R. Dixon

Method Summary
` DiagonalMatrix` `dotTimes(Matrix matrix)`
Element-wise multiplication of `this` and `other`
` double[]` `getDiagonal()`
Gets the data along the diagonal
` int` `getDimensionality()`
Gets the dimensionality of this square matrix, which is equal to either the number of rows or the number of columns
` double` `getElement(int index)`
Gets the zero-based index diagonal element into the diagonal matrix
` DiagonalMatrix` `inverse()`
Computes the full-blown inverse of `this`, which must be a square matrix
` DiagonalMatrix` `pseudoInverse()`
Computes the effective pseudo-inverse of `this`, using a rather expensive procedure (SVD)
` DiagonalMatrix` `pseudoInverse(double effectiveZero)`
Computes the effective pseudo-inverse of `this`, using a rather expensive procedure (SVD)
` void` ```setElement(int index, double value)```
Sets the zero-based index diagonal element into the diagonal matrix
` DiagonalMatrix` `times(DiagonalMatrix matrix)`
Multiplies this by the given DiagonalMatrix, leaving this unmodified
` void` `timesEquals(DiagonalMatrix matrix)`
Multiplies this by the other diagonal matrix, stores the result in this

Methods inherited from interface gov.sandia.cognition.math.matrix.Matrix
`assertSameDimensions, checkMultiplicationDimensions, checkSameDimensions, clone, convertFromVector, convertToVector, dotDivide, dotDivideEquals, getColumn, getElement, getNumColumns, getNumRows, getRow, getSubMatrix, identity, isSparse, isSquare, isSymmetric, isSymmetric, logDeterminant, normFrobenius, rank, rank, setColumn, setElement, setRow, setSubMatrix, solve, solve, sumOfColumns, sumOfRows, times, times, toArray, toString, toString, trace, transpose`

Methods inherited from interface java.lang.Iterable
`iterator`

Methods inherited from interface gov.sandia.cognition.math.Ring
`dotTimesEquals, equals, equals, isZero, isZero, minus, minusEquals, negative, negativeEquals, plus, plusEquals, scale, scaledMinus, scaledMinusEquals, scaledPlus, scaledPlusEquals, scaleEquals, zero`

Method Detail

### getDiagonal

`double[] getDiagonal()`
Gets the data along the diagonal

Returns:
Diagonal data with length of "dimension"

### getElement

`double getElement(int index)`
Gets the zero-based index diagonal element into the diagonal matrix

Parameters:
`index` - Zero-based index into the diagonal to get
Returns:
Diagonal value at index

### setElement

```void setElement(int index,
double value)```
Sets the zero-based index diagonal element into the diagonal matrix

Parameters:
`index` - Zero-based index into the diagonal to set
`value` - Value to set

### getDimensionality

`int getDimensionality()`
Gets the dimensionality of this square matrix, which is equal to either the number of rows or the number of columns

Returns:
Dimensionality of the square matrix

### dotTimes

`DiagonalMatrix dotTimes(Matrix matrix)`
Description copied from interface: `Ring`
Element-wise multiplication of `this` and `other`

Specified by:
`dotTimes` in interface `Ring<Matrix>`
Parameters:
`matrix` - elements of other will be multiplied to the corresponding elements of `this`
Returns:
element-wise multiplication of `this` and `other`

### times

`DiagonalMatrix times(DiagonalMatrix matrix)`
Multiplies this by the given DiagonalMatrix, leaving this unmodified

Parameters:
`matrix` - DigonalMatrix to multiply this
Returns:
DiagonalMatrix representing the multiplication

### timesEquals

`void timesEquals(DiagonalMatrix matrix)`
Multiplies this by the other diagonal matrix, stores the result in this

Parameters:
`matrix` - Diagonal matrix to multiply this by

### pseudoInverse

`DiagonalMatrix pseudoInverse()`
Description copied from interface: `Matrix`
Computes the effective pseudo-inverse of `this`, using a rather expensive procedure (SVD)

Specified by:
`pseudoInverse` in interface `Matrix`
Returns:
full singular-value pseudo-inverse of `this`

### pseudoInverse

`DiagonalMatrix pseudoInverse(double effectiveZero)`
Description copied from interface: `Matrix`
Computes the effective pseudo-inverse of `this`, using a rather expensive procedure (SVD)

Specified by:
`pseudoInverse` in interface `Matrix`
Parameters:
`effectiveZero` - effective zero to pass along to the SVD
Returns:
effective pseudo-inverse of `this`

### inverse

`DiagonalMatrix inverse()`
Description copied from interface: `Matrix`
Computes the full-blown inverse of `this`, which must be a square matrix

Specified by:
`inverse` in interface `Matrix`
Returns:
Inverse of `this`, such that ```this.times(this.inverse()) == this.inverse().times(this) == ```identity matrix