File |
Line |
ubic/basecode/dataStructure/matrix/DenseDoubleMatrix.java |
243 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
232 |
if ( i == startRow ) {
C colName = this.getColName( j );
returnval.setColumnName( colName, j );
}
returnval.set( k, j, this.get( i, j ) );
}
k++;
}
return returnval;
}
@Override
public boolean isMissing( int i, int j ) {
return Double.isNaN( get( i, j ) );
}
@Override
public int rows() {
return matrix.rows();
}
@Override
public void set( int row, int column, Double value ) {
matrix.set( row, column, value );
}
/**
* @return int
* @see AbstractMatrix2D#size()
*/
@Override
public int size() {
return matrix.size();
}
/*
* (non-Javadoc)
*
* @see ubic.basecode.dataStructure.matrix.DoubleMatrix#subsetColumns(java.util.List)
*/
@Override
public DoubleMatrix<R, C> subsetColumns( List<C> columns ) {
DoubleMatrix<R, C> returnval = new DenseDoubleMatrix<R, C>( this.rows(), columns.size() );
returnval.setRowNames( this.getRowNames() );
for ( int i = 0; i < this.rows(); i++ ) {
int currentColumn = 0;
for ( C c : columns ) {
int j = this.getColIndexByName( c );
returnval.set( i, currentColumn, this.get( i, j ) );
if ( i == 0 ) {
returnval.setColumnName( c, currentColumn );
}
currentColumn++;
}
}
return returnval;
}
@Override
public DoubleMatrix<R, C> subsetRows( List<R> rowNames ) {
DoubleMatrix<R, C> returnval = new DenseDoubleMatrix<R, C>( rowNames.size(), this.columns() ); |
File |
Line |
ubic/basecode/dataStructure/matrix/DenseDoubleMatrix.java |
142 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
148 |
if ( rowName != null ) returnval.addRowName( rowName );
}
returnval.set( j, k, this.get( j, i ) );
}
k++;
}
return returnval;
}
/*
* (non-Javadoc)
*
* @see basecode.dataStructure.matrix.DoubleMatrixNamed#getColumn(int)
*/
@Override
public double[] getColumn( int col ) {
double[] result = new double[rows()];
for ( int i = 0; i < rows(); i++ ) {
result[i] = get( i, col );
}
return result;
}
/**
* Converts to a String that can be read by read.table in R, using default parameters
*
* @return java.lang.String
*/
/*
* public String toRReadTableString() { Format nf = new Format( "%.4g" ); StringBuffer result = new StringBuffer(
* this.rows() * this.columns() ); if ( this.hasColNames() ) { for ( int i = 0; i < this.columns(); i++ ) {
* result.append( "\"" + this.getColName( i ) +"\" "); System.out.println("\"" + this.getColName( i ) +"\" "); }
* result.append( "\n" ); } for ( int i = 0; i < this.rows(); i++ ) { if ( this.hasRowNames() ) { result.append("\""
* + this.getRowName( i ) + "\"" ); } for ( int j = 0; j < this.columns(); j++ ) { if ( Double.isNaN( this.get( i, j
* ) ) ) { result.append( " NA" ); } else { result.append( " " + nf.format( this.get( i, j ) ) ); } } result.append(
* "\n" ); } return result.toString(); }
*/
@Override
public Double getObject( int row, int col ) {
return new Double( get( row, col ) );
}
/**
* Return a reference to a specific row.
*
* @param row int
* @return double[]
*/
@Override
public double[] getRow( int row ) {
return viewRow( row ).toArray();
}
/*
* (non-Javadoc)
*
* @see basecode.dataStructure.matrix.AbstractNamedDoubleMatrix#getRowArrayList(int)
*/
@Override
public DoubleArrayList getRowArrayList( int i ) {
return new DoubleArrayList( getRow( i ) );
}
/**
* Return a reference to a specific row.
*
* @param s String
* @return double[]
*/
@Override
public double[] getRowByName( R s ) {
return getRow( getRowIndexByName( s ) );
}
@Override
public Double[] getRowObj( int row ) {
Double[] result = new Double[columns()];
for ( int i = 0; i < columns(); i++ ) {
result[i] = new Double( get( row, i ) );
}
return result;
}
/*
* (non-Javadoc)
*
* @see ubic.basecode.dataStructure.matrix.Matrix2D#getRowRange(int, int)
*/
@Override
public DoubleMatrix<R, C> getRowRange( int startRow, int endRow ) {
super.checkRowRange( startRow, endRow );
DoubleMatrix<R, C> returnval = new DenseDoubleMatrix<R, C>( 1 + endRow - startRow, this.columns() ); |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedSparseDoubleMatrix.java |
103 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
100 |
DoubleMatrix<R, C> returnval = new CompressedSparseDoubleMatrix<R, C>( this.rows(), this.columns() );
for ( int i = 0; i < this.rows(); i++ ) {
returnval.setRowName( this.getRowName( i ), i );
for ( int j = 0; j < this.columns(); j++ ) {
if ( i == 0 ) {
returnval.setColumnName( this.getColName( j ), j );
}
returnval.set( i, j, this.get( i, j ) );
}
}
return returnval;
}
/**
* @param row
* @param column
* @return
*/
@Override
public double get( int row, int column ) {
return matrix.get( row, column );
}
/*
* (non-Javadoc)
*
* @see ubic.basecode.dataStructure.matrix.NamedPrimitiveMatrix#getColObj(int)
*/
@Override
public Double[] getColObj( int col ) {
Double[] result = new Double[rows()];
for ( int i = 0; i < rows(); i++ ) {
result[i] = new Double( get( i, col ) );
}
return result;
}
@Override
public DoubleMatrix<R, C> getColRange( int startCol, int endCol ) {
super.checkColRange( startCol, endCol );
DoubleMatrix<R, C> returnval = new CompressedSparseDoubleMatrix<R, C>( this.rows(), 1 + endCol - startCol ); |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedSparseDoubleMatrix.java |
146 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
138 |
DoubleMatrix<R, C> returnval = new CompressedSparseDoubleMatrix<R, C>( this.rows(), 1 + endCol - startCol );
int k = 0;
for ( int i = startCol; i <= endCol; i++ ) {
C colName = this.getColName( i );
if ( colName != null ) {
returnval.setColumnName( colName, i );
}
for ( int j = 0, m = this.rows(); j < m; j++ ) {
if ( i == startCol ) {
R rowName = this.getRowName( j );
returnval.setRowName( rowName, j );
}
returnval.set( j, k, this.get( j, i ) );
}
k++;
}
return returnval;
}
/*
* (non-Javadoc)
*
* @see basecode.dataStructure.matrix.DoubleMatrixNamed#getColumn(int)
*/
@Override
public double[] getColumn( int col ) {
double[] result = new double[rows()];
for ( int i = 0; i < rows(); i++ ) {
result[i] = get( i, col );
}
return result;
}
@Override
public Double getObject( int row, int col ) {
return new Double( get( row, col ) );
}
/**
* Return a reference to a specific row.
*
* @param row int
* @return double[]
*/
@Override
public double[] getRow( int row ) { |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedSparseDoubleMatrix.java |
146 |
ubic/basecode/dataStructure/matrix/FastRowAccessDoubleMatrix.java |
131 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
138 |
DoubleMatrix<R, C> returnval = new CompressedSparseDoubleMatrix<R, C>( this.rows(), 1 + endCol - startCol );
int k = 0;
for ( int i = startCol; i <= endCol; i++ ) {
C colName = this.getColName( i );
if ( colName != null ) {
returnval.setColumnName( colName, i );
}
for ( int j = 0, m = this.rows(); j < m; j++ ) {
if ( i == startCol ) {
R rowName = this.getRowName( j );
returnval.setRowName( rowName, j );
}
returnval.set( j, k, this.get( j, i ) );
}
k++;
}
return returnval;
}
/*
* (non-Javadoc)
*
* @see basecode.dataStructure.matrix.DoubleMatrixNamed#getColumn(int)
*/
@Override
public double[] getColumn( int col ) {
double[] result = new double[rows()];
for ( int i = 0; i < rows(); i++ ) {
result[i] = get( i, col );
}
return result;
}
@Override
public Double getObject( int row, int col ) {
return new Double( get( row, col ) );
}
/**
* Return a reference to a specific row.
*
* @param row int
* @return double[]
*/
@Override
public double[] getRow( int row ) { |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedSparseDoubleMatrix.java |
242 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
224 |
DoubleMatrix<R, C> returnval = new CompressedSparseDoubleMatrix<R, C>( endRow + 1 - startRow, this.columns() );
int k = 0;
for ( int i = startRow; i <= endRow; i++ ) {
R rowName = this.getRowName( i );
if ( rowName != null ) {
returnval.setRowName( rowName, i );
}
for ( int j = 0, m = this.columns(); j < m; j++ ) {
if ( i == 0 ) {
C colName = this.getColName( j );
returnval.setColumnName( colName, j );
}
returnval.set( k, j, this.get( i, j ) );
}
k++;
}
return returnval;
}
@Override
public boolean isMissing( int i, int j ) {
return Double.isNaN( get( i, j ) );
}
@Override
public int rows() {
return matrix.numRows(); |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedSparseDoubleMatrix.java |
320 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
300 |
DoubleMatrix<R, C> returnval = new CompressedSparseDoubleMatrix<R, C>( rowNames.size(), this.columns() );
int currentRow = 0;
for ( R rowName : rowNames ) {
if ( !this.containsRowName( rowName ) ) continue;
int i = this.getRowIndexByName( rowName );
returnval.setRowName( rowName, currentRow );
for ( int j = 0; j < this.columns(); j++ ) {
if ( currentRow == 0 ) {
returnval.setColumnName( this.getColName( j ), j );
}
returnval.set( currentRow, j, this.get( i, j ) );
}
currentRow++;
}
if ( !returnval.getRowNames().containsAll( rowNames ) ) {
throw new IllegalArgumentException( "Invalid rows to select, some are not in the original matrix" );
}
return returnval;
}
@Override
public DoubleMatrix<C, R> transpose() {
throw new UnsupportedOperationException();
}
/**
*
*/
public void trimToSize() { |
File |
Line |
ubic/basecode/dataStructure/matrix/DenseDoubleMatrix.java |
275 |
ubic/basecode/dataStructure/matrix/FastRowAccessDoubleMatrix.java |
252 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
266 |
return matrix.size();
}
/*
* (non-Javadoc)
*
* @see ubic.basecode.dataStructure.matrix.DoubleMatrix#subsetColumns(java.util.List)
*/
@Override
public DoubleMatrix<R, C> subsetColumns( List<C> columns ) {
DoubleMatrix<R, C> returnval = new DenseDoubleMatrix<R, C>( this.rows(), columns.size() );
returnval.setRowNames( this.getRowNames() );
for ( int i = 0; i < this.rows(); i++ ) {
int currentColumn = 0;
for ( C c : columns ) {
int j = this.getColIndexByName( c );
returnval.set( i, currentColumn, this.get( i, j ) );
if ( i == 0 ) {
returnval.setColumnName( c, currentColumn );
}
currentColumn++;
}
}
return returnval;
}
@Override
public DoubleMatrix<R, C> subsetRows( List<R> rowNames ) {
DoubleMatrix<R, C> returnval = new DenseDoubleMatrix<R, C>( rowNames.size(), this.columns() ); |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedSparseDoubleMatrix.java |
286 |
ubic/basecode/dataStructure/matrix/DenseDoubleMatrix.java |
275 |
ubic/basecode/dataStructure/matrix/FastRowAccessDoubleMatrix.java |
252 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
266 |
return matrix.numColumns() * matrix.numRows();
}
/*
* (non-Javadoc)
*
* @see ubic.basecode.dataStructure.matrix.DoubleMatrix#subsetColumns(java.util.List)
*/
@Override
public DoubleMatrix<R, C> subsetColumns( List<C> columns ) {
DoubleMatrix<R, C> returnval = new DenseDoubleMatrix<R, C>( this.rows(), columns.size() );
returnval.setRowNames( this.getRowNames() );
for ( int i = 0; i < this.rows(); i++ ) {
int currentColumn = 0;
for ( C c : columns ) {
int j = this.getColIndexByName( c );
returnval.set( i, currentColumn, this.get( i, j ) );
if ( i == 0 ) {
returnval.setColumnName( c, currentColumn );
}
currentColumn++;
}
}
return returnval;
}
@Override
public DoubleMatrix<R, C> subsetRows( List<R> rowNames ) {
DoubleMatrix<R, C> returnval = new CompressedSparseDoubleMatrix<R, C>( rowNames.size(), this.columns() ); |
File |
Line |
ubic/basecode/ontology/jena/AbstractOntologyResource.java |
90 |
ubic/basecode/ontology/model/OntologyTermSimple.java |
135 |
return Objects.compare( this, other, comparator );
}
@Override
public boolean equals( Object obj ) {
if ( this == obj ) return true;
if ( obj == null ) return false;
if ( getClass() != obj.getClass() ) return false;
final OntologyResource other = ( OntologyResource ) obj;
if ( getLabel() == null ) {
if ( other.getLabel() != null ) return false;
} else if ( !getLabel().equals( other.getLabel() ) ) return false;
if ( getUri() == null ) {
if ( other.getUri() != null ) return false;
} else if ( !getUri().equals( other.getUri() ) ) return false;
return true;
}
@Override
public int hashCode() {
return Objects.hash( getLabel(), getUri() );
} |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedSparseDoubleMatrix.java |
320 |
ubic/basecode/dataStructure/matrix/FastRowAccessDoubleMatrix.java |
291 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
300 |
DoubleMatrix<R, C> returnval = new CompressedSparseDoubleMatrix<R, C>( rowNames.size(), this.columns() );
int currentRow = 0;
for ( R rowName : rowNames ) {
if ( !this.containsRowName( rowName ) ) continue;
int i = this.getRowIndexByName( rowName );
returnval.setRowName( rowName, currentRow );
for ( int j = 0; j < this.columns(); j++ ) {
if ( currentRow == 0 ) {
returnval.setColumnName( this.getColName( j ), j );
}
returnval.set( currentRow, j, this.get( i, j ) );
}
currentRow++;
}
if ( !returnval.getRowNames().containsAll( rowNames ) ) {
throw new IllegalArgumentException( "Invalid rows to select, some are not in the original matrix" );
}
return returnval;
}
@Override
public DoubleMatrix<C, R> transpose() { |
File |
Line |
ubic/basecode/math/metaanalysis/MeanDifferenceMetaAnalysis.java |
98 |
ubic/basecode/math/metaanalysis/MeanDifferenceMetaAnalysis.java |
124 |
conditionalVariances = cvar.copy();
weights = metaFEWeights( conditionalVariances );
this.q = super.qStatistic( effects, conditionalVariances, super.weightedMean( effects, weights ) );
if ( !fixed ) { // adjust the conditional variances and weights.
this.bsv = metaREVariance( effects, conditionalVariances, weights );
for ( int i = 0; i < conditionalVariances.size(); i++ ) {
conditionalVariances.setQuick( i, conditionalVariances.getQuick( i ) + bsv );
}
weights = metaFEWeights( conditionalVariances );
}
this.e = super.weightedMean( effects, weights );
this.v = super.metaVariance( conditionalVariances );
this.z = Math.abs( e ) / Math.sqrt( v );
this.p = Probability.errorFunctionComplemented( z );
return p;
}
public double run( DoubleArrayList effects, DoubleArrayList controlSizes, DoubleArrayList testSizes ) { |
File |
Line |
ubic/basecode/util/r/AbstractRClient.java |
686 |
ubic/basecode/util/r/AbstractRClient.java |
898 |
Map<String, OneWayAnovaResult> result = new HashMap<String, OneWayAnovaResult>();
try {
RList mainList = rawResult.asList();
if ( mainList == null ) {
return null;
}
log.debug( mainList.size() + " results." );
for ( int i = 0; i < mainList.size(); i++ ) {
REXP anovaTable = mainList.at( i );
String elementIdentifier = mainList.keyAt( i );
assert elementIdentifier != null;
if ( log.isDebugEnabled() ) log.debug( "Key: " + elementIdentifier );
if ( !anovaTable.isList() || !anovaTable.hasAttribute( "row.names" ) ) {
log.debug( "No anovaresult for " + elementIdentifier );
result.put( elementIdentifier, new OneWayAnovaResult() ); |
File |
Line |
ubic/basecode/dataStructure/matrix/IntegerMatrix.java |
144 |
ubic/basecode/dataStructure/matrix/StringMatrix.java |
205 |
}
/**
* @return java.lang.Integer
*/
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append( "label" );
for ( int i = 0; i < columns(); i++ ) {
buf.append( "\t" + getColName( i ) );
}
buf.append( "\n" );
for ( int i = 0; i < rows(); i++ ) {
buf.append( getRowName( i ) );
for ( int j = 0; j < columns(); j++ ) {
buf.append( "\t" + get( i, j ) );
}
buf.append( "\n" );
}
return buf.toString();
} |
File |
Line |
ubic/basecode/math/StringDistance.java |
136 |
ubic/basecode/math/StringDistance.java |
166 |
public static double prefixWeightedHammingDistance( String s, String t, double weight ) {
if ( weight <= 0.0 || weight > 1.0 )
throw new IllegalArgumentException( "weight must be between zero and one" );
String trimmedS = s;
String trimmedT = t;
if ( s.length() != t.length() ) {
if ( s.length() > t.length() ) {
trimmedS = s.substring( 0, t.length() );
} else {
trimmedT = t.substring( 0, s.length() );
}
}
double result = 0;
for ( int i = 0; i < trimmedS.length(); i++ ) {
double penalty = Math.max( 0.0, ( 1.0 - i / ( weight * trimmedS.length() ) ) ); |
File |
Line |
ubic/basecode/dataStructure/matrix/ObjectMatrixImpl.java |
180 |
ubic/basecode/dataStructure/matrix/StringMatrix.java |
198 |
result.set( r, c++, this.get( i, j ) );
}
r++;
}
/*
* FIXME set up the row/column names.
*/
return result;
}
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append( "label" );
for ( int i = 0; i < columns(); i++ ) {
buf.append( "\t" + getColName( i ) );
}
buf.append( "\n" );
for ( int i = 0; i < rows(); i++ ) {
buf.append( getRowName( i ) );
for ( int j = 0; j < columns(); j++ ) { |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedSparseDoubleMatrix.java |
156 |
ubic/basecode/dataStructure/matrix/DenseDoubleMatrix.java |
142 |
returnval.setRowName( rowName, j );
}
returnval.set( j, k, this.get( j, i ) );
}
k++;
}
return returnval;
}
/*
* (non-Javadoc)
*
* @see basecode.dataStructure.matrix.DoubleMatrixNamed#getColumn(int)
*/
@Override
public double[] getColumn( int col ) {
double[] result = new double[rows()];
for ( int i = 0; i < rows(); i++ ) {
result[i] = get( i, col );
}
return result;
}
@Override
public Double getObject( int row, int col ) {
return new Double( get( row, col ) );
}
/**
* Return a reference to a specific row.
*
* @param row int
* @return double[]
*/
@Override
public double[] getRow( int row ) { |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedSparseDoubleMatrix.java |
103 |
ubic/basecode/dataStructure/matrix/FastRowAccessDoubleMatrix.java |
97 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
100 |
DoubleMatrix<R, C> returnval = new CompressedSparseDoubleMatrix<R, C>( this.rows(), this.columns() );
for ( int i = 0; i < this.rows(); i++ ) {
returnval.setRowName( this.getRowName( i ), i );
for ( int j = 0; j < this.columns(); j++ ) {
if ( i == 0 ) {
returnval.setColumnName( this.getColName( j ), j );
}
returnval.set( i, j, this.get( i, j ) );
}
}
return returnval;
}
/**
* @param row
* @param column
* @return
*/
@Override
public double get( int row, int column ) { |
File |
Line |
ubic/basecode/dataStructure/matrix/DenseDoubleMatrix.java |
142 |
ubic/basecode/dataStructure/matrix/FastRowAccessDoubleMatrix.java |
141 |
if ( rowName != null ) returnval.addRowName( rowName );
}
returnval.set( j, k, this.get( j, i ) );
}
k++;
}
return returnval;
}
/*
* (non-Javadoc)
*
* @see basecode.dataStructure.matrix.DoubleMatrixNamed#getColumn(int)
*/
@Override
public double[] getColumn( int col ) {
double[] result = new double[rows()];
for ( int i = 0; i < rows(); i++ ) {
result[i] = get( i, col );
}
return result;
}
/**
* Converts to a String that can be read by read.table in R, using default parameters
*
* @return java.lang.String
*/
/*
* public String toRReadTableString() { Format nf = new Format( "%.4g" ); StringBuffer result = new StringBuffer(
* this.rows() * this.columns() ); if ( this.hasColNames() ) { for ( int i = 0; i < this.columns(); i++ ) {
* result.append( "\"" + this.getColName( i ) +"\" "); System.out.println("\"" + this.getColName( i ) +"\" "); }
* result.append( "\n" ); } for ( int i = 0; i < this.rows(); i++ ) { if ( this.hasRowNames() ) { result.append("\""
* + this.getRowName( i ) + "\"" ); } for ( int j = 0; j < this.columns(); j++ ) { if ( Double.isNaN( this.get( i, j
* ) ) ) { result.append( " NA" ); } else { result.append( " " + nf.format( this.get( i, j ) ) ); } } result.append(
* "\n" ); } return result.toString(); }
*/
@Override
public Double getObject( int row, int col ) {
return new Double( get( row, col ) );
}
/**
* Return a reference to a specific row.
*
* @param row int
* @return double[]
*/
@Override
public double[] getRow( int row ) { |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedSparseDoubleMatrix.java |
242 |
ubic/basecode/dataStructure/matrix/FastRowAccessDoubleMatrix.java |
208 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
224 |
DoubleMatrix<R, C> returnval = new CompressedSparseDoubleMatrix<R, C>( endRow + 1 - startRow, this.columns() );
int k = 0;
for ( int i = startRow; i <= endRow; i++ ) {
R rowName = this.getRowName( i );
if ( rowName != null ) {
returnval.setRowName( rowName, i );
}
for ( int j = 0, m = this.columns(); j < m; j++ ) {
if ( i == 0 ) {
C colName = this.getColName( j );
returnval.setColumnName( colName, j );
} |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedSparseDoubleMatrix.java |
297 |
ubic/basecode/dataStructure/matrix/DenseDoubleMatrix.java |
286 |
ubic/basecode/dataStructure/matrix/FastRowAccessDoubleMatrix.java |
263 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
277 |
ubic/basecode/dataStructure/matrix/StringMatrix.java |
42 |
DoubleMatrix<R, C> returnval = new DenseDoubleMatrix<R, C>( this.rows(), columns.size() );
returnval.setRowNames( this.getRowNames() );
for ( int i = 0; i < this.rows(); i++ ) {
int currentColumn = 0;
for ( C c : columns ) {
int j = this.getColIndexByName( c );
returnval.set( i, currentColumn, this.get( i, j ) );
if ( i == 0 ) {
returnval.setColumnName( c, currentColumn );
}
currentColumn++;
}
}
return returnval;
} |
File |
Line |
ubic/basecode/math/linearmodels/LeastSquaresFit.java |
1310 |
ubic/basecode/math/linearmodels/LeastSquaresFit.java |
1581 |
assert this.assign.isEmpty() || this.assign.size() == this.coefficients.rows() : assign.size()
+ " != # coefficients " + this.coefficients.rows();
assert this.coefficients.rows() == A.columns();
// It is somewhat wasteful to hold on to this.
this.fitted = solver.transpose(MatrixUtil.multWithMissing(A, coefficients));
if (this.hasMissing) {
MatrixUtil.maskMissing(b, fitted);
}
this.residuals = b.copy().assign(fitted, Functions.minus);
} |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedSparseDoubleMatrix.java |
297 |
ubic/basecode/dataStructure/matrix/DenseDoubleMatrix.java |
286 |
ubic/basecode/dataStructure/matrix/FastRowAccessDoubleMatrix.java |
263 |
ubic/basecode/dataStructure/matrix/ObjectMatrixImpl.java |
48 |
ubic/basecode/dataStructure/matrix/SparseDoubleMatrix.java |
277 |
DoubleMatrix<R, C> returnval = new DenseDoubleMatrix<R, C>( this.rows(), columns.size() );
returnval.setRowNames( this.getRowNames() );
for ( int i = 0; i < this.rows(); i++ ) {
int currentColumn = 0;
for ( C c : columns ) {
int j = this.getColIndexByName( c );
returnval.set( i, currentColumn, this.get( i, j ) );
if ( i == 0 ) {
returnval.setColumnName( c, currentColumn );
}
currentColumn++;
}
}
return returnval;
}
@Override
public DoubleMatrix<R, C> subsetRows( List<R> rowNames ) { |
File |
Line |
ubic/basecode/dataStructure/matrix/ObjectMatrixImpl.java |
48 |
ubic/basecode/dataStructure/matrix/StringMatrix.java |
42 |
ObjectMatrixImpl<R, C, V> returnval = new ObjectMatrixImpl<R, C, V>( this.rows(), columns.size() );
returnval.setRowNames( this.getRowNames() );
for ( int i = 0; i < this.rows(); i++ ) {
int currentColumn = 0;
for ( C c : columns ) {
int j = this.getColIndexByName( c );
returnval.set( i, currentColumn, this.get( i, j ) );
if ( i == 0 ) {
returnval.setColumnName( c, currentColumn );
}
currentColumn++;
}
}
return returnval;
} |
File |
Line |
ubic/basecode/dataStructure/matrix/CompressedBitMatrix.java |
290 |
ubic/basecode/dataStructure/matrix/CompressedBitMatrix.java |
431 |
public void set( int row, int col, int index ) {
if ( index >= this.totalBitsPerItem || row > this.rows || col > this.cols ) {
throw new ArrayIndexOutOfBoundsException( "Attempt to access row=" + row + " col=" + col + " index="
+ index );
}
/*
* We can only fit BITS_PER_ELEMENT values in each matrix cell. If num > 0, we have multiple 'stacked' matrices.
*/
int num = ( int ) Math.floor( ( double ) index / BITS_PER_ELEMENT );
assert num >= 0 && num < matrix.length;
int whichBitToSet = index % BITS_PER_ELEMENT;
long currentValue = Double.doubleToRawLongBits( matrix[num].get( row, col ) ); |
File |
Line |
ubic/basecode/datafilter/RowAbsentFilter.java |
136 |
ubic/basecode/datafilter/RowNameFilter.java |
91 |
rowNames.add( rowName );
kept++;
}
}
M returnval = getOutputMatrix( data, MTemp.size(), numCols );
for ( int i = 0; i < MTemp.size(); i++ ) {
for ( int j = 0; j < numCols; j++ ) {
returnval.set( i, j, MTemp.get( i )[j] );
}
}
returnval.setColumnNames( data.getColNames() );
returnval.setRowNames( rowNames );
log.info( "There are " + kept + " rows left after filtering." );
return returnval;
}
/**
* @param f the matrix containing the flags.
*/
public void setFlagMatrix( StringMatrix<R, C> f ) { |