public class DiagonalMatrix extends AbstractRealMatrix implements Serializable
| Constructor and Description | 
|---|
| DiagonalMatrix(double[] d)Creates a matrix using the input array as the underlying data. | 
| DiagonalMatrix(double[] d,
              boolean copyArray)Creates a matrix using the input array as the underlying data. | 
| DiagonalMatrix(int dimension)Creates a matrix with the supplied dimension. | 
| Modifier and Type | Method and Description | 
|---|---|
| DiagonalMatrix | add(DiagonalMatrix m)Compute the sum of  thisandm. | 
| void | addToEntry(int row,
          int column,
          double increment)Adds (in place) the specified value to the specified entry of
  thismatrix. | 
| RealMatrix | copy()Returns a (deep) copy of this. | 
| RealMatrix | createMatrix(int rowDimension,
            int columnDimension)Create a new RealMatrix of the same type as the instance with the
 supplied
 row and column dimensions. | 
| int | getColumnDimension()Returns the number of columns of this matrix. | 
| double[][] | getData()Returns matrix entries as a two-dimensional array. | 
| double[] | getDataRef()Gets a reference to the underlying data array. | 
| double | getEntry(int row,
        int column)Get the entry in the specified row and column. | 
| int | getRowDimension()Returns the number of rows of this matrix. | 
| DiagonalMatrix | inverse()Computes the inverse of this diagonal matrix. | 
| DiagonalMatrix | inverse(double threshold)Computes the inverse of this diagonal matrix. | 
| boolean | isSingular(double threshold)Returns whether this diagonal matrix is singular, i.e. | 
| DiagonalMatrix | multiply(DiagonalMatrix m)Returns the result of postmultiplying  thisbym. | 
| RealMatrix | multiply(RealMatrix m)Returns the result of postmultiplying  thisbym. | 
| void | multiplyEntry(int row,
             int column,
             double factor)Multiplies (in place) the specified entry of  thismatrix by the
 specified value. | 
| DiagonalMatrix | multiplyTransposed(DiagonalMatrix m)Returns the result of postmultiplying  thisbym^T. | 
| RealMatrix | multiplyTransposed(RealMatrix m)Returns the result of postmultiplying  thisbym^T. | 
| double[] | operate(double[] v)Returns the result of multiplying this by the vector  v. | 
| double[] | preMultiply(double[] v)Returns the (row) vector result of premultiplying this by the vector  v. | 
| RealVector | preMultiply(RealVector v)Returns the (row) vector result of premultiplying this by the vector  v. | 
| void | setEntry(int row,
        int column,
        double value)Set the entry in the specified row and column. | 
| DiagonalMatrix | subtract(DiagonalMatrix m)Returns  thisminusm. | 
| DiagonalMatrix | transposeMultiply(DiagonalMatrix m)Returns the result of postmultiplying  this^Tbym. | 
| RealMatrix | transposeMultiply(RealMatrix m)Returns the result of postmultiplying  this^Tbym. | 
add, copySubMatrix, copySubMatrix, equals, getColumn, getColumnMatrix, getColumnVector, getFrobeniusNorm, getRow, getRowMatrix, getRowVector, getSubMatrix, getSubMatrix, getTrace, hashCode, isSquare, operate, power, preMultiply, scalarAdd, scalarMultiply, setColumn, setColumnMatrix, setColumnVector, setRow, setRowMatrix, setRowVector, setSubMatrix, subtract, toString, transpose, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder, walkInRowOrderclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetNorm, getNorm1, getNormInfty, map, mapToSelfisTransposable, operateTransposepublic DiagonalMatrix(int dimension)
               throws MathIllegalArgumentException
dimension - Number of rows and columns in the new matrix.MathIllegalArgumentException - if the dimension is
 not positive.public DiagonalMatrix(double[] d)
d - Data for the new matrix.public DiagonalMatrix(double[] d,
                      boolean copyArray)
               throws NullArgumentException
copyArray may be
 set to false.
 This will prevent the copying and improve performance as no new
 array will be built and no data will be copied.d - Data for new matrix.copyArray - if true, the input array will be copied,
 otherwise it will be referenced.NullArgumentException - if d is nullpublic RealMatrix createMatrix(int rowDimension, int columnDimension) throws MathIllegalArgumentException
createMatrix in interface RealMatrixcreateMatrix in class AbstractRealMatrixrowDimension - the number of rows in the new matrixcolumnDimension - the number of columns in the new matrixMathIllegalArgumentException - if the requested dimensions are not equal.public RealMatrix copy()
copy in interface RealMatrixcopy in class AbstractRealMatrixpublic DiagonalMatrix add(DiagonalMatrix m) throws MathIllegalArgumentException
this and m.m - Matrix to be added.this + m.MathIllegalArgumentException - if m is not the same
 size as this.public DiagonalMatrix subtract(DiagonalMatrix m) throws MathIllegalArgumentException
this minus m.m - Matrix to be subtracted.this - mMathIllegalArgumentException - if m is not the same
 size as this.public DiagonalMatrix multiply(DiagonalMatrix m) throws MathIllegalArgumentException
