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

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

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

Matrix.setMatrix介绍

暂无

代码示例

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

public void multipleLinearRegression(Matrix datay, Matrix dataX, boolean interceptTerm) {
  b0Term = interceptTerm;
  if (interceptTerm) { // first column of X is filled with 1s if b_0 != 0
    int row = dataX.getRowDimension();
    int col = dataX.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);
    B.setMatrix(0, row - 1, 0, 0, ones);
    B.setMatrix(0, row - 1, 1, col, dataX);
    multipleLinearRegression(datay, B);
  } else {
    multipleLinearRegression(datay, dataX);
  }
}

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

public void multipleLinearRegression(Matrix datay, Matrix dataX, boolean interceptTerm) {
  b0Term = interceptTerm;
  if (interceptTerm) { // first column of X is filled with 1s if b_0 != 0
    int row = dataX.getRowDimension();
    int col = dataX.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);
    B.setMatrix(0, row - 1, 0, 0, ones);
    B.setMatrix(0, row - 1, 1, col, dataX);
    multipleLinearRegression(datay, B);
  } else {
    multipleLinearRegression(datay, dataX);
  }
}

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

for (int i = 0; i < row; i++)
  ones.set(i, 0, 1.0);
B.setMatrix(0, row - 1, 0, 0, ones);
B.setMatrix(0, row - 1, 1, col, data);
data = B;

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

for (int i = 0; i < row; i++)
  ones.set(i, 0, 1.0);
B.setMatrix(0, row - 1, 0, 0, ones);
B.setMatrix(0, row - 1, 1, col, data);
data = B;

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

for (int i = 0; i < row; i++)
  ones.set(i, 0, 1.0);
B.setMatrix(0, row - 1, 0, 0, ones);
B.setMatrix(0, row - 1, 1, col, A);
B.print(row, 3);

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

for (int i = 0; i < row; i++)
  ones.set(i, 0, 1.0);
B.setMatrix(0, row - 1, 0, 0, ones);
B.setMatrix(0, row - 1, 1, col, A);
B.print(row, 3);

代码示例来源:origin: broadgsa/gatk-protected

public void zeroOutSigma() {
  final double[][] zeroSigma = new double[mu.length][mu.length];
  for( final double[] row : zeroSigma ) {
    Arrays.fill(row, 0);
  }
  final Matrix tmp = new Matrix(zeroSigma);
  sigma.setMatrix(0, mu.length - 1, 0, mu.length - 1, tmp);
}

代码示例来源:origin: net.imglib2/imglib2-realtransform

protected void invert()
{
  final Matrix ii = a.inverse();
  inverse.a.setMatrix( 0, n - 1, 0, n - 1, ii );
  invertT();
}

代码示例来源:origin: broadgsa/gatk-protected

public void initializeRandomSigma( final Random rand ) {
  final double[][] randSigma = new double[mu.length][mu.length];
  for( int iii = 0; iii < mu.length; iii++ ) {
    for( int jjj = iii; jjj < mu.length; jjj++ ) {
      randSigma[jjj][iii] = 0.55 + 1.25 * rand.nextDouble();
      if( rand.nextBoolean() ) {
        randSigma[jjj][iii] *= -1.0;
      }
      if( iii != jjj ) { randSigma[iii][jjj] = 0.0; } // Sigma is a symmetric, positive-definite matrix created by taking a lower diagonal matrix and multiplying it by its transpose
    }
  }
  Matrix tmp = new Matrix( randSigma );
  tmp = tmp.times(tmp.transpose());
  sigma.setMatrix(0, mu.length - 1, 0, mu.length - 1, tmp);
}

代码示例来源:origin: broadgsa/gatk-protected

protected GaussianMixtureModel(final List<MultivariateGaussian> gaussians, final double shrinkage, final double dirichletParameter, final double priorCounts ) {
  this.gaussians = gaussians;
  final int numAnnotations = gaussians.get(0).mu.length;
  this.shrinkage = shrinkage;
  this.dirichletParameter = dirichletParameter;
  this.priorCounts = priorCounts;
  for( final MultivariateGaussian gaussian : gaussians ) {
    gaussian.hyperParameter_a = priorCounts;
    gaussian.hyperParameter_b = shrinkage;
    gaussian.hyperParameter_lambda = dirichletParameter;
  }
  empiricalMu = new double[numAnnotations];
  empiricalSigma = new Matrix(numAnnotations, numAnnotations);
  isModelReadyForEvaluation = false;
  Arrays.fill(empiricalMu, 0.0);
  empiricalSigma.setMatrix(0, empiricalMu.length - 1, 0, empiricalMu.length - 1, Matrix.identity(empiricalMu.length, empiricalMu.length).times(200.0).inverse());
}

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

@Override
public Matrix getTransform(){
  Matrix m = new Matrix(3,3);
  m.setMatrix(0, 1, 0,1,this.transform);
  m.set(0, 2, 0);
  m.set(1, 2, 0);
  m.set(2, 2, 1);
  return m;
}

代码示例来源:origin: org.openimaj/image-local-features

@Override
public Matrix getTransform(){
  Matrix m = new Matrix(3,3);
  m.setMatrix(0, 1, 0,1,this.transform);
  m.set(0, 2, 0);
  m.set(1, 2, 0);
  m.set(2, 2, 1);
  return m;
}

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

/**
 * Set the matrix, any images processed from this point forward will be
 * projected using this matrix
 * 
 * @param matrix
 *            a 3x3 matrix representing a 2d transform
 */
public void setMatrix(Matrix matrix) {
  if (matrix.getRowDimension() == 2) {
    final int c = matrix.getColumnDimension() - 1;
    currentMatrix = new Matrix(3, 3);
    currentMatrix.setMatrix(0, 1, 0, c, matrix);
    currentMatrix.set(2, 2, 1);
  } else {
    this.currentMatrix = matrix;
  }
}

代码示例来源:origin: org.openimaj/image-processing

/**
 * Set the matrix, any images processed from this point forward will be
 * projected using this matrix
 * 
 * @param matrix
 *            a 3x3 matrix representing a 2d transform
 */
public void setMatrix(Matrix matrix) {
  if (matrix.getRowDimension() == 2) {
    final int c = matrix.getColumnDimension() - 1;
    currentMatrix = new Matrix(3, 3);
    currentMatrix.setMatrix(0, 1, 0, c, matrix);
    currentMatrix.set(2, 2, 1);
  } else {
    this.currentMatrix = matrix;
  }
}

代码示例来源:origin: net.imglib2/imglib2-realtransform

public AbstractAffineTransform( final Matrix matrix )
{
  assert matrix.getRowDimension() == matrix.getColumnDimension() - 1: "The passed affine matrix must be of the format (n-1)*n.";
  n = matrix.getRowDimension();
  a = new Matrix( n, n );
  t = new double[ n ];
  tmp = new double[ n ];
  ds = new RealPoint[ n ];
  a.setMatrix( 0, n - 1, 0, n - 1, matrix );
  for ( int r = 0; r < n; ++r )
  {
    t[ r ] = matrix.get( r, n );
    ds[ r ] = new RealPoint( n );
  }
  updateDs();
}

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

/**
 * @param transform
 * @return transformed ellipse
 */
public Matrix transformAffineCovar(Matrix transform) {
  // Matrix translated =
  // transform.times(TransformUtilities.translateMatrix((float)this.x,
  // (float)this.y));
  // Matrix affineTransform =
  // TransformUtilities.homographyToAffine(translated);
  // affineTransform = affineTransform.times(1/affineTransform.get(2, 2));
  final Matrix affineTransform = TransformUtilities.homographyToAffine(transform, this.x, this.y);
  final Matrix affineCovar = EllipseUtilities.ellipseToCovariance(this);
  Matrix newTransform = new Matrix(3, 3);
  newTransform.setMatrix(0, 1, 0, 1, affineCovar);
  newTransform.set(2, 2, 1);
  newTransform = affineTransform.times(newTransform).times(affineTransform.transpose());
  return newTransform;
}

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

/**
 * see {@link UpdateableCholeskyDecomposition#choldowndate(double[][], double[])}
 * @param x
 * @param b
 */
public void choldowndate(double[] x, boolean b) {
  if(b)  x = x.clone();
  Matrix L = this.getL();
  // work is done on an upper triangular matrix
  double[][] data = L.transpose().getArray();
  choldowndate(data, x);
  // Make the output lower triangular again
  int Ll = L.getRowDimension();
  L.setMatrix(0, Ll-1, 0, Ll-1, new Matrix(data, Ll, Ll).transpose());
}

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

/**
 * See {@link #cholupdate(double[][], double[])}
 * @param x
 * @param copyX copy x, x is used as a workspace
 */
public void cholupdate(double[] x, boolean copyX){
  if(copyX){
    x = x.clone();
  }
  Matrix L = this.getL();
  // work is done on an upper triangular matrix
  double[][] data = L.transpose().getArray();
  cholupdate(data, x);
  // Make the output lower triangular again
  int Ll = L.getRowDimension();
  L.setMatrix(0, Ll-1, 0, Ll-1, new Matrix(data, Ll, Ll).transpose());
}
/**

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

void metricUpgrade(Matrix R) {
  assert ((R.getRowDimension() == 3) && (R.getColumnDimension() == 3));
  SingularValueDecomposition svd = R.svd();
  Matrix X = svd.getU().times(svd.getV().transpose());
  Matrix W = Matrix.identity(3, 3);
  W.set(2, 2, X.det());
  R.setMatrix(0, 3 - 1, 0, 3 - 1,
      svd.getU().times(W).times(svd.getV().transpose()));
}

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

void metricUpgrade(Matrix R) {
  assert ((R.getRowDimension() == 3) && (R.getColumnDimension() == 3));
  SingularValueDecomposition svd = R.svd();
  Matrix X = svd.getU().times(svd.getV().transpose());
  Matrix W = Matrix.identity(3, 3);
  W.set(2, 2, X.det());
  R.setMatrix(0, 3 - 1, 0, 3 - 1,
      svd.getU().times(W).times(svd.getV().transpose()));
}

相关文章