| 
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--ostore.oil.Matrix
A sparse array of Arrays.  Elements are indexed by
 arbitrary QuickSerializable objects.
 
This class is synchronized.
| Field Summary | |
|---|---|
protected  HashMap | 
map
The internal storage mechanism.  | 
| Constructor Summary | |
|---|---|
Matrix()
Construct a new Matrix. | 
|
Matrix(InputBuffer buffer)
Implied from ostore.util.QuickSerializable interface Construct an Matrix from its
 QuickSerializable form. | 
|
Matrix(InputBuffer buffer,
       HashMap decompression_map,
       HashMap row_decompression_map)
Construct an Matrix from its
 QuickSerializable form.
  | 
|
| Method Summary | |
|---|---|
 void | 
add(Matrix addend)
Adds the contents of the specified Matrix to this one.
  | 
 void | 
add(QuickSerializable id,
    Array addend)
Adds the specified Array to this Matrix.
  | 
 Object | 
clone()
Performs a slightly deeper copy than Object.clone.
  | 
 boolean | 
contains(QuickSerializable id)
Shows whether the specified ID is explicitly stored in this Matrix. | 
 int | 
full_size()
Returns the full size of the Matrix. | 
 Array | 
get(QuickSerializable id)
Returns the Array indexed by the specified ID. | 
 Iterator | 
ids()
Returns an Iterator over the IDs stored explicitly in
 this Matrix. | 
static void | 
max(double[][] matrix,
    int[][] indices)
Finds the indices of the largest elements of the specified Matrix.  | 
 Array | 
put(QuickSerializable id,
    Array row)
Places the specified mapping into this Matrix.   | 
 Array | 
remove(QuickSerializable id)
Removes the row associated with id from this
 Matrix, and returns the removed row.   | 
 void | 
serialize(OutputBuffer buffer)
Add the object to the buffer. | 
 void | 
serialize(OutputBuffer buffer,
          HashMap compression_map,
          HashMap row_compression_map)
 | 
 int | 
size()
Returns the size of the Matrix. | 
 String | 
toString()
Produce a human-readable version of this Matrix.
  | 
static String | 
toString(double[][] matrix)
Returns a human-readable representation of the specified matrix.  | 
static String | 
toString(double[][] matrix,
         int[][] indices)
Returns a human-readable representation of the specified matrix, with indices.  | 
static double[][] | 
transpose(double[][] matrix)
Returns the transpose of the specified matrix.  | 
| Methods inherited from class java.lang.Object | 
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
protected HashMap map
| Constructor Detail | 
public Matrix()
Matrix.
public Matrix(InputBuffer buffer)
       throws QSException
Matrix from its
 QuickSerializable form.
public Matrix(InputBuffer buffer,
              HashMap decompression_map,
              HashMap row_decompression_map)
       throws QSException
Matrix from its
 QuickSerializable form.
 See serialize(OutputBuffer, HashMap, HashMap) for more details.
decompression_map - An Integer->QuickSerializable mapping
 			for decompressing IDs.row_decompression_map - An Integer->QuickSerializable
 			mapping	for decompressing IDs within rows.| Method Detail | 
public static String toString(double[][] matrix)
matrix - the matrix to print
public static String toString(double[][] matrix,
                              int[][] indices)
Array.toString(double[], int[]) on
 each row of the matrix.
matrix - the matrix to printindices - the indices, in order, of the elements to print
IllegalArgumentException - if width of indices
 greater than width of corresponding row of matrix.- See Also: 
 max(double[][], int[][])public static final double[][] transpose(double[][] matrix)
toString.
matrix - the matrix to flip
public static void max(double[][] matrix,
                       int[][] indices)
Array.max(double[], int[]) on each row of the matrix.  
 Thus the width of indices determines the number of top
 elements of each row to find.  To find the top elements of each
 column (instead of by row) use transpose to flip the
 matrix first.
matrix - the matrix to checkindices - the matrix into which to put the (sorted) indices of
 the largest elements of matrix.
IllegalArgumentException - if width of indices
 greater than width of corresponding row of matrix.public int size()
Matrix.
Arrays stored in this
 Matrix.public int full_size()
Matrix.
Arrays stored in this Matrix.public Iterator ids()
Iterator over the IDs stored explicitly in
 this Matrix.
HashIterator over the backing map's keys.public boolean contains(QuickSerializable id)
Matrix.
id - The unique ID for the row to check.
true iff id is explicitly mapped
 to a row.public Array get(QuickSerializable id)
Array indexed by the specified ID.
id - The unique ID for a row of this
 			Matrix.
Array stored under id, or
 null if the ID is unknown.
public Array put(QuickSerializable id,
                 Array row)
Matrix.  If
 id already maps to an Array, the old one
 is replaced and returned.
id - The index under which to store this row.row - The Array to store for this index.
Array previously mapped by this index, or
 null if the ID is unknown.public Array remove(QuickSerializable id)
id from this
 Matrix, and returns the removed row.  The
 specified id will no longer be associated with
 any row in this Matrix.
id - The index to be disassociated from the 
                  Matrix.
Array previously associated with the index
  being removed, or null if the index is unknown.public void add(Matrix addend)
Matrix to this one.
 Arrays for known IDs are added to the
 current rows.  Unknown IDs are inserted directly (not
 cloned).
addend - The Matrix whose contents to add
public void add(QuickSerializable id,
                Array addend)
Array to this Matrix.
 If the ID is known, the Array is added to
 the current row.  Otherwise it is cloned and inserted.
id - The unique ID for addendaddend - The Array to addpublic Object clone()
Object.clone.
 The mapping is cloned, so the new Matrix can be modified
 independently of this one.  Neither the IDs nor the rows are
 themselves cloned.
clone in class ObjectMatrix with the same set of elements as
 this one.public String toString()
Matrix.
 This method consumes O(full_size()) time and
 String length.
toString in class ObjectString of  < id:row > pairs.public void serialize(OutputBuffer buffer)
QuickSerializablebuffer.
serialize in interface QuickSerializablebuffer - the output buffer to add the object to
public void serialize(OutputBuffer buffer,
                      HashMap compression_map,
                      HashMap row_compression_map)
  | 
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||