this by m.m - matrix to postmultiply bythis * mMathIllegalArgumentException - if
 columnDimension(this) != rowDimension(m)public RealMatrix multiply(RealMatrix m) throws MathIllegalArgumentException
this by m.multiply in interface RealMatrixmultiply in class AbstractRealMatrixm - matrix to postmultiply bythis * mMathIllegalArgumentException - if
 columnDimension(this) != rowDimension(m)public DiagonalMatrix multiplyTransposed(DiagonalMatrix m) throws MathIllegalArgumentException
this by m^T.m - matrix to first transpose and second postmultiply bythis * mMathIllegalArgumentException - if
 columnDimension(this) != columnDimension(m)public RealMatrix multiplyTransposed(RealMatrix m) throws MathIllegalArgumentException
this by m^T.
 
 This is equivalent to call multiply(m.RealMatrix.transpose()),
 but some implementations may avoid building the intermediate transposed matrix.
 
multiplyTransposed in interface RealMatrixm - matrix to first transpose and second postmultiply bythis * m^TMathIllegalArgumentException - if
 columnDimension(this) != columnDimension(m)public DiagonalMatrix transposeMultiply(DiagonalMatrix m) throws MathIllegalArgumentException
this^T by m.m - matrix to first transpose and second postmultiply bythis^T * mMathIllegalArgumentException - if
 columnDimension(this) != columnDimension(m)public RealMatrix transposeMultiply(RealMatrix m)
this^T by m.
 
 This is equivalent to call RealMatrix.transpose().multiply(m),
 but some implementations may avoid building the intermediate transposed matrix.
 
transposeMultiply in interface RealMatrixm - matrix to postmultiply bythis^T * mpublic double[][] getData()
getData in interface RealMatrixgetData in class AbstractRealMatrixpublic double[] getDataRef()
public double getEntry(int row,
                       int column)
                throws MathIllegalArgumentException
getEntry in interface RealMatrixgetEntry in class AbstractRealMatrixrow - Row index of entry to be fetched.column - Column index of entry to be fetched.(row, column).MathIllegalArgumentException - if the row or column index is not valid.public void setEntry(int row,
                     int column,
                     double value)
              throws MathIllegalArgumentException
setEntry in interface RealMatrixsetEntry in class AbstractRealMatrixrow - Row index of entry to be set.column - Column index of entry to be set.value - the new value of the entry.MathIllegalArgumentException - if row != column and value is non-zero.public void addToEntry(int row,
                       int column,
                       double increment)
                throws MathIllegalArgumentException
this matrix. Row and column indices start at 0.addToEntry in interface RealMatrixaddToEntry in class AbstractRealMatrixrow - Row index of the entry to be modified.column - Column index of the entry to be modified.increment - value to add to the matrix entry.MathIllegalArgumentException - if row != column and increment is non-zero.public void multiplyEntry(int row,
                          int column,
                          double factor)
                   throws MathIllegalArgumentException
this matrix by the
 specified value. Row and column indices start at 0.multiplyEntry in interface RealMatrixmultiplyEntry in class AbstractRealMatrixrow - Row index of the entry to be modified.column - Column index of the entry to be modified.factor - Multiplication factor for the matrix entry.MathIllegalArgumentException - if the row or column index is not valid.public int getRowDimension()
getRowDimension in interface AnyMatrixgetRowDimension in interface RealLinearOperatorgetRowDimension in class AbstractRealMatrixpublic int getColumnDimension()
getColumnDimension in interface AnyMatrixgetColumnDimension in interface RealLinearOperatorgetColumnDimension in class AbstractRealMatrixpublic double[] operate(double[] v)
                 throws MathIllegalArgumentException
v.operate in interface RealMatrixoperate in class AbstractRealMatrixv - the vector to operate onthis * vMathIllegalArgumentException - if the length of v does not
 match the column dimension of this.public double[] preMultiply(double[] v)
                     throws MathIllegalArgumentException
v.preMultiply in interface RealMatrixpreMultiply in class AbstractRealMatrixv - the row vector to premultiply byv * thisMathIllegalArgumentException - if the length of v does not
 match the row dimension of this.public RealVector preMultiply(RealVector v) throws MathIllegalArgumentException
v.preMultiply in interface RealMatrixpreMultiply in class AbstractRealMatrixv - the row vector to premultiply byv * thisMathIllegalArgumentException - if the dimension of v does not
 match the row dimension of this.public DiagonalMatrix inverse() throws MathIllegalArgumentException
 Note: this method will use a singularity threshold of 0,
 use inverse(double) if a different threshold is needed.
mMathIllegalArgumentException - if the matrix is singularpublic DiagonalMatrix inverse(double threshold) throws MathIllegalArgumentException
threshold - Singularity threshold.mMathIllegalArgumentException - if the matrix is singularpublic boolean isSingular(double threshold)
0 within the given threshold.threshold - Singularity threshold.true if the matrix is singular, false otherwiseCopyright © 2016–2020 Hipparchus.org. All rights reserved.