本文整理汇总了Java中cern.colt.matrix.DoubleMatrix2D.toStringShort方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleMatrix2D.toStringShort方法的具体用法?Java DoubleMatrix2D.toStringShort怎么用?Java DoubleMatrix2D.toStringShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cern.colt.matrix.DoubleMatrix2D
的用法示例。
在下文中一共展示了DoubleMatrix2D.toStringShort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dsymv
import cern.colt.matrix.DoubleMatrix2D; //导入方法依赖的package包/类
public void dsymv(boolean isUpperTriangular, double alpha, DoubleMatrix2D A, DoubleMatrix1D x, double beta, DoubleMatrix1D y) {
if (isUpperTriangular) A = A.viewDice();
Property.DEFAULT.checkSquare(A);
int size = A.rows();
if (size != x.size() || size!=y.size()) {
throw new IllegalArgumentException(A.toStringShort() + ", " + x.toStringShort() + ", " + y.toStringShort());
}
DoubleMatrix1D tmp = x.like();
for (int i = 0; i < size; i++) {
double sum = 0;
for (int j = 0; j <= i; j++) {
sum += A.getQuick(i,j) * x.getQuick(j);
}
for (int j = i + 1; j < size; j++) {
sum += A.getQuick(j,i) * x.getQuick(j);
}
tmp.setQuick(i, alpha * sum + beta * y.getQuick(i));
}
y.assign(tmp);
}
示例2: dtrmv
import cern.colt.matrix.DoubleMatrix2D; //导入方法依赖的package包/类
public void dtrmv(boolean isUpperTriangular, boolean transposeA, boolean isUnitTriangular, DoubleMatrix2D A, DoubleMatrix1D x) {
if (transposeA) {
A = A.viewDice();
isUpperTriangular = !isUpperTriangular;
}
Property.DEFAULT.checkSquare(A);
int size = A.rows();
if (size != x.size()) {
throw new IllegalArgumentException(A.toStringShort() + ", " + x.toStringShort());
}
DoubleMatrix1D b = x.like();
DoubleMatrix1D y = x.like();
if (isUnitTriangular) {
y.assign(1);
}
else {
for (int i = 0; i < size; i++) {
y.setQuick(i, A.getQuick(i,i));
}
}
for (int i = 0; i < size; i++) {
double sum = 0;
if (!isUpperTriangular) {
for (int j = 0; j < i; j++) {
sum += A.getQuick(i,j) * x.getQuick(j);
}
sum += y.getQuick(i) * x.getQuick(i);
}
else {
sum += y.getQuick(i) * x.getQuick(i);
for (int j = i + 1; j < size; j++) {
sum += A.getQuick(i,j) * x.getQuick(j); }
}
b.setQuick(i,sum);
}
x.assign(b);
}
示例3: zMult
import cern.colt.matrix.DoubleMatrix2D; //导入方法依赖的package包/类
public DoubleMatrix2D zMult(DoubleMatrix2D B, DoubleMatrix2D C, final double alpha, double beta, boolean transposeA, boolean transposeB) {
if (transposeB) B = B.viewDice();
int m = rows;
int n = columns;
if (transposeA) {
m = columns;
n = rows;
}
int p = B.columns;
boolean ignore = (C==null);
if (C==null) C = new DenseDoubleMatrix2D(m,p);
if (B.rows != n)
throw new IllegalArgumentException("Matrix2D inner dimensions must agree:"+toStringShort()+", "+ (transposeB ? B.viewDice() : B).toStringShort());
if (C.rows != m || C.columns != p)
throw new IllegalArgumentException("Incompatibel result matrix: "+toStringShort()+", "+ (transposeB ? B.viewDice() : B).toStringShort()+", "+C.toStringShort());
if (this == C || B == C)
throw new IllegalArgumentException("Matrices must not be identical");
if (!ignore) C.assign(cern.jet.math.Functions.mult(beta));
// cache views
final DoubleMatrix1D[] Brows = new DoubleMatrix1D[n];
for (int i=n; --i>=0; ) Brows[i] = B.viewRow(i);
final DoubleMatrix1D[] Crows = new DoubleMatrix1D[m];
for (int i=m; --i>=0; ) Crows[i] = C.viewRow(i);
final cern.jet.math.PlusMult fun = cern.jet.math.PlusMult.plusMult(0);
int[] idx = indexes.elements();
double[] vals = values.elements();
for (int i=starts.length-1; --i >= 0; ) {
int low = starts[i];
for (int k=starts[i+1]; --k >= low; ) {
int j = idx[k];
fun.multiplicator = vals[k]*alpha;
if (!transposeA)
Crows[i].assign(Brows[j],fun);
else
Crows[j].assign(Brows[i],fun);
}
}
return C;
}