Jama.Matrix.times()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中Jama.Matrix.times()方法的一些代码示例,展示了Matrix.times()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.times()方法的具体详情如下:
包路径:Jama.Matrix
类名称:Matrix
方法名:times

Matrix.times介绍

暂无

代码示例

代码示例来源:origin: marytts/marytts

public double[][] getDataProjected(Matrix data, boolean debug) {
  // Project the original data set
  Matrix dataProjected;
  dataProjected = PC.transpose().times(data);
  if (debug) {
    System.out.println("Data projected:");
    dataProjected.print(dataProjected.getRowDimension(), 3);
  }
  return dataProjected.getArray();
}

代码示例来源:origin: marytts/marytts

int col = data.getColumnDimension();
  Matrix B = new Matrix(row, col + 1);
  Matrix ones = new Matrix(row, 1);
  for (int i = 0; i < row; i++)
    ones.set(i, 0, 1.0);
Matrix r = data.times(b).minus(indVar);
residuals = r.getColumnPackedCopy();
Matrix p = data.times(b);
predictedValues = p.getColumnPackedCopy();
for (int i = 0; i < predictedValues.length; i++)

代码示例来源:origin: h2oai/h2o-3

Matrix x_r = new Matrix(xxchol.getL()).transpose();
x_r = x_r.times(Math.sqrt(nobs));
Matrix yt = new Matrix(model._output._archetypes_raw.getY(true));
QRDecomposition yt_qr = new QRDecomposition(yt);
Matrix rrmul = x_r.times(yt_r.transpose());
SingularValueDecomposition rrsvd = new SingularValueDecomposition(rrmul);   // RS' = U \Sigma V'
double[] sval = rrsvd.getSingularValues();  // get singular values as double array
 Matrix eigvec = yt_qr.getQ().times(rrsvd.getV());

代码示例来源:origin: marytts/marytts

