本文整理了Java中org.ujmp.core.Matrix.inv()
方法的一些代码示例,展示了Matrix.inv()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.inv()
方法的具体详情如下:
包路径:org.ujmp.core.Matrix
类名称:Matrix
方法名:inv
暂无
代码示例来源:origin: jdmp/java-data-mining-package
public Map<String, Object> calculateObjects(Map<String, Object> input) {
Map<String, Object> result = new HashMap<String, Object>();
Matrix source = MathUtil.getMatrix(input.get(SOURCE));
Matrix target = source.inv();
result.put(TARGET, target);
return result;
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public Object call() {
Matrix result = getMatrixObject().getMatrix().inv();
return result;
}
代码示例来源: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: 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: ujmp/universal-java-matrix-package
ref1.setAsDouble(7.0, 1, 2);
ref1.setAsDouble(1.0, 2, 2);
Matrix ref2 = ref1.inv();
Matrix m2 = m1.inv();
Matrix m3 = m1.pinv();
Matrix m4 = m1.ginv();
代码示例来源:origin: jdmp/java-data-mining-package
public void trainAll(ListDataSet dataSet) {
featureCount = getFeatureCount(dataSet);
classCount = getClassCount(dataSet);
dimensions = featureCount + classCount;
Matrix x = Matrix.Factory.zeros(dataSet.size(), dimensions);
int i = 0;
for (Sample s : dataSet) {
Matrix input = s.getAsMatrix(getInputLabel()).toColumnVector(Ret.LINK);
for (int c = 0; c < featureCount; c++) {
x.setAsDouble(input.getAsDouble(0, c), i, c);
}
Matrix target = s.getAsMatrix(getTargetLabel()).toColumnVector(Ret.LINK);
for (int c = 0; c < classCount; c++) {
x.setAsDouble(target.getAsDouble(0, c), i, c + featureCount);
}
i++;
}
meanMatrix = x.mean(Ret.NEW, Matrix.ROW, true);
covarianceMatrix = x.cov(Ret.NEW, true, true);
try {
inverse = covarianceMatrix.inv();
factor = 1.0 / Math.sqrt(covarianceMatrix.det() * Math.pow(2.0 * Math.PI, dimensions));
} catch (Exception e) {
inverse = covarianceMatrix.pinv();
factor = 1.0;
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
Matrix scaled = dense.times(2.0);
Matrix inverse = dense.inv();
Matrix pseudoInverse = dense.pinv();
double determinant = dense.det();
代码示例来源:origin: org.ujmp/ujmp-examples
Matrix scaled = dense.times(2.0);
Matrix inverse = dense.inv();
Matrix pseudoInverse = dense.pinv();
double determinant = dense.det();
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public final void testInvRandSmall() throws Exception {
Matrix m1 = createMatrixWithAnnotation(10, 10);
do {
m1.randn(Ret.ORIG);
} while (m1.isSingular());
Matrix m2 = m1.inv();
Matrix m3 = m1.mtimes(m2);
Matrix eye = DenseDoubleMatrix2D.Factory.eye(m1.getRowCount(), m1.getColumnCount());
assertEquals(getLabel(), 0.0, eye.minus(m3).getEuklideanValue(), TOLERANCE);
if (m1 instanceof Erasable) {
((Erasable) m1).erase();
}
if (m2 instanceof Erasable) {
((Erasable) m2).erase();
}
if (m3 instanceof Erasable) {
((Erasable) m3).erase();
}
if (eye instanceof Erasable) {
((Erasable) eye).erase();
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Test
public final void testInvRandLarge() throws Exception {
if (!isTestLarge()) {
return;
}
Matrix m1 = createMatrixWithAnnotation(128, 128);
do {
m1.randn(Ret.ORIG);
} while (m1.isSingular());
Matrix m2 = m1.inv();
Matrix m3 = m1.mtimes(m2);
Matrix eye = DenseDoubleMatrix2D.Factory.eye(m1.getRowCount(), m1.getColumnCount());
assertEquals(getLabel(), 0.0, eye.minus(m3).getEuklideanValue(), TOLERANCE);
if (m1 instanceof Erasable) {
((Erasable) m1).erase();
}
if (m2 instanceof Erasable) {
((Erasable) m2).erase();
}
if (m3 instanceof Erasable) {
((Erasable) m3).erase();
}
if (eye instanceof Erasable) {
((Erasable) eye).erase();
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
m1.setAsDouble(1.0, 2, 2);
Matrix m2 = m1.inv();
内容来源于网络,如有侵权,请联系作者删除!