本文整理了Java中org.ujmp.core.Matrix.getDimensionCount()
方法的一些代码示例,展示了Matrix.getDimensionCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.getDimensionCount()
方法的具体详情如下:
包路径:org.ujmp.core.Matrix
类名称:Matrix
方法名:getDimensionCount
暂无
代码示例来源:origin: ujmp/universal-java-matrix-package
public static final void verify2D(Matrix m) {
verifyNotNull(m, "matrix cannot be null");
verifyEquals(m.getDimensionCount(), 2, "matrix is not 2d");
}
代码示例来源:origin: ujmp/universal-java-matrix-package
long[] cursor = new long[m.getDimensionCount()];
if (m.getDimensionCount() > 2) {
toAppendTo.append(m.getDimensionCount());
toAppendTo.append("D-Matrix [");
toAppendTo.append(Coordinates.toString("x", m.getSize()));
代码示例来源:origin: ujmp/universal-java-matrix-package
VerifyUtil.verifyNotNull(m0, "matrix is null");
VerifyUtil.verifyNotNull(m1, "matrix is null");
VerifyUtil.verifyEquals(m0.getDimensionCount(), m1.getDimensionCount(),
"matrices have different dimensionality");
if (dimension > matrices[0].getDimensionCount() + 1) {
throw new IllegalArgumentException("too many dimensions");
if (dimension > matrices[0].getDimensionCount()) {
long[] oldSize = matrices[0].getSize();
long[] newSize = new long[oldSize.length + 1];
setMetaData(annotation);
annotation.put(Matrix.LABEL, matrices[0].getLabelObject());
for (int d = 0; d < matrices[0].getDimensionCount(); d++) {
if (d == dimension) {
annotation.put(Matrix.DIMENSIONMETADATA + d,
代码示例来源:origin: ujmp/universal-java-matrix-package
public final Matrix calc(Matrix source) {
if (source.getDimensionCount() != 2 || source.getRowCount() != source.getColumnCount()) {
throw new RuntimeException(
"inverse only possible for square matrices. use pinv or ginv instead");
}
if (UJMPSettings.getInstance().getNumberOfThreads() == 1) {
if (source.getRowCount() >= THRESHOLD && source.getColumnCount() >= THRESHOLD) {
return MATRIXLARGESINGLETHREADED.calc(source);
} else {
return MATRIXSMALLSINGLETHREADED.calc(source);
}
} else {
if (source.getRowCount() >= THRESHOLD && source.getColumnCount() >= THRESHOLD) {
return MATRIXLARGEMULTITHREADED.calc(source);
} else {
return MATRIXSMALLMULTITHREADED.calc(source);
}
}
}
};
代码示例来源:origin: ujmp/universal-java-matrix-package
public final Matrix calcOrig() {
Matrix m = getSource();
if (m.getDimensionCount() > 2) {
throw new RuntimeException("ORIG works only for 2d matrices, use LINK or COPY instead");
}
if (getDimension() == Matrix.ROW) {
long length = m.getColumnCount();
for (long i = 0; i < length; i++) {
Object temp = m.getAsObject(pos1, i);
m.setAsObject(m.getAsObject(pos2, i), pos1, i);
m.setAsObject(temp, pos2, i);
}
} else if (getDimension() == Matrix.COLUMN) {
long length = m.getRowCount();
for (long i = 0; i < length; i++) {
Object temp = m.getAsObject(i, pos1);
m.setAsObject(m.getAsObject(i, pos2), i, pos1);
m.setAsObject(temp, i, pos2);
}
} else {
throw new RuntimeException("this only works for rows or columns");
}
return getSource();
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public final Matrix calc(Matrix source) {
if (source.getDimensionCount() != 2 || source.getRowCount() != source.getColumnCount()) {
throw new RuntimeException(
"inverse only possible for square matrices. use pinv or ginv instead");
}
if (UJMPSettings.getInstance().getNumberOfThreads() == 1) {
if (source.getRowCount() >= THRESHOLD && source.getColumnCount() >= THRESHOLD) {
return MATRIXLARGESINGLETHREADED.calc(source);
} else {
return MATRIXSMALLSINGLETHREADED.calc(source);
}
} else {
if (source.getRowCount() >= THRESHOLD && source.getColumnCount() >= THRESHOLD) {
return MATRIXLARGEMULTITHREADED.calc(source);
} else {
return MATRIXSMALLMULTITHREADED.calc(source);
}
}
}
};
代码示例来源:origin: ujmp/universal-java-matrix-package
public final Matrix calc(Matrix source) {
if (source.getDimensionCount() != 2 || source.getRowCount() != source.getColumnCount()) {
throw new RuntimeException(
"inverse only possible for square matrices. use pinv or ginv instead");
}
if (UJMPSettings.getInstance().getNumberOfThreads() == 1) {
if (source.getRowCount() >= THRESHOLD && source.getColumnCount() >= THRESHOLD) {
return MATRIXLARGESINGLETHREADED.calc(source);
} else {
return MATRIXSMALLSINGLETHREADED.calc(source);
}
} else {
if (source.getRowCount() >= THRESHOLD && source.getColumnCount() >= THRESHOLD) {
return MATRIXLARGEMULTITHREADED.calc(source);
} else {
return MATRIXSMALLMULTITHREADED.calc(source);
}
}
}
};
代码示例来源:origin: ujmp/universal-java-matrix-package
private void createAnnotation() {
if (getSource().getDimensionCount() != 2) {
throw new RuntimeException("only supported for 2d matrices");
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testUJMP() {
Matrix original = Matrix.Factory.rand(3, 4, 5);
MLDenseDoubleMatrix mlDouble = new MLDenseDoubleMatrix(original);
assertEquals("dimension count", original.getDimensionCount(), mlDouble.getDimensionCount());
assertEquals("row count", original.getRowCount(), mlDouble.getRowCount());
assertEquals("column count", original.getColumnCount(), mlDouble.getColumnCount());
assertTrue("content equals", original.equalsContent(mlDouble));
}
内容来源于网络,如有侵权,请联系作者删除!