covariance = data.times(data.transpose());
covariance = covariance.times(1.0 / (N - 1));
if (debug) {
  System.out.println("Covariance");
    d[i][j] = pc.getV().get(i, k);
PC = new Matrix(d);
if (debug) {
  System.out.println("PC:");
Matrix projectedData = PC.transpose().times(data);
Matrix covProjectedData = projectedData.times(projectedData.transpose());

代码示例来源:origin: marytts/marytts

int col = data.getColumnDimension();
  Matrix B = new Matrix(row, col + 1);
  Matrix ones = new Matrix(row, 1);
  for (int i = 0; i < row; i++)
    ones.set(i, 0, 1.0);
Matrix r = data.times(b).minus(indVar);
residuals = r.getColumnPackedCopy();
Matrix p = data.times(b);
predictedValues = p.getColumnPackedCopy();
for (int i = 0; i < predictedValues.length; i++)

代码示例来源:origin: marytts/marytts

public double[][] getDataProjected(Matrix data, boolean debug) {
  // Project the original data set
  Matrix dataProjected;
  dataProjected = PC.transpose().times(data);
  if (debug) {
    System.out.println("Data projected:");
    dataProjected.print(dataProjected.getRowDimension(), 3);
  }
  return dataProjected.getArray();
}

代码示例来源:origin: marytts/marytts

covariance = data.times(data.transpose());
covariance = covariance.times(1.0 / (N - 1));
if (debug) {
  System.out.println("Covariance");
    d[i][j] = pc.getV().get(i, k);
PC = new Matrix(d);
if (debug) {
  System.out.println("PC:");
Matrix projectedData = PC.transpose().times(data);
Matrix covProjectedData = projectedData.times(projectedData.transpose());

代码示例来源:origin: stackoverflow.com

double[][] array = {{1.,2.,3},{1.,2.,3.},{1.,2.,3.}}; 
Matrix a = new Matrix(array);   
Matrix b = new Matrix(new double[]{1., 1., 1.}, 1);     
Matrix c = b.times(a);  
System.out.println(Arrays.deepToString(c.getArray()));

代码示例来源:origin: marytts/marytts

Matrix Y = data.transpose();
Y = Y.times(1.0 / Math.sqrt(N - 1));
Matrix projectedData = PC.transpose().times(data);
Matrix covProjectedData = projectedData.times(projectedData.transpose());

代码示例来源:origin: percyliang/fig

public MultGaussianSuffStats(double[] x) {
 sum = new Matrix(x, x.length);
 outerproducts = sum.times(sum.transpose());
 n = 1;
}
public MultGaussianSuffStats(MultGaussianSuffStats stats) {

代码示例来源:origin: stackoverflow.com

double[][] array = {{1.,2.,3},{4.,5.,6.},{7.,8.,10.}}; 
Matrix A = new Matrix(array); 
Matrix b = Matrix.random(3,1); 
Matrix x = A.solve(b); 
Matrix Residual = A.times(x).minus(b);

代码示例来源:origin: marytts/marytts

Matrix Y = data.transpose();
Y = Y.times(1.0 / Math.sqrt(N - 1));
Matrix projectedData = PC.transpose().times(data);
Matrix covProjectedData = projectedData.times(projectedData.transpose());

代码示例来源:origin: bcdev/beam

/**
 * @param pt point
 * @return the square of the  Mahalanobis distance of the point from center of gravity
 */
public double distancesqu(double[] pt) {
  double[] df = new double[pt.length];
  for (int k = 0; k < pt.length; k++){
    df[k] = pt[k] - this.cog[k];
  }
  Matrix dfm = new Matrix(df, pt.length);
  return Math.abs(dfm.transpose().times(this.covinv.times(dfm)).getArray()[0][0]);
}

代码示例来源:origin: pranab/chombo

/**
 * @param a
 * @param b
 * @return
 */
public static double[][] multiplyMatrix(double[][] a, double[][] b) {
  Matrix am = new Matrix(a);
  Matrix bm = new Matrix(b);
  Matrix c = am.times(bm);
  return c.getArray();
}

代码示例来源:origin: org.openimaj/sandbox

static Matrix computeEssentialMatrix(CameraIntrinsics ci, Matrix F) {
  return ci.calibrationMatrix.transpose().times(F).times(ci.calibrationMatrix);
}

代码示例来源:origin: openimaj/openimaj

@Override
public double[] predict(double[] data) {
  final double[][] corrected = new double[][] { new double[data.length + 1] };
  corrected[0][0] = 1;
  System.arraycopy(data, 0, corrected[0], 1, data.length);
  final Matrix x = new Matrix(corrected);
  return x.times(this.weights).transpose().getArray()[0];
}

代码示例来源:origin: openimaj/openimaj

/**
 * Helper function which adds the constant component to x and returns
 * predicted values for y, one per row
 * 
 * @param x
 * @return predicted y
 */
public Matrix predict(Matrix x) {
  x = new Matrix(appendConstant(x.getArray()));
  return x.times(this.weights);
}

代码示例来源:origin: openimaj/openimaj

static Matrix computeEssentialMatrix(CameraIntrinsics ci, Matrix F) {
  return ci.calibrationMatrix.transpose().times(F).times(ci.calibrationMatrix);
}

代码示例来源:origin: openimaj/openimaj

/**
 * Compute the low rank estimate of the given vector
 * 
 * @param in
 *            the vector
 * @return the low-rank projection of the vector
 */
public double[] project(double[] in) {
  return W.times(new Matrix(new double[][] { in }).transpose()).getColumnPackedCopy();
}

代码示例来源:origin: openimaj/openimaj

private double[] project(double[] vector) {
  final Matrix vec = new Matrix(1, vector.length);
  final double[][] vecarr = vec.getArray();
  for (int i = 0; i < vector.length; i++)
    vecarr[0][i] = vector[i] - mean[i];
  return vec.times(basis).getColumnPackedCopy();
}

相关文章