本文整理了Java中Jama.Matrix.trace()
方法的一些代码示例,展示了Matrix.trace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.trace()
方法的具体详情如下:
包路径:Jama.Matrix
类名称:Matrix
方法名:trace
暂无
代码示例来源:origin: com.github.yannrichet/JMathArray
public static double trace(double[][] v) {
return new Matrix(v).trace();
}
代码示例来源:origin: net.sourceforge/javaml
public double measure(Instance i, Instance j) {
//XXX optimize
double[][] del = new double[3][1];
for (int m = 0; m < 3; m++) {
for (int n = 0; n < 1; n++) {
del[m][n] = i.value(m) - j.value(m);
}
}
Matrix M1 = new Matrix(del);
Matrix M2 = M1.transpose();
double[][] covar = new double[3][3];
for (int m = 0; m < 3; m++) {
for (int n = 0; n < 3; n++) {
covar[m][n] += (i.value(m) - j.value(m)) * (i.value(n) - j.value(n));
}
}
Matrix cov = new Matrix(covar);
Matrix covInv = cov.inverse();
Matrix temp1 = M2.times(covInv);
Matrix temp2 = temp1.times(M1);
double dist = temp2.trace();
if (dist > 0.)
dist = Math.sqrt(dist);
return dist;
}
代码示例来源:origin: openimaj/openimaj
/**
* Convert a 3D rotation matrix to a Rodrigues rotation vector, which is
* oriented along the rotation axis, and has magnitude equal to the rotation
* angle.
*
* @param R
* the rotation matrix
* @return the Rodrigues rotation vector
*/
public static double[] rodrigues(Matrix R) {
final double w_norm = Math.acos((R.trace() - 1) / 2);
if (w_norm < 10e-10) {
return new double[3];
} else {
final double norm = w_norm / (2 * Math.sin(w_norm));
return new double[] {
norm * (R.get(2, 1) - R.get(1, 2)),
norm * (R.get(0, 2) - R.get(2, 0)),
norm * (R.get(1, 0) - R.get(0, 1))
};
}
}
代码示例来源:origin: percyliang/fig
double t1 = -0.5 * delta.times(inverse).trace();
double t2 = -kappa/2.0 * norm(inverse, mu.minus(scriptV));
return normalizer + t1 + t2;
代码示例来源:origin: gov.nist.math/jama
int t = (int) M.trace();
print(fixedWidthIntegertoString(t,10));
代码示例来源:origin: gov.nist.math/jama
check(A.trace(),sumofdiagonals);
try_success("trace()...","");
} catch ( java.lang.RuntimeException e ) {
内容来源于网络,如有侵权,请联系作者删除!