|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectscpsolver.util.SparseMatrix
public class SparseMatrix
Implementation of a sparse matrix. The actual values of the matrix are saved in a SparseVector.
| Constructor Summary | |
|---|---|
SparseMatrix(double[][] q)
Creates a new matrix with elements specified in q |
|
SparseMatrix(int rows,
int columns)
Creates a new empty SparseMatrix |
|
SparseMatrix(int rows,
int columns,
int initrowdim)
|
|
SparseMatrix(SparseMatrix m)
Copy constructor for the SparseMatrix class |
|
| Method Summary | |
|---|---|
Matrix |
add(Matrix B)
Adds two matrices |
SparseMatrix |
clone()
Returns a deep copy of the matrix |
boolean |
equals(java.lang.Object o)
Compares two matrices. |
boolean |
equals(SparseMatrix A)
Compares two SparseMatrices |
double |
get(int row,
int column)
Returns a given element of the matrix |
int |
getColNum()
|
NonSparseMatrix |
getNonSparseMatrix()
|
NonZeroElementIterator |
getNonZeroElementIterator()
|
int |
getNumberOfNonZeroElements()
|
int |
getNumberOfNonZeroRows()
|
int |
getRowNum()
|
double |
getSparsity()
|
void |
grow(int size,
int direction)
Grows the matrix with zero-elements |
void |
grow(Matrix M,
int direction)
Grows the matrix on one side with another matrix |
Matrix |
plus(Matrix m)
Adds a matrix to the matrix |
static SparseMatrix |
readMTX(java.lang.String filename)
|
void |
set(double[][] q)
Sets all the entries of the matrix to the values supplied by the array |
void |
set(int row,
int column,
double value)
Sets a single entry of the matrix to the given value |
SparseMatrix |
submatrix(int from,
int to)
Returns a quadratic submatrix with range [from, to) |
Matrix |
times(Matrix multiplier)
Multiplies a matrix with another matrix |
Matrix |
transpose()
Calculates the transpose matrix |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SparseMatrix(int rows,
int columns)
rows - The number of rows of the new matrixcolumns - The number of columns of the new matrix
public SparseMatrix(int rows,
int columns,
int initrowdim)
public SparseMatrix(SparseMatrix m)
m - The copied matrixpublic SparseMatrix(double[][] q)
q - The elements of the new matrix| Method Detail |
|---|
public static SparseMatrix readMTX(java.lang.String filename)
public SparseMatrix clone()
clone in class java.lang.Objectpublic void set(double[][] q)
q - The new entries of the matrix
public double get(int row,
int column)
get in interface Matrixrow - Specifies the row of the given elementcolumn - Specifies the column of the given element
public void set(int row,
int column,
double value)
set in interface Matrixrow - Specifies the row of the altered elementcolumn - Specifies the column of the altered elementvalue - The new value of the entrypublic int getRowNum()
getRowNum in interface Matrixpublic int getColNum()
getColNum in interface Matrixpublic Matrix transpose()
transpose in interface Matrixpublic Matrix times(Matrix multiplier)
times in interface Matrixmultiplier - The matrix with which this matrix should be multiplied
public Matrix plus(Matrix m)
plus in interface Matrixm - The matrix which should be added to this matrix
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - The matrix which should be compared
public boolean equals(SparseMatrix A)
A - The matrix to be compared to
public SparseMatrix submatrix(int from,
int to)
from - First row and column to be copiedto - First row and column not to be copied anymore
public Matrix add(Matrix B)
B - The added matrix
public void grow(int size,
int direction)
size - The new size of the matrixdirection - Determines where the new zero-elements going to be located. Enumeration according to the
Cartesian coordinate system. So, if you want to grow the matrix on the right and on the
bottom side, direction is 2.
public void grow(Matrix M,
int direction)
public int getNumberOfNonZeroElements()
public double getSparsity()
public NonZeroElementIterator getNonZeroElementIterator()
getNonZeroElementIterator in interface Matrixpublic int getNumberOfNonZeroRows()
public NonSparseMatrix getNonSparseMatrix()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||