當前位置: 首頁>>代碼示例>>Java>>正文


Java FlexCompColMatrix類代碼示例

本文整理匯總了Java中no.uib.cipr.matrix.sparse.FlexCompColMatrix的典型用法代碼示例。如果您正苦於以下問題:Java FlexCompColMatrix類的具體用法?Java FlexCompColMatrix怎麽用?Java FlexCompColMatrix使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FlexCompColMatrix類屬於no.uib.cipr.matrix.sparse包,在下文中一共展示了FlexCompColMatrix類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fastsparseminusEquals

import no.uib.cipr.matrix.sparse.FlexCompColMatrix; //導入依賴的package包/類
/**
 * @param A
 * @param B
 * @return A - B
 */
public static Matrix fastsparseminusEquals(SparseColumnMatrix A, SparseColumnMatrix B) {
	if (A.getNumColumns() != B.getNumColumns() || A.getNumRows() != B.getNumRows()) {
		throw new DimensionalityMismatchException();
	}
	final SparseColumnMatrix ret = A;

	final FlexCompColMatrix retint = ret.getInternalMatrix();
	final FlexCompColMatrix Bint = B.getInternalMatrix();
	for (int i = 0; i < A.getNumColumns(); i++) {
		final no.uib.cipr.matrix.sparse.SparseVector aCol = retint.getColumn(i);
		final no.uib.cipr.matrix.sparse.SparseVector bCol = Bint.getColumn(i);
		aCol.add(-1, bCol);
	}
	return ret;
}
 
開發者ID:openimaj,項目名稱:openimaj,代碼行數:21,代碼來源:CFMatrixUtils.java

示例2: SparseColumnMatrix

import no.uib.cipr.matrix.sparse.FlexCompColMatrix; //導入依賴的package包/類
/**
 * Creates a new empty instance of SparseColumnMatrix.
 * 
 * @param numRows Number of rows in the matrix.
 * @param numColumns Number of columns in the matrix.
 */
protected SparseColumnMatrix(
    int numRows,
    int numColumns )
{
    this( new no.uib.cipr.matrix.sparse.FlexCompColMatrix(
        numRows, numColumns ) );


    if (numRows < 0)
    {
        throw new IllegalArgumentException( "Num rows must be >= 0" );
    }
    if (numColumns < 0)
    {
        throw new IllegalArgumentException( "Num columns must be >= 0" );
    }

}
 
開發者ID:algorithmfoundry,項目名稱:Foundry,代碼行數:25,代碼來源:SparseColumnMatrix.java

示例3: readObject

import no.uib.cipr.matrix.sparse.FlexCompColMatrix; //導入依賴的package包/類
/**
 * Custom deserialization is needed.
 *
 * @param in The ObjectInputStream to deseralize from.
 * @throws java.io.IOException If there is an error with the stream.
 * @throws java.lang.ClassNotFoundException If a class used by this one 
 *         cannot be found.
 */
private void readObject(
    ObjectInputStream in )
    throws IOException, ClassNotFoundException
{
    // Do the default stuff.
    in.defaultReadObject();

    // Read the meta-data.
    int numRows = in.readInt();
    int numCols = in.readInt();

    // Set the internal matrix.
    this.setInternalMatrix( new FlexCompColMatrix( numRows, numCols ) );

    // Read the rows.
    for (int i = 0; i < numCols; i++)
    {
        SparseVector col = (SparseVector) in.readObject();
        this.setColumn( i, col );
    }

}
 
開發者ID:algorithmfoundry,項目名稱:Foundry,代碼行數:31,代碼來源:SparseColumnMatrix.java

示例4: asSparseColumn

import no.uib.cipr.matrix.sparse.FlexCompColMatrix; //導入依賴的package包/類
/**
 * @param a
 * @return turns the provided matrix into a {@link SparseColumnMatrix}
 */
public static SparseColumnMatrix asSparseColumn(Matrix a) {
	return SparseMatrixFactoryMTJ.INSTANCE.createWrapper(
			new FlexCompColMatrix(
					SparseMatrixFactoryMTJ.INSTANCE.copyMatrix(a).getInternalMatrix()
			)
			);
}
 
開發者ID:openimaj,項目名稱:openimaj,代碼行數:12,代碼來源:CFMatrixUtils.java

示例5: getEntryCount

import no.uib.cipr.matrix.sparse.FlexCompColMatrix; //導入依賴的package包/類
@Override
public int getEntryCount()
{
    final FlexCompColMatrix m = this.getInternalMatrix();
    final int columnCount = this.getNumColumns();
    int result = 0;
    for (int i = 0; i < columnCount; i++)
    {
        result += m.getColumn(i).getUsed();
    }
    return result;
}
 
開發者ID:algorithmfoundry,項目名稱:Foundry,代碼行數:13,代碼來源:SparseColumnMatrix.java

示例6: getInternalMatrix

import no.uib.cipr.matrix.sparse.FlexCompColMatrix; //導入依賴的package包/類
@Override
public FlexCompColMatrix getInternalMatrix()
{
    return (FlexCompColMatrix) super.getInternalMatrix();
}
 
開發者ID:algorithmfoundry,項目名稱:Foundry,代碼行數:6,代碼來源:SparseColumnMatrix.java

示例7: randomSparseCol

import no.uib.cipr.matrix.sparse.FlexCompColMatrix; //導入依賴的package包/類
/**
 * Create a random {@link SparseColumnMatrix}
 * 
 * @param rows
 *            number of rows
 * @param cols
 *            number of columns
 * @param min
 *            the minimum value
 * @param max
 *            the maximum value
 * @param density
 *            the matrix density
 * @param random
 *            the RNG
 * @return the random matrix
 */
public static SparseColumnMatrix randomSparseCol(int rows, int cols, double min, double max, double density,
		Random random)
{
	final SparseColumnMatrix ret = SparseMatrixFactoryMTJ.INSTANCE.createWrapper(new FlexCompColMatrix(rows, cols));
	for (int i = 0; i < cols; i++) {
		final Vector v = ret.getColumn(i);
		for (int j = 0; j < rows; j++) {
			if (random.nextDouble() <= density) {
				v.setElement(j, random.nextDouble() * (max - min) + min);
			}
		}
	}
	return ret;
}
 
開發者ID:openimaj,項目名稱:openimaj,代碼行數:32,代碼來源:CFMatrixUtils.java


注:本文中的no.uib.cipr.matrix.sparse.FlexCompColMatrix類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。