本文整理了Java中cern.colt.matrix.linalg.Algebra.<init>()
方法的一些代码示例,展示了Algebra.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Algebra.<init>()
方法的具体详情如下:
包路径:cern.colt.matrix.linalg.Algebra
类名称:Algebra
方法名:<init>
[英]Constructs a new instance with an equality tolerance given by Property.DEFAULT.tolerance().
[中]使用属性给定的相等公差构造新实例。违约公差()。
代码示例来源:origin: blazegraph/database
/**
Constructs and returns a new LU Decomposition object which uses the given tolerance for singularity detection;
*/
public LUDecompositionQuick(double tolerance) {
this.algebra = new Algebra(tolerance);
}
/**
代码示例来源:origin: com.blazegraph/colt
/**
Constructs and returns a new LU Decomposition object which uses the given tolerance for singularity detection;
*/
public LUDecompositionQuick(double tolerance) {
this.algebra = new Algebra(tolerance);
}
/**
代码示例来源:origin: com.blazegraph/colt
/**
* Returns a copy of the receiver.
* The attached property object is also copied. Hence, the property object of the copy is mutable.
*
* @return a copy of the receiver.
*/
public Object clone() {
return new Algebra(property.tolerance());
}
/**
代码示例来源:origin: blazegraph/database
/**
* Returns a copy of the receiver.
* The attached property object is also copied. Hence, the property object of the copy is mutable.
*
* @return a copy of the receiver.
*/
public Object clone() {
return new Algebra(property.tolerance());
}
/**
代码示例来源:origin: cmu-phil/tetrad
public static double norm2(DoubleMatrix1D vec){
//return Math.sqrt(vec.copy().assign(Functions.pow(2)).zSum());
return Math.sqrt(new Algebra().norm2(vec));
}
}
代码示例来源:origin: cmu-phil/tetrad
private static double norm2(DoubleMatrix1D vec){
//return Math.sqrt(vec.copy().assign(Functions.pow(2)).zSum());
return Math.sqrt(new Algebra().norm2(vec));
}
代码示例来源:origin: org.ujmp/ujmp-colt
public Matrix inv() {
return new ColtDenseDoubleMatrix2D((DenseDoubleMatrix2D) new Algebra().inverse(matrix));
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public Matrix inv() {
return new ColtDenseDoubleMatrix2D((DenseDoubleMatrix2D) new Algebra().inverse(matrix));
}
代码示例来源:origin: stackoverflow.com
Algebra algebra = new Algebra();
DoubleMatrix2D X = algebra.solve(matrix, D);
代码示例来源: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: 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: 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: lessthanoptimal/Java-Matrix-Benchmark
@Override
public long process(BenchmarkMatrix[] inputs, BenchmarkMatrix[] outputs, long numTrials) {
DenseDoubleMatrix2D matA = inputs[0].getOriginal();
DenseDoubleMatrix2D matB = inputs[1].getOriginal();
Algebra alg = new Algebra();
DoubleMatrix2D result = null;
long prev = System.nanoTime();
for( long i = 0; i < numTrials; i++ ) {
result = alg.mult(matA,matB);
}
long elapsed = System.nanoTime()-prev;
if( outputs != null ) {
outputs[0] = new ColtBenchmarkMatrix(result);
}
return elapsed;
}
}
代码示例来源:origin: lessthanoptimal/Java-Matrix-Benchmark
@Override
public long process(BenchmarkMatrix[] inputs, BenchmarkMatrix[] outputs, long numTrials) {
DenseDoubleMatrix2D matA = inputs[0].getOriginal();
DenseDoubleMatrix2D matB = inputs[1].getOriginal();
Algebra alg = new Algebra();
DoubleMatrix2D result = null;
long prev = System.nanoTime();
for( long i = 0; i < numTrials; i++ ) {
result = alg.solve(matA,matB);
}
if( outputs != null ) {
outputs[0] = new ColtBenchmarkMatrix(result);
}
return System.nanoTime()-prev;
}
}
代码示例来源:origin: cmu-phil/tetrad
public static TetradMatrix solve(TetradMatrix a, TetradMatrix b) {
DoubleMatrix2D _a = new DenseDoubleMatrix2D(a.toArray());
DoubleMatrix2D _b = new DenseDoubleMatrix2D(b.toArray());
return new TetradMatrix(new Algebra().solve(_a, _b).toArray());
}
代码示例来源:origin: cmu-phil/tetrad
DoubleMatrix2D Zt = new Algebra().transpose(Z);
DoubleMatrix2D ZtZ = new Algebra().mult(Zt, Z);
DoubleMatrix2D GZt = new Algebra().mult(G, Zt2);
DoubleMatrix1D b_x = new Algebra().mult(GZt, x);
DoubleMatrix1D xPred = new Algebra().mult(Z, b_x);
DoubleMatrix1D xRes = xPred.copy().assign(x, Functions.minus);
double SSE = xRes.aggregate(Functions.plus, Functions.square);
代码示例来源:origin: cmu-phil/tetrad
private static double norm2(DoubleMatrix2D mat){
//return Math.sqrt(mat.copy().assign(Functions.pow(2)).zSum());
Algebra al = new Algebra();
//norm found by svd so we need rows >= cols
if(mat.rows() < mat.columns()){
return al.norm2(al.transpose(mat));
}
return al.norm2(mat);
}
代码示例来源:origin: cmu-phil/tetrad
s.assign(new Algebra().mult(vv, x));
} else {
s.assign(new Algebra().mult(vv, x), PlusMult.plusMult(-1));
代码示例来源:origin: cmu-phil/tetrad
public static TetradMatrix multOuter(TetradVector v1, TetradVector v2) {
DoubleMatrix2D m = new Algebra().multOuter(new DenseDoubleMatrix1D(v1.toArray()),
new DenseDoubleMatrix1D(v2.toArray()), null);
return new TetradMatrix(m.toArray());
}
代码示例来源:origin: cmu-phil/tetrad
public static double[] totalInstabilityUndir(DoubleMatrix2D xi, List<Node> vars){
if (vars.size()!= xi.columns() || vars.size()!= xi.rows()) {
throw new IllegalArgumentException("stability mat must have same number of rows and columns as there are vars");
}
Algebra al = new Algebra();
//DoubleMatrix2D xiu = MGM.upperTri(xi.copy().assign(al.transpose(xi)),1);
DoubleMatrix2D xiu = xi.copy().assign(xi.copy().assign(Functions.minus(1.0)), Functions.mult).assign(Functions.mult(-2.0));
double[] D = new double[4];
int[] discInds = MixedUtils.getDiscreteInds(vars);
int[] contInds = MixedUtils.getContinuousInds(vars);
int p = contInds.length;
int q = discInds.length;
double temp = MGM.upperTri(xiu.copy(),1).zSum();
D[0] = temp/ ((p+q-1.0)*(p+q)/2.0);
temp = MGM.upperTri(xiu.viewSelection(contInds, contInds).copy(), 1).zSum();
D[1] = temp/(p*(p-1.0)/2.0);
temp = xiu.viewSelection(contInds, discInds).zSum();
D[2] = temp/(p*q);
temp = MGM.upperTri(xiu.viewSelection(discInds, discInds).copy(), 1).zSum();
D[3] = temp/(q*(q-1.0)/2.0);
return D;
}
内容来源于网络,如有侵权,请联系作者删除!