org.ujmp.core.Matrix.chol()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(90)

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

Matrix.chol介绍

暂无

代码示例

代码示例来源:origin: ujmp/universal-java-matrix-package

public Object call() {
  Matrix result = getMatrixObject().getMatrix().chol();
  return result;
}

代码示例来源:origin: ujmp/universal-java-matrix-package

@Test
public final void testCholRandVerySmall() throws Exception {
  Random random = new Random(System.nanoTime());
  DenseDoubleMatrix2D temp = new DefaultDenseDoubleMatrix2D(2, 2);
  int rows = (int) temp.getRowCount();
  int cols = (int) temp.getColumnCount();
  for (int r = 0; r < rows; r++) {
    for (int c = 0; c < cols; c++) {
      temp.setDouble(random.nextDouble(), r, c);
    }
  }
  Matrix result = createMatrixWithAnnotation(temp.mtimes(temp.transpose()));
  if (!isSupported(result, MatrixLibraries.CHOL, MatrixLayout.SQUARE, Size.SMALL, null)) {
    return;
  }
  Matrix chol = result.chol();
  Matrix prod = chol.mtimes(chol.transpose());
  assertEquals(getLabel(), 0.0, prod.minus(result).getRMS(), TOLERANCE);
  if (result instanceof Erasable) {
    ((Erasable) result).erase();
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

@Test
public final void testCholRandSmall() throws Exception {
  Random random = new Random(System.nanoTime());
  DenseDoubleMatrix2D temp = new DefaultDenseDoubleMatrix2D(10, 10);
  int rows = (int) temp.getRowCount();
  int cols = (int) temp.getColumnCount();
  for (int r = 0; r < rows; r++) {
    for (int c = 0; c < cols; c++) {
      temp.setDouble(random.nextDouble(), r, c);
    }
  }
  Matrix result = createMatrixWithAnnotation(temp.mtimes(temp.transpose()));
  if (!isSupported(result, MatrixLibraries.CHOL, MatrixLayout.SQUARE, Size.SMALL, null)) {
    return;
  }
  Matrix chol = result.chol();
  Matrix prod = chol.mtimes(chol.transpose());
  assertEquals(getLabel(), 0.0, prod.minus(result).getRMS(), TOLERANCE);
  if (result instanceof Erasable) {
    ((Erasable) result).erase();
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

@Test
public final void testCholRandLarge() throws Exception {
  if (!isTestLarge()) {
    return;
  }
  Random random = new Random(System.nanoTime());
  DenseDoubleMatrix2D temp = new DefaultDenseDoubleMatrix2D(102, 102);
  int rows = (int) temp.getRowCount();
  int cols = (int) temp.getColumnCount();
  for (int r = 0; r < rows; r++) {
    for (int c = 0; c < cols; c++) {
      temp.setDouble(random.nextDouble(), r, c);
    }
  }
  Matrix result = createMatrixWithAnnotation(temp.mtimes(temp.transpose()));
  if (!isSupported(result, MatrixLibraries.CHOL, MatrixLayout.SQUARE, Size.LARGE, null)) {
    return;
  }
  Matrix chol = result.chol();
  Matrix prod = chol.mtimes(chol.transpose());
  assertEquals(0.0, prod.minus(result).getRMS(), TOLERANCE);
  if (result instanceof Erasable) {
    ((Erasable) result).erase();
  }
}

代码示例来源:origin: org.ujmp/ujmp-examples

Matrix[] luDecomposition = dense.lu();
Matrix[] qrDecomposition = dense.qr();
Matrix choleskyDecomposition = dense.chol();

代码示例来源:origin: ujmp/universal-java-matrix-package

Matrix[] luDecomposition = dense.lu();
Matrix[] qrDecomposition = dense.qr();
Matrix choleskyDecomposition = dense.chol();

代码示例来源:origin: ujmp/universal-java-matrix-package

@Test
public final void testCholPascalSmall() throws Exception {
  Matrix pascal = Matrix.Factory.pascal(5, 5);
  Matrix a = createMatrixWithAnnotation(pascal);
  if (!isSupported(a, MatrixLibraries.CHOL, MatrixLayout.SQUARE, Size.SMALL, null)) {
    return;
  }
  Matrix chol = a.chol();
  Matrix cholTrans = chol.transpose();
  Matrix prod = chol.mtimes(cholTrans);
  Matrix diff = prod.minus(a);
  assertEquals(getLabel(), 0.0, diff.getRMS(), TOLERANCE);
  if (a instanceof Erasable) {
    ((Erasable) a).erase();
  }
  if (prod instanceof Erasable) {
    ((Erasable) prod).erase();
  }
  if (diff instanceof Erasable) {
    ((Erasable) diff).erase();
  }
}

相关文章

Matrix类方法