本文整理了Java中cern.colt.matrix.linalg.Algebra.inverse()
方法的一些代码示例,展示了Algebra.inverse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Algebra.inverse()
方法的具体详情如下:
包路径:cern.colt.matrix.linalg.Algebra
类名称:Algebra
方法名:inverse
[英]Returns the inverse or pseudo-inverse of matrix A.
[中]返回矩阵A的逆矩阵或伪逆矩阵。
代码示例来源:origin: ujmp/universal-java-matrix-package
public Matrix inv() {
return new ColtDenseDoubleMatrix2D((DenseDoubleMatrix2D) Algebra.DEFAULT.inverse(matrix));
}
代码示例来源:origin: org.ujmp/ujmp-colt
public Matrix inv() {
return new ColtDenseDoubleMatrix2D((DenseDoubleMatrix2D) Algebra.DEFAULT.inverse(matrix));
}
代码示例来源: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: lessthanoptimal/Java-Matrix-Benchmark
@Override
public long process(BenchmarkMatrix[] inputs, BenchmarkMatrix[] outputs, long numTrials) {
DenseDoubleMatrix2D matA = inputs[0].getOriginal();
Algebra alg = new Algebra();
DoubleMatrix2D result = null;
long prev = System.nanoTime();
for( long i = 0; i < numTrials; i++ ) {
result = alg.inverse(matA);
}
long elapsed = System.nanoTime()-prev;
if( outputs != null ) {
outputs[0] = new ColtBenchmarkMatrix(result);
}
return elapsed;
}
}
代码示例来源: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
/**
*/
public static void doubleTest34() {
double[][] data =
{
{ 3, 0, 0, 0 },
{ 0, 4, 2, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
};
DoubleMatrix2D A = new DenseDoubleMatrix2D(data);
Property.DEFAULT.generateNonSingular(A);
DoubleMatrix2D inv = Algebra.DEFAULT.inverse(A);
System.out.println("\n\n\n"+A);
System.out.println("\n"+inv);
DoubleMatrix2D B = A.zMult(inv,null);
System.out.println(B);
if (!(B.equals(DoubleFactory2D.dense.identity(A.rows)))) {
throw new InternalError();
}
}
/**
代码示例来源:origin: blazegraph/database
/**
*/
public static void doubleTest25(int size) {
System.out.println("\n\n");
System.out.println("initializing...");
boolean dense = true;
DoubleMatrix2D A;
DoubleFactory2D factory;
if (dense)
factory = Factory2D.dense;
else
factory = Factory2D.sparse;
double value = 0.5;
A = factory.make(size,size,value);
Property.generateNonSingular(A);
cern.colt.Timer timer = new cern.colt.Timer().start();
System.out.println(A);
System.out.println(Algebra.ZERO.inverse(A));
timer.stop().display();
System.out.println("done.");
}
/**
代码示例来源:origin: org.ujmp/ujmp-colt
public Matrix inv() {
return new ColtDenseDoubleMatrix2D((DenseDoubleMatrix2D) new Algebra().inverse(matrix));
}
代码示例来源:origin: com.blazegraph/colt
System.out.println(Algebra.ZERO.inverse(A));
代码示例来源:origin: com.blazegraph/colt
/**
*/
public static void doubleTest34() {
double[][] data =
{
{ 3, 0, 0, 0 },
{ 0, 4, 2, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
};
DoubleMatrix2D A = new DenseDoubleMatrix2D(data);
Property.DEFAULT.generateNonSingular(A);
DoubleMatrix2D inv = Algebra.DEFAULT.inverse(A);
System.out.println("\n\n\n"+A);
System.out.println("\n"+inv);
DoubleMatrix2D B = A.zMult(inv,null);
System.out.println(B);
if (!(B.equals(DoubleFactory2D.dense.identity(A.rows)))) {
throw new InternalError();
}
}
/**
代码示例来源:origin: com.blazegraph/colt
/**
*/
public static void doubleTest25(int size) {
System.out.println("\n\n");
System.out.println("initializing...");
boolean dense = true;
DoubleMatrix2D A;
DoubleFactory2D factory;
if (dense)
factory = Factory2D.dense;
else
factory = Factory2D.sparse;
double value = 0.5;
A = factory.make(size,size,value);
Property.generateNonSingular(A);
cern.colt.Timer timer = new cern.colt.Timer().start();
System.out.println(A);
System.out.println(Algebra.ZERO.inverse(A));
timer.stop().display();
System.out.println("done.");
}
/**
代码示例来源:origin: ujmp/universal-java-matrix-package
public Matrix inv() {
return new ColtDenseDoubleMatrix2D((DenseDoubleMatrix2D) new Algebra().inverse(matrix));
}
代码示例来源:origin: blazegraph/database
System.out.println(Algebra.ZERO.inverse(A));
代码示例来源:origin: com.blazegraph/colt
inverseQMatrix = Algebra.DEFAULT.inverse (QMatrix);
pseudoInverseMatrix = Algebra.DEFAULT.mult (inverseQMatrix,transposeMatrix);
weightMatrix = Algebra.DEFAULT.mult (patternMatrix,pseudoInverseMatrix);
代码示例来源:origin: blazegraph/database
inverseQMatrix = Algebra.DEFAULT.inverse (QMatrix);
pseudoInverseMatrix = Algebra.DEFAULT.mult (inverseQMatrix,transposeMatrix);
weightMatrix = Algebra.DEFAULT.mult (patternMatrix,pseudoInverseMatrix);
代码示例来源:origin: blazegraph/database
System.out.println("\nHplus="+H.viewDice().zMult(H,null));
DoubleMatrix2D Hplus = Algebra.DEFAULT.inverse(H.viewDice().zMult( H,null )).zMult(H.viewDice(),null);
Hplus.assign(cern.jet.math.Functions.round(1.0E-10));
System.out.println("\nHplus="+Hplus);
代码示例来源:origin: com.blazegraph/colt
System.out.println("\nHplus="+H.viewDice().zMult(H,null));
DoubleMatrix2D Hplus = Algebra.DEFAULT.inverse(H.viewDice().zMult( H,null )).zMult(H.viewDice(),null);
Hplus.assign(cern.jet.math.Functions.round(1.0E-10));
System.out.println("\nHplus="+Hplus);
代码示例来源:origin: cmu-phil/tetrad
DoubleMatrix2D K = algebra.inverse(factory.diagonal(factory.diagonal(S)));
int[] b = complement(all, a);
DoubleMatrix2D a1 = S.viewSelection(a, a);
DoubleMatrix2D a2 = algebra.inverse(a1);
DoubleMatrix2D a3 = K.viewSelection(a, b);
DoubleMatrix2D a4 = K.viewSelection(b, b);
DoubleMatrix2D a5 = algebra.inverse(a4);
DoubleMatrix2D a6 = K.viewSelection(b, a).copy();
DoubleMatrix2D a7 = algebra.mult(a3, a5);
DoubleMatrix2D V = algebra.inverse(K);
double dev = lik(algebra.inverse(V), S, n, k);
代码示例来源:origin: blazegraph/database
DoubleMatrix2D inv = null;
for (int run=0; run<runs; run++) {
inv = LinearAlgebra.inverse(A);
代码示例来源:origin: com.blazegraph/colt
DoubleMatrix2D inv = null;
for (int run=0; run<runs; run++) {
inv = LinearAlgebra.inverse(A);
内容来源于网络,如有侵权,请联系作者删除!