本文整理了Java中cern.colt.matrix.linalg.Algebra.det()
方法的一些代码示例,展示了Algebra.det()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Algebra.det()
方法的具体详情如下:
包路径:cern.colt.matrix.linalg.Algebra
类名称:Algebra
方法名:det
[英]Returns the determinant of matrix A.
[中]返回矩阵A的行列式。
代码示例来源:origin: blazegraph/database
/**
* A matrix <tt>A</tt> is <i>singular</i> if it has no inverse, that is, iff <tt>det(A)==0</tt>.
*/
public boolean isSingular(DoubleMatrix2D A) {
return !(Math.abs(Algebra.DEFAULT.det(A)) >= tolerance());
}
/**
代码示例来源:origin: com.blazegraph/colt
/**
* A matrix <tt>A</tt> is <i>singular</i> if it has no inverse, that is, iff <tt>det(A)==0</tt>.
*/
public boolean isSingular(DoubleMatrix2D A) {
return !(Math.abs(Algebra.DEFAULT.det(A)) >= tolerance());
}
/**
代码示例来源:origin: lessthanoptimal/Java-Matrix-Benchmark
@Override
public long process(BenchmarkMatrix[] inputs, BenchmarkMatrix[] outputs, long numTrials) {
DenseDoubleMatrix2D matA = inputs[0].getOriginal();
Algebra alg = new Algebra();
long prev = System.nanoTime();
for( long i = 0; i < numTrials; i++ ) {
alg.det(matA);
}
return System.nanoTime()-prev;
}
}
代码示例来源:origin: ca.umontreal.iro/ssj
public double density (double[] x) {
double sum = 0.0;
if (invSigma == null)
invSigma = algebra.inverse(sigma);
double[] temp = new double[mu.length];
for (int i = 0; i < mu.length; i++)
{
sum = 0.0;
for (int j = 0; j < mu.length; j++)
sum += ((x[j] - mu[j]) * invSigma.getQuick (j, i));
temp[i] = sum;
}
sum = 0.0;
for (int i = 0; i < mu.length; i++)
sum += temp[i] * (x[i] - mu[i]);
return (Math.exp(-0.5 * sum) / Math.sqrt (Math.pow (2 * Math.PI, mu.length) * algebra.det (sigma)));
}
代码示例来源:origin: cmu-phil/tetrad
private double lik(DoubleMatrix2D K, DoubleMatrix2D S, int n, int k) {
Algebra algebra = new Algebra();
DoubleMatrix2D SK = algebra.mult(S, K);
return (algebra.trace(SK) - Math.log(algebra.det(SK)) - k) * n;
}
代码示例来源:origin: ca.umontreal.iro/ssj
/**
* Computes the density of the multinormal distribution
* with parameters <SPAN CLASS="MATH"><I><B>μ</B></I> =</SPAN> <TT>mu</TT> and
* <SPAN CLASS="MATH"><I><B>Σ</B></I> =</SPAN> <TT>sigma</TT>,
* evaluated at <TT>x</TT>.
*
*/
public static double density (double[] mu, double[][] sigma, double[] x) {
double sum = 0.0;
DoubleMatrix2D sig;
DoubleMatrix2D inv;
if (sigma.length != sigma[0].length)
throw new IllegalArgumentException ("sigma must be a square matrix");
if (mu.length != sigma.length)
throw new IllegalArgumentException ("mu and sigma must have the same dimension");
sig = new DenseDoubleMatrix2D (sigma);
inv = algebra.inverse (sig);
double[] temp = new double[mu.length];
for (int i = 0; i < mu.length; i++)
{
sum = 0.0;
for (int j = 0; j < mu.length; j++)
sum += ((x[j] - mu[j]) * inv.getQuick (j, i));
temp[i] = sum;
}
sum = 0.0;
for (int i = 0; i < mu.length; i++)
sum += temp[i] * (x[i] - mu[i]);
return (Math.exp(-0.5 * sum) / Math.sqrt (Math.pow (2 * Math.PI, mu.length) * algebra.det (sig)));
}
代码示例来源:origin: blazegraph/database
try { values.add(String.valueOf(det(matrix)));}
catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
代码示例来源:origin: com.blazegraph/colt
try { values.add(String.valueOf(det(matrix)));}
catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
内容来源于网络,如有侵权,请联系作者删除!