本文整理了Java中org.ujmp.core.Matrix.minus()
方法的一些代码示例,展示了Matrix.minus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.minus()
方法的具体详情如下:
包路径:org.ujmp.core.Matrix
类名称:Matrix
方法名:minus
暂无
代码示例来源:origin: ujmp/universal-java-matrix-package
public static double difference(Matrix m1, Matrix m2) {
Matrix d = m1.minus(m2);
// return normF(d).doubleValue();
return d.normF();
}
代码示例来源:origin: jdmp/java-data-mining-package
public double getDensityUnscaled(Matrix input) {
Matrix xmean = input.minus(meanMatrix);
Matrix matrix = xmean.mtimes(inverse).mtimes(xmean.transpose());
return Math.exp(-0.5 * matrix.doubleValue());
}
代码示例来源:origin: jdmp/java-data-mining-package
public static double getDensity(Matrix x, Matrix mean, Matrix covariance) {
Matrix xmean = x.minus(mean);
Matrix inverse = covariance.inv();
double f = 1.0 / Math.sqrt(covariance.det() * Math.pow(2.0 * Math.PI, x.getColumnCount()));
Matrix matrix = xmean.mtimes(inverse).mtimes(xmean.transpose());
return f * Math.exp(-0.5 * matrix.doubleValue());
}
代码示例来源:origin: jdmp/java-data-mining-package
public static double getDensityUnscaled(Matrix x, Matrix mean, Matrix covariance) {
Matrix xmean = x.minus(mean);
Matrix inverse = covariance.inv();
Matrix matrix = xmean.mtimes(inverse).mtimes(xmean.transpose());
return Math.exp(-0.5 * matrix.doubleValue());
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testMinusScalarSmall() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(11, 10);
double ref2 = MathUtil.nextDouble();
Matrix ref3 = ref1.minus(Ret.LINK, true, ref2);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m3 = m1.minus(ref2);
assertEquals(mclass.toString(), 0.0, ref3.minus(m3).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public Object call() {
Matrix m = getMatrixObject().getMatrix().minus(getRet(), getIgnoreMissing(),
GUIUtil.getDouble("Value to subtract", -Double.MAX_VALUE, Double.MAX_VALUE));
return m;
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testMinusMatrixSmall() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(11, 10);
Matrix ref2 = DenseDoubleMatrix2D.Factory.randn(11, 10);
Matrix ref3 = ref1.minus(Ret.LINK, true, ref2);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m2 = getMatrix(mclass, ref2);
Matrix m3 = m1.minus(m2);
assertEquals(mclass.toString(), 0.0, ref3.minus(m3).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testMinusMatrixLarge() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(101, 100);
Matrix ref2 = DenseDoubleMatrix2D.Factory.randn(101, 100);
Matrix ref3 = ref1.minus(Ret.LINK, true, ref2);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m2 = getMatrix(mclass, ref2);
Matrix m3 = m1.minus(m2);
assertEquals(mclass.toString(), 0.0, ref3.minus(m3).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testTransposeSmallTall() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(15, 10);
Matrix ref2 = ref1.transpose(Ret.LINK);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m2 = m1.transpose();
assertEquals(mclass.toString(), 0.0, ref2.minus(m2).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testTransposeLargeSquare() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(101, 101);
Matrix ref2 = ref1.transpose(Ret.LINK);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m2 = m1.transpose();
assertEquals(mclass.toString(), 0.0, ref2.minus(m2).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testTransposeSmallSquare() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(10, 10);
Matrix ref2 = ref1.transpose(Ret.LINK);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m2 = m1.transpose();
assertEquals(mclass.toString(), 0.0, ref2.minus(m2).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testTransposeLargeTall() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(101, 100);
Matrix ref2 = ref1.transpose(Ret.LINK);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m2 = m1.transpose();
assertEquals(mclass.toString(), 0.0, ref2.minus(m2).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testTransposeSmallWide() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(10, 15);
Matrix ref2 = ref1.transpose(Ret.LINK);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m2 = m1.transpose();
assertEquals(mclass.toString(), 0.0, ref2.minus(m2).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testPlusScalarSmall() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(11, 10);
double ref2 = MathUtil.nextDouble();
Matrix ref3 = ref1.plus(Ret.LINK, true, ref2);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m3 = m1.plus(ref2);
Matrix delta = ref3.minus(m3);
assertEquals(mclass.toString(), 0.0, delta.getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testTimesScalarSmall() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(11, 10);
double ref2 = MathUtil.nextDouble();
Matrix ref3 = ref1.times(Ret.LINK, true, ref2);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m3 = m1.times(ref2);
assertEquals(mclass.toString(), 0.0, ref3.minus(m3).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testPlusScalarLarge() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(101, 100);
double ref2 = MathUtil.nextDouble();
Matrix ref3 = ref1.plus(Ret.LINK, true, ref2);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m3 = m1.plus(ref2);
assertEquals(mclass.toString(), 0.0, ref3.minus(m3).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testDivideScalarSmall() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(11, 10);
double ref2 = MathUtil.nextDouble();
Matrix ref3 = ref1.divide(Ret.LINK, true, ref2);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m3 = m1.divide(ref2);
assertEquals(mclass.toString(), 0.0, ref3.minus(m3).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testDivideScalarLarge() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(101, 100);
double ref2 = MathUtil.nextDouble();
Matrix ref3 = ref1.divide(Ret.LINK, true, ref2);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m3 = m1.divide(ref2);
assertEquals(mclass.toString(), 0.0, ref3.minus(m3).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testDivideMatrixSmall() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(11, 10);
Matrix ref2 = DenseDoubleMatrix2D.Factory.randn(11, 10);
Matrix ref3 = ref1.divide(Ret.LINK, true, ref2);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m2 = getMatrix(mclass, ref2);
Matrix m3 = m1.divide(m2);
assertEquals(mclass.toString(), 0.0, ref3.minus(m3).getRMS(), TOLERANCE);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public void testPlusMatrixSmall() throws Exception {
Matrix ref1 = DenseDoubleMatrix2D.Factory.randn(11, 10);
Matrix ref2 = DenseDoubleMatrix2D.Factory.randn(11, 10);
Matrix ref3 = ref1.plus(Ret.LINK, true, ref2);
for (Class<? extends Matrix> mclass : ALLFLOATMATRIXCLASSES) {
Matrix m1 = getMatrix(mclass, ref1);
Matrix m2 = getMatrix(mclass, ref2);
Matrix m3 = m1.plus(m2);
assertEquals(mclass.toString(), 0.0, ref3.minus(m3).getRMS(), TOLERANCE);
}
}
内容来源于网络,如有侵权,请联系作者删除!