public class DenseMatrix extends AbstractMatrix
rowCount
* columnCount
double values.Matrix.Element, Matrix.ElementHandler
Constructor and Description |
---|
DenseMatrix(int rowCount,
int columnCount) |
DenseMatrix(int rowCount,
int columnCount,
double[] values) |
DenseMatrix(int rowCount,
int columnCount,
java.util.function.Supplier<java.nio.ByteBuffer> bufferSupplier) |
DenseMatrix(Jama.Matrix matrix) |
Modifier and Type | Method and Description |
---|---|
void |
add(int i,
int j,
double value)
Add value at row
i and column j . |
Matrix.Element |
addAndGetElement(int i,
int j,
double value)
Add value at row
i and column j and get an #Element to later update the element. |
LUDecomposition |
decomposeLU()
Get LU decomposition utility class for this matrix.
|
boolean |
equals(java.lang.Object obj) |
double |
get(int i,
int j)
Get value at row
i and column j . |
int |
getColumnCount()
Get column count.
|
protected int |
getEstimatedNonZeroValueCount()
Get an estimation of non zero value count.
|
int |
getRowCount()
Get row count.
|
double |
getValue(int i,
int j)
Deprecated.
Use
get(int, int) instead. |
int |
hashCode() |
void |
iterateNonZeroValue(Matrix.ElementHandler handler)
Iterate over non zero values of the matrix.
|
void |
iterateNonZeroValueOfColumn(int j,
Matrix.ElementHandler handler)
Iterate over non zero values of the
j column of the matrix. |
void |
print(java.io.PrintStream out)
Print the matrix to a stream.
|
void |
print(java.io.PrintStream out,
java.util.List<java.lang.String> rowNames,
java.util.List<java.lang.String> columnNames)
Print the matrix to a stream.
|
void |
reset()
Fill matrix with zeros.
|
void |
set(int i,
int j,
double value)
Set value at row
i and column j . |
Matrix |
times(Matrix other)
Multiply the matrix by another one (this*other).
|
Matrix |
to(MatrixFactory factory)
Copy this matrix using another implementation.
|
DenseMatrix |
toDense()
Copy this matrix using a dense implementation.
|
com.powsybl.math.matrix.SparseMatrix |
toSparse()
Copy this matrix using a sparse implementation.
|
checkBounds, copy
public DenseMatrix(int rowCount, int columnCount, double[] values)
public DenseMatrix(int rowCount, int columnCount)
public DenseMatrix(int rowCount, int columnCount, java.util.function.Supplier<java.nio.ByteBuffer> bufferSupplier)
public DenseMatrix(Jama.Matrix matrix)
public double get(int i, int j)
i
and column j
.i
- row indexj
- column indexi
and column j
@Deprecated public double getValue(int i, int j)
get(int, int)
instead.public void set(int i, int j, double value)
Matrix
i
and column j
.i
- row indexj
- column indexvalue
- the value to set at row i
and column j
public void add(int i, int j, double value)
Matrix
i
and column j
.i
- row indexj
- column indexvalue
- the value to add at row i
and column j
public Matrix.Element addAndGetElement(int i, int j, double value)
Matrix
i
and column j
and get an #Element
to later update the element.i
- row indexj
- column indexvalue
- the value to add at row i
and column j
i
and column j
public void reset()
Matrix
public int getRowCount()
Matrix
public int getColumnCount()
Matrix
public LUDecomposition decomposeLU()
Matrix
public Matrix times(Matrix other)
Matrix
other
- the other matrixpublic void iterateNonZeroValue(Matrix.ElementHandler handler)
Matrix
Matrix.ElementHandler.onElement(int, int, double)
is called.handler
- the element handlerpublic void iterateNonZeroValueOfColumn(int j, Matrix.ElementHandler handler)
Matrix
j
column of the matrix. At each non zero value Matrix.ElementHandler.onElement(int, int, double)
is called.j
- column indexhandler
- the element handlerpublic DenseMatrix toDense()
Matrix
public com.powsybl.math.matrix.SparseMatrix toSparse()
Matrix
public Matrix to(MatrixFactory factory)
Matrix
factory
- a matrix factory to create the copy.protected int getEstimatedNonZeroValueCount()
AbstractMatrix
getEstimatedNonZeroValueCount
in class AbstractMatrix
public void print(java.io.PrintStream out)
Matrix
out
- the streampublic void print(java.io.PrintStream out, java.util.List<java.lang.String> rowNames, java.util.List<java.lang.String> columnNames)
Matrix
out
- the streamrowNames
- row namescolumnNames
- column namespublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Copyright © 2020. All rights reserved.