本文整理了Java中org.ujmp.core.Matrix.getRowCount()
方法的一些代码示例,展示了Matrix.getRowCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.getRowCount()
方法的具体详情如下:
包路径:org.ujmp.core.Matrix
类名称:Matrix
方法名:getRowCount
暂无
代码示例来源:origin: ujmp/universal-java-matrix-package
public static double recallMacro(Matrix confusionMatrix) {
VerifyUtil.verifySquare(confusionMatrix);
double sum = 0;
for (int catIndex = 0; catIndex < confusionMatrix.getRowCount(); catIndex++) {
sum += recall(confusionMatrix, catIndex);
}
return sum / confusionMatrix.getRowCount();
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public static double f1MeasureMacro(Matrix confusionMatrix) {
VerifyUtil.verifySquare(confusionMatrix);
double sum = 0;
for (int catIndex = 0; catIndex < confusionMatrix.getRowCount(); catIndex++) {
sum += f1Measure(confusionMatrix, catIndex);
}
return sum / confusionMatrix.getRowCount();
}
代码示例来源:origin: ujmp/universal-java-matrix-package
/**
* Constructor which takes an existing Matrix to copy data and structure
* from. <br>
* Block stripe size will be defaulted internally.
*
* @param m
* - matrix to copy data from.
*/
public BlockDenseDoubleMatrix2D(Matrix m) {
this(m, deriveDefaultBlockStripeSize((int) m.getRowCount(), (int) m.getColumnCount()));
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public void addEvent(long timestamp, Matrix value) {
if (value.getRowCount() != 1) {
throw new RuntimeException("matrix cannot have more than one row");
}
for (int id = 0; id < value.getColumnCount(); id++) {
addEvent(timestamp, id + 1, value.getAsDouble(0, id));
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public final Matrix solve(Matrix source, Matrix b) {
if (source.getRowCount() >= source.getColumnCount()) {
QRMatrix qr = new QRMatrix(source);
return qr.solve(b);
} else {
throw new RuntimeException("only matrices m>=n are allowed");
}
}
};
代码示例来源:origin: ujmp/universal-java-matrix-package
public Object getObject(long... coordinates) {
if (selection == null) {
List<Integer> rows = new ArrayList<Integer>();
for (int i = 0; i < count; i++) {
int s = MathUtil.nextInteger(0, (int) getSource().getRowCount());
rows.add(s);
}
selection = getSource().selectRows(Ret.LINK, rows);
}
return selection.getAsObject(coordinates);
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public ValueToColumn(Matrix matrix) {
super(matrix);
if (matrix.getColumnCount() != 1) {
throw new RuntimeException("matrix must have one column");
}
for (long[] c : getSource().availableCoordinates()) {
max = Math.max(max, getSource().getAsInt(c));
}
this.size = new long[] { getSource().getRowCount(), max + 1 };
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public long[] getSize() {
switch (getDimension()) {
case ROW:
return new long[] { 1, getSource().getColumnCount() };
case COLUMN:
return new long[] { getSource().getRowCount(), 1 };
default:
return new long[] { 1, 1 };
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
private boolean containsMissingValues(long c) {
for (int r = 0; r < getSource().getRowCount(); r++) {
if (MathUtil.isNaNOrInfinite(getSource().getAsDouble(r, c))) {
return true;
}
}
return false;
}
代码示例来源:origin: org.ujmp/ujmp-jama
public JamaDenseDoubleMatrix2D(Matrix source) {
super(source.getRowCount(), source.getColumnCount());
this.matrix = new Jama.Matrix((int) source.getRowCount(), (int) source.getColumnCount());
for (long[] c : source.availableCoordinates()) {
setDouble(source.getAsDouble(c), c);
}
if (source.getMetaData() != null) {
setMetaData(source.getMetaData().clone());
}
}
代码示例来源:origin: org.ujmp/ujmp-colt
public ColtDenseDoubleMatrix2D(Matrix source) {
super(source.getRowCount(), source.getColumnCount());
this.matrix = new DenseDoubleMatrix2D((int) source.getRowCount(), (int) source.getColumnCount());
for (long[] c : source.availableCoordinates()) {
setDouble(source.getAsDouble(c), c);
}
if (source.getMetaData() != null) {
setMetaData(source.getMetaData().clone());
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public JamaDenseDoubleMatrix2D(Matrix source) {
super(source.getRowCount(), source.getColumnCount());
this.matrix = new Jama.Matrix((int) source.getRowCount(), (int) source.getColumnCount());
for (long[] c : source.availableCoordinates()) {
setDouble(source.getAsDouble(c), c);
}
if (source.getMetaData() != null) {
setMetaData(source.getMetaData().clone());
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public La4JDenseDoubleMatrix2D(Matrix source) {
super(source.getRowCount(), source.getColumnCount());
this.matrix = new Basic2DMatrix((int) source.getRowCount(), (int) source.getColumnCount());
for (long[] c : source.availableCoordinates()) {
setDouble(source.getAsDouble(c), c);
}
if (source.getMetaData() != null) {
setMetaData(source.getMetaData().clone());
}
}
代码示例来源:origin: org.ujmp/ujmp-colt
public ColtSparseDoubleMatrix2D(Matrix source) {
super(source.getRowCount(), source.getColumnCount());
this.matrix = new SparseDoubleMatrix2D((int) source.getRowCount(), (int) source.getColumnCount());
for (long[] c : source.availableCoordinates()) {
setDouble(source.getAsDouble(c), c);
}
if (source.getMetaData() != null) {
setMetaData(source.getMetaData().clone());
}
}
代码示例来源:origin: org.ujmp/ujmp-la4j
public La4JDenseDoubleMatrix2D(Matrix source) {
super(source.getRowCount(), source.getColumnCount());
this.matrix = new Basic2DMatrix((int) source.getRowCount(), (int) source.getColumnCount());
for (long[] c : source.availableCoordinates()) {
setDouble(source.getAsDouble(c), c);
}
if (source.getMetaData() != null) {
setMetaData(source.getMetaData().clone());
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public final static void setRandnSymmetric(Matrix a) {
Random random = new Random();
int rows = (int) a.getRowCount();
int cols = (int) a.getColumnCount();
for (int r = 0; r < rows; r++) {
for (int c = 0; c < cols && c <= r; c++) {
double f = random.nextGaussian();
a.setAsDouble(f, r, c);
a.setAsDouble(f, c, r);
}
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public ArrayDenseStringMatrix2D(Matrix source) {
this(MathUtil.longToInt(source.getRowCount()), MathUtil.longToInt(source.getColumnCount()));
for (long[] c : source.availableCoordinates()) {
setAsString(source.getAsString(c), c);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public static <M extends Matrix> Callable<M> createBlockMultiplier(final M a, final M b) {
Callable<M> run = createMultiplier(a, b);
Callable<M> multiplyTimer = new TimerDecorator<M>(a.getRowCount(), a.getColumnCount(),
b.getColumnCount(), run);
return multiplyTimer;
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public VecMathDenseDoubleMatrix2D(Matrix source) {
this(MathUtil.longToInt(source.getRowCount()), MathUtil.longToInt(source.getColumnCount()));
for (long[] c : source.availableCoordinates()) {
setAsDouble(source.getAsDouble(c), c);
}
if (source.getMetaData() != null) {
setMetaData(source.getMetaData().clone());
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testDeleteRow0() {
Matrix m = getMatrix();
m = m.deleteRows(Ret.NEW, 0);
assertEquals(4, m.getRowCount());
assertEquals(5, m.getColumnCount());
assertEquals(1, m.getAsLong(0, 0));
assertEquals(2, m.getAsLong(0, 1));
assertEquals(1, m.getAsLong(1, 0));
}
内容来源于网络,如有侵权,请联系作者删除!