baseCode.dataStructure.matrix
Class RCDoubleMatrix1D

java.lang.Object
  extended bycern.colt.PersistentObject
      extended bycern.colt.matrix.impl.AbstractMatrix
          extended bycern.colt.matrix.impl.AbstractMatrix1D
              extended bycern.colt.matrix.DoubleMatrix1D
                  extended bybaseCode.dataStructure.matrix.RCDoubleMatrix1D
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class RCDoubleMatrix1D
extends cern.colt.matrix.DoubleMatrix1D

A row-compressed 1D matrix. The only deviation from the contract of DoubleMatrix1D is in apply(), which only operates on the non-empty elements. This implementation has a highly optimized dot product computer. If you need to compute the dot product of a RCDoubleMatrix1D with another DoubleMatrix1D, call zDotProduct on this, not on the other. This is because getQuick() and setQuick() are not very fast for this.


Copyright (c) 2004 Columbia University

Version:
$Id: RCDoubleMatrix1D.java,v 1.14 2005/01/05 02:01:02 pavlidis Exp $
Author:
pavlidis
See Also:
Serialized Form

Field Summary
protected  cern.colt.list.IntArrayList indexes
           
protected  cern.colt.list.DoubleArrayList values
           
 
Fields inherited from class cern.colt.matrix.impl.AbstractMatrix1D
size, stride, zero
 
Fields inherited from class cern.colt.matrix.impl.AbstractMatrix
isNoView
 
Fields inherited from class cern.colt.PersistentObject
serialVersionUID
 
Constructor Summary
RCDoubleMatrix1D(double[] values)
           
RCDoubleMatrix1D(int length)
           
RCDoubleMatrix1D(cern.colt.list.IntArrayList indexes, cern.colt.list.DoubleArrayList values)
           
 
Method Summary
 cern.colt.matrix.DoubleMatrix1D assign(cern.colt.function.DoubleFunction function)
          WARNING this only even assigns to the non-empty values, for performance reasons.
 cern.colt.matrix.DoubleMatrix1D forEachNonZero(cern.colt.function.DoubleFunction function)
          Apply the given function to each element non-zero element in the matrix.
 double getQuick(int index)
           
 cern.colt.matrix.DoubleMatrix1D like(int s)
           
 cern.colt.matrix.DoubleMatrix2D like2D(int rows, int columns)
           
 void setQuick(int column, double value)
           
 java.lang.String toString()
           
protected  cern.colt.matrix.DoubleMatrix1D viewSelectionLike(int[] offsets)
           
 double zDotProduct(cern.colt.matrix.DoubleMatrix1D y)
           
 double zSum()
           
 
Methods inherited from class cern.colt.matrix.DoubleMatrix1D
aggregate, aggregate, assign, assign, assign, assign, assign, cardinality, cardinality, copy, equals, equals, get, getContent, getNonZeros, getNonZeros, haveSharedCells, haveSharedCellsRaw, like, set, swap, toArray, toArray, view, viewFlip, viewPart, viewSelection, viewSelection, viewSorted, viewStrides, zDotProduct, zDotProduct, zDotProduct
 
Methods inherited from class cern.colt.matrix.impl.AbstractMatrix1D
_offset, _rank, checkIndex, checkIndexes, checkRange, checkSize, checkSize, index, setUp, setUp, size, stride, toStringShort, vFlip, vPart, vStrides
 
Methods inherited from class cern.colt.matrix.impl.AbstractMatrix
ensureCapacity, isView, trimToSize
 
Methods inherited from class cern.colt.PersistentObject
clone
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

indexes

protected cern.colt.list.IntArrayList indexes

values

protected cern.colt.list.DoubleArrayList values
Constructor Detail

RCDoubleMatrix1D

public RCDoubleMatrix1D(double[] values)
Parameters:
values -

RCDoubleMatrix1D

public RCDoubleMatrix1D(int length)
Parameters:
length -

RCDoubleMatrix1D

public RCDoubleMatrix1D(cern.colt.list.IntArrayList indexes,
                        cern.colt.list.DoubleArrayList values)
Parameters:
indexes - These MUST be in sorted order.
values - These MuST be in the same order as the indexes, meaning that indexes[0] is the column for values[0].
Method Detail

getQuick

public double getQuick(int index)

like

public cern.colt.matrix.DoubleMatrix1D like(int s)

like2D

public cern.colt.matrix.DoubleMatrix2D like2D(int rows,
                                              int columns)

setQuick

public void setQuick(int column,
                     double value)

viewSelectionLike

protected cern.colt.matrix.DoubleMatrix1D viewSelectionLike(int[] offsets)

forEachNonZero

public cern.colt.matrix.DoubleMatrix1D forEachNonZero(cern.colt.function.DoubleFunction function)
Apply the given function to each element non-zero element in the matrix.

Parameters:
function -
Returns:

zDotProduct

public double zDotProduct(cern.colt.matrix.DoubleMatrix1D y)

assign

public cern.colt.matrix.DoubleMatrix1D assign(cern.colt.function.DoubleFunction function)
WARNING this only even assigns to the non-empty values, for performance reasons. If you need to assign to any index, you have to use another way.

See Also:
DoubleMatrix1D.assign(cern.colt.function.DoubleFunction)

zSum

public double zSum()

toString

public java.lang.String toString()


Copyright © 2003-2005 Columbia University. All Rights Reserved.