当前位置: 首页>>代码示例>>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;未经允许,请勿转载。