本文整理了Java中Jama.Matrix.get()
方法的一些代码示例,展示了Matrix.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.get()
方法的具体详情如下:
包路径:Jama.Matrix
类名称:Matrix
方法名:get
暂无
代码示例来源:origin: marytts/marytts
public void printPricipalComponents(Vector<String> factors) {
System.out.println("PCs:");
for (int j = 0; j < PC.getColumnDimension(); j++) {
System.out.println("PC(" + j + ")");
for (int i = 0; i < PC.getRowDimension(); i++)
System.out.format(" %s %.5f\n", factors.elementAt(i), PC.get(i, j));
}
}
代码示例来源:origin: h2oai/h2o-3
final Matrix inv_hessian = new Matrix(cs._hessian).inverse();
for (int j = 0; j < n_coef; ++j) {
for (int k = 0; k <= j; ++k) {
final double elem = -inv_hessian.get(j, k);
o._var_coef[j][k] = elem;
o._var_coef[k][j] = elem;
代码示例来源:origin: marytts/marytts
y = datay;
b = X.solve(y);
coeffs = new double[b.getRowDimension()];
for (int j = 0; j < b.getRowDimension(); j++) {
coeffs[j] = b.get(j, 0);
代码示例来源:origin: marytts/marytts
int M = data.getRowDimension();
int N = data.getColumnDimension();
data.set(i, j, ((data.get(i, j) - mn) / sd));
} else {
data.set(i, j, (data.get(i, j) - mn));
data.print(data.getRowDimension(), 3);
V = new double[svd.getS().getRowDimension()];
for (int i = 0; i < svd.getS().getRowDimension(); i++) {
V[i] = svd.getS().get(i, i);
if (debug)
System.out.println(V[i]);
double sumPropVar = 0.0; // sum of the proportion of variance
for (int j = 0; j < covProjectedData.getColumnDimension(); j++) {
varianceProportion[j] = covProjectedData.get(j, j);
sumPropVar += varianceProportion[j];
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
private void copyArray(Matrix vectorIn, double[] out) {
for (int i = 0; i < vectorIn.getRowDimension(); i++) {
out[i] = vectorIn.get(i, 0);
}
}
代码示例来源:origin: openimaj/openimaj
private void alignWithFrame(int frame) {
Vector3D i1 = new Vector3D(R.get(frame, 0), R.get(frame, 1), R.get(frame, 2));
i1 = i1.scalarMultiply(1 / i1.getNorm());
final int f = R.getRowDimension() / 2;
Vector3D j1 = new Vector3D(R.get(frame + f, 0), R.get(frame + f, 1), R.get(frame + f, 2));
j1 = j1.scalarMultiply(1 / j1.getNorm());
final Vector3D k1 = Vector3D.crossProduct(i1, j1);
k1.scalarMultiply(1 / k1.getNorm());
final Matrix R0 = new Matrix(new double[][] {
{ i1.getX(), j1.getX(), k1.getX() },
{ i1.getY(), j1.getY(), k1.getY() },
{ i1.getZ(), j1.getZ(), k1.getZ() },
});
R = R.times(R0);
S = R0.inverse().times(S);
}
代码示例来源:origin: openimaj/openimaj
@Override
public double estimateProbability(double[] sample) {
final int N = mean.getColumnDimension();
final Matrix inv_covar = getCovariance().inverse();
final double pdf_const_factor = 1.0 / Math.sqrt((Math.pow((2 * Math.PI), N) * getCovariance().det()));
final Matrix xm = new Matrix(1, N);
for (int i = 0; i < N; i++)
xm.set(0, i, sample[i] - mean.get(0, i));
final Matrix xmt = xm.transpose();
final double v = xm.times(inv_covar.times(xmt)).get(0, 0);
return pdf_const_factor * Math.exp(-0.5 * v);
}
代码示例来源:origin: marytts/marytts
int M = data.getRowDimension();
int N = data.getColumnDimension();
data.set(i, j, ((data.get(i, j) - mn) / sd));
} else {
data.set(i, j, (data.get(i, j) - mn));
data.print(data.getRowDimension(), 3);
V = new double[svd.getS().getRowDimension()];
for (int i = 0; i < svd.getS().getRowDimension(); i++) {
V[i] = svd.getS().get(i, i);
if (debug)
System.out.println(V[i]);
double sumPropVar = 0.0; // sum of the proportion of variance
for (int j = 0; j < covProjectedData.getColumnDimension(); j++) {
varianceProportion[j] = covProjectedData.get(j, j);
sumPropVar += varianceProportion[j];
代码示例来源:origin: marytts/marytts
public void printPricipalComponents(Vector<String> factors) {
System.out.println("PCs:");
for (int j = 0; j < PC.getColumnDimension(); j++) {
System.out.println("PC(" + j + ")");
for (int i = 0; i < PC.getRowDimension(); i++)
System.out.format(" %s %.5f\n", factors.elementAt(i), PC.get(i, j));
}
}
代码示例来源:origin: h2oai/h2o-2
protected void calcModelStats(final double[] newCoef, final double newLoglik) {
final int n_coef = coef.length;
final Matrix inv_hessian = new Matrix(hessian).inverse();
for (int j = 0; j < n_coef; ++j) {
for (int k = 0; k <= j; ++k) {
final double elem = -inv_hessian.get(j, k);
var_coef[j][k] = elem;
var_coef[k][j] = elem;
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
private void copyArray(Matrix vectorIn, double[] out) {
for (int i = 0; i < vectorIn.getRowDimension(); i++) {
out[i] = vectorIn.get(i, 0);
}
}
代码示例来源:origin: org.openimaj/sandbox
private void alignWithFrame(int frame) {
Vector3D i1 = new Vector3D(R.get(frame, 0), R.get(frame, 1), R.get(frame, 2));
i1 = i1.scalarMultiply(1 / i1.getNorm());
final int f = R.getRowDimension() / 2;
Vector3D j1 = new Vector3D(R.get(frame + f, 0), R.get(frame + f, 1), R.get(frame + f, 2));
j1 = j1.scalarMultiply(1 / j1.getNorm());
final Vector3D k1 = Vector3D.crossProduct(i1, j1);
k1.scalarMultiply(1 / k1.getNorm());
final Matrix R0 = new Matrix(new double[][] {
{ i1.getX(), j1.getX(), k1.getX() },
{ i1.getY(), j1.getY(), k1.getY() },
{ i1.getZ(), j1.getZ(), k1.getZ() },
});
R = R.times(R0);
S = R0.inverse().times(S);
}
代码示例来源:origin: openimaj/openimaj
@Override
public double estimateLogProbability(double[] sample) {
final int N = mean.getColumnDimension();
final Matrix inv_covar = getCovariance().inverse();
final double cov_det = getCovariance().det();
final double pdf_const_factor = 1.0 / Math.sqrt((Math.pow((2 * Math.PI), N) * cov_det));
final Matrix xm = new Matrix(1, N);
for (int i = 0; i < N; i++)
xm.set(0, i, sample[i] - mean.get(0, i));
final Matrix xmt = xm.transpose();
final double v = xm.times(inv_covar.times(xmt)).get(0, 0);
return Math.log(pdf_const_factor) + (-0.5 * v);
}
代码示例来源:origin: marytts/marytts
y = datay;
b = X.solve(y);
coeffs = new double[b.getRowDimension()];
for (int j = 0; j < b.getRowDimension(); j++) {
coeffs[j] = b.get(j, 0);
代码示例来源:origin: marytts/marytts
int M = data.getRowDimension();
int N = data.getColumnDimension();
data.set(i, j, ((data.get(i, j) - mn) / sd));
} else {
data.set(i, j, (data.get(i, j) - mn));
data.print(data.getRowDimension(), 3);
if (debug) {
System.out.println("Covariance");
covariance.print(covariance.getRowDimension(), 3);
double values[] = new double[pc.getD().getRowDimension()];
for (int i = 0; i < pc.getD().getRowDimension(); i++)
values[i] = pc.getD().get(i, i);
V[j] = values[k];
for (int i = 0; i < pc.getV().getRowDimension(); i++)
d[i][j] = pc.getV().get(i, k);
double sumPropVar = 0.0; // sum of the proportion of variance
for (int j = 0; j < covProjectedData.getColumnDimension(); j++) {
varianceProportion[j] = covProjectedData.get(j, j);
sumPropVar += varianceProportion[j];
代码示例来源:origin: marytts/marytts
System.out.println("Ordered PC(" + numPCA + ")");
numPCA = numPCA - 1;
double loadings[] = new double[PC.getRowDimension()];
for (int i = 0; i < PC.getRowDimension(); i++)
loadings[i] = Math.abs(PC.get(i, numPCA));
for (int i = PC.getRowDimension() - 1; i >= 0; i--) {
index = indices[i];
System.out.format(" %s %.5f\n", factors[index], PC.get(index, numPCA));
for (int i = PC.getRowDimension() - 1; i >= 0; i--) {
代码示例来源:origin: marytts/marytts
Matrix x = new Matrix(A).solve(new Matrix(b));
double[] coeffs = new double[order + 1];
for (int j = 0; j <= order; j++) {
coeffs[j] = x.get(j, 0);
代码示例来源:origin: openimaj/openimaj
/**
* @param mat
* @return trace of the matrix
*/
public static double trace(Matrix mat) {
double sum = 0;
for (int i = 0; i < mat.getRowDimension(); i++) {
sum += mat.get(i, i);
}
return sum;
}
代码示例来源:origin: marytts/marytts
int M = data.getRowDimension();
int N = data.getColumnDimension();
data.set(i, j, ((data.get(i, j) - mn) / sd));
} else {
data.set(i, j, (data.get(i, j) - mn));
data.print(data.getRowDimension(), 3);
if (debug) {
System.out.println("Covariance");
covariance.print(covariance.getRowDimension(), 3);
double values[] = new double[pc.getD().getRowDimension()];
for (int i = 0; i < pc.getD().getRowDimension(); i++)
values[i] = pc.getD().get(i, i);
V[j] = values[k];
for (int i = 0; i < pc.getV().getRowDimension(); i++)
d[i][j] = pc.getV().get(i, k);
double sumPropVar = 0.0; // sum of the proportion of variance
for (int j = 0; j < covProjectedData.getColumnDimension(); j++) {
varianceProportion[j] = covProjectedData.get(j, j);
sumPropVar += varianceProportion[j];
代码示例来源:origin: marytts/marytts
System.out.println("Ordered PC(" + numPCA + ")");
numPCA = numPCA - 1;
double loadings[] = new double[PC.getRowDimension()];
for (int i = 0; i < PC.getRowDimension(); i++)
loadings[i] = Math.abs(PC.get(i, numPCA));
for (int i = PC.getRowDimension() - 1; i >= 0; i--) {
index = indices[i];
System.out.format(" %s %.5f\n", factors[index], PC.get(index, numPCA));
for (int i = PC.getRowDimension() - 1; i >= 0; i--) {
内容来源于网络,如有侵权,请联系作者删除!