Package org.biojava.nbio.structure.math
Class SparseSquareMatrix
java.lang.Object
org.biojava.nbio.structure.math.SparseSquareMatrix
- All Implemented Interfaces:
 Serializable
A sparse, square matrix, implementing using two arrays of sparse
  vectors, one representation for the rows and one for the columns.
  For matrix-matrix product, we might also want to store the
  column representation.
 Derived from http://introcs.cs.princeton.edu/java/44st/SparseMatrix.java.html
  For additional documentation, see Section 4.4 of
  Introduction to Programming in Java: An Interdisciplinary Approach by Robert Sedgewick and Kevin Wayne.
- See Also:
 
- 
Constructor Summary
Constructors - 
Method Summary
 
- 
Constructor Details
- 
SparseSquareMatrix
public SparseSquareMatrix(int N) initialize an N-by-N matrix of all 0s- Parameters:
 N- - size
 
 - 
 - 
Method Details
- 
put
public void put(int i, int j, double value) set A[i][j] = value- Parameters:
 i-j-value-
 - 
get
public double get(int i, int j) access a value at i,j- Parameters:
 i-j-- Returns:
 - return A[i][j]
 
 - 
nnz
public int nnz()return the number of nonzero entries (not the most efficient implementation)- Returns:
 
 - 
times
- Parameters:
 x-- Returns:
 - return the matrix-vector product b = Ax
 
 - 
plus
return C = A + B- Parameters:
 B-- Returns:
 
 - 
toString
 
 -