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

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

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

Matrix.randn介绍

暂无

代码示例

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

public final T randn(final long rows, final long cols) {
  final T m = zeros(rows, cols);
  m.randn(Ret.ORIG);
  return m;
}

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

public final T randn(final long... size) {
  final T m = zeros(size);
  m.randn(Ret.ORIG);
  return m;
}

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

public Object call() {
  MatrixGUIObject m = getMatrixObject();
  m.getMatrix().randn(getRet());
  return m;
}

代码示例来源:origin: jdmp/java-data-mining-package

public Object call() {
  getVariable().getCoreObject().add(getVariable().getCoreObject().getLast().randn(Ret.NEW));
  return null;
}

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

@Test
public final void testLoadSave() throws Exception {
  Matrix m1 = createMatrix(3, 2);
  m1.randn(Ret.ORIG);
  File tmpfile = File.createTempFile("ujmp-junit", ".tmp");
  m1.save(tmpfile);
  Matrix m2 = Matrix.Factory.load(tmpfile);
  assertEquals(m1, m2);
}

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

@Test
public final void testColumnMajorDoubleArray1DConstructor() throws Exception {
  Matrix m = new DefaultDenseDoubleMatrix2D(23, 17);
  setAnnotation(m);
  m.randn(Ret.ORIG);
  Matrix m2 = createMatrixWithAnnotation(m);
  assertEquals(getLabel(), m, m2);
  if (m2 instanceof Erasable) {
    ((Erasable) m2).erase();
  }
}

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

@Test
public final void testRowMajorDoubleArray2DConstructor() throws Exception {
  Matrix m = new ArrayDenseDoubleMatrix2D(23, 17);
  setAnnotation(m);
  m.randn(Ret.ORIG);
  Matrix m2 = createMatrixWithAnnotation(m);
  assertEquals(getLabel(), m, m2);
  if (m2 instanceof Erasable) {
    ((Erasable) m2).erase();
  }
}

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

@Test
public final void testOtherConstructor() throws Exception {
  Matrix m = new DefaultDenseDoubleMatrixMultiD(23, 17);
  setAnnotation(m);
  m.randn(Ret.ORIG);
  Matrix m2 = createMatrixWithAnnotation(m);
  assertEquals(getLabel(), m, m2);
  if (m2 instanceof Erasable) {
    ((Erasable) m2).erase();
  }
}

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

@Test
public final void testToDoubleArraySmall() throws Exception {
  Matrix m = createMatrixWithAnnotation(6, 7);
  m.randn(Ret.ORIG);
  double[][] array = m.toDoubleArray();
  for (int r = 0; r < m.getRowCount(); r++) {
    for (int c = 0; c < m.getColumnCount(); c++) {
      assertEquals(getLabel(), m.getAsDouble(r, c), array[r][c], 0.0);
    }
  }
  if (m instanceof Erasable) {
    ((Erasable) m).erase();
  }
}

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

@Test
public final void testQRRandSquareSmall() throws Exception {
  Matrix a = createMatrixWithAnnotation(7, 7);
  a.randn(Ret.ORIG);
  Matrix[] qr = a.qr();
  Matrix prod = qr[0].mtimes(qr[1]);
  assertEquals(0.0, prod.minus(a).getRMS(), TOLERANCE);
  if (a instanceof Erasable) {
    ((Erasable) a).erase();
  }
  if (prod instanceof Erasable) {
    ((Erasable) prod).erase();
  }
}

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

@Test
public final void testXPlus0MatrixMatrix() throws Exception {
  Matrix m1 = createMatrixWithAnnotation(5, 7);
  Matrix m2 = createMatrixWithAnnotation(5, 7);
  m1.randn(Ret.ORIG);
  Matrix m3 = m1.plus(m2);
  assertEquals(getLabel(), m1, m3);
  if (m1 instanceof Erasable) {
    ((Erasable) m1).erase();
  }
  if (m2 instanceof Erasable) {
    ((Erasable) m2).erase();
  }
  if (m3 instanceof Erasable) {
    ((Erasable) m3).erase();
  }
}

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

@Test
public final void test0PlusXMatrix() throws Exception {
  Matrix m1 = createMatrixWithAnnotation(5, 7);
  Matrix m2 = createMatrixWithAnnotation(5, 7);
  m2.randn(Ret.ORIG);
  Matrix m3 = m1.plus(m2);
  assertEquals(getLabel(), m2, m3);
  if (m1 instanceof Erasable) {
    ((Erasable) m1).erase();
  }
  if (m2 instanceof Erasable) {
    ((Erasable) m2).erase();
  }
  if (m3 instanceof Erasable) {
    ((Erasable) m3).erase();
  }
}

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

@Test
public final void testSVDSquareRandLarge() throws Exception {
  if (!isTestLarge()) {
    return;
  }
  Matrix a = createMatrixWithAnnotation(109, 109);
  a.randn(Ret.ORIG);
  Matrix[] svd = a.svd();
  Matrix prod = svd[0].mtimes(svd[1]).mtimes(svd[2].transpose());
  assertEquals(0.0, prod.minus(a).getRMS(), TOLERANCE);
  if (a instanceof Erasable) {
    ((Erasable) a).erase();
  }
}

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

@Test
public final void testXTimes0Matrix() throws Exception {
  Matrix m1 = createMatrixWithAnnotation(5, 7);
  Matrix m2 = createMatrixWithAnnotation(5, 7);
  m1.randn(Ret.ORIG);
  Matrix m3 = m1.times(m2);
  assertTrue(getLabel(), m3.isEmpty());
  if (m1 instanceof Erasable) {
    ((Erasable) m1).erase();
  }
  if (m2 instanceof Erasable) {
    ((Erasable) m2).erase();
  }
  if (m3 instanceof Erasable) {
    ((Erasable) m3).erase();
  }
}

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

@Test
public final void test0DivideXMatrix() throws Exception {
  Matrix m1 = createMatrixWithAnnotation(5, 7);
  Matrix m2 = createMatrixWithAnnotation(5, 7);
  m2.randn(Ret.ORIG);
  Matrix m3 = m1.divide(m2);
  assertTrue(getLabel(), m3.isEmpty());
  if (m1 instanceof Erasable) {
    ((Erasable) m1).erase();
  }
  if (m2 instanceof Erasable) {
    ((Erasable) m2).erase();
  }
  if (m3 instanceof Erasable) {
    ((Erasable) m3).erase();
  }
}

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

@Test
public final void test0TimesXMatrix() throws Exception {
  Matrix m1 = createMatrixWithAnnotation(5, 7);
  Matrix m2 = createMatrixWithAnnotation(5, 7);
  m2.randn(Ret.ORIG);
  Matrix m3 = m1.times(m2);
  assertTrue(getLabel(), m3.isEmpty());
  if (m1 instanceof Erasable) {
    ((Erasable) m1).erase();
  }
  if (m2 instanceof Erasable) {
    ((Erasable) m2).erase();
  }
  if (m3 instanceof Erasable) {
    ((Erasable) m3).erase();
  }
}

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

@Test
public final void testSVDSquareRandSmall() throws Exception {
  Matrix a = createMatrixWithAnnotation(10, 10);
  if (!isSupported(a, MatrixLibraries.SVD, MatrixLayout.SQUARE, Size.SMALL, EntryType.RANDN)) {
    return;
  }
  a.randn(Ret.ORIG);
  Matrix[] svd = a.svd();
  Matrix prod = svd[0].mtimes(svd[1]).mtimes(svd[2].transpose());
  assertEquals(0.0, prod.minus(a).getRMS(), TOLERANCE);
  if (a instanceof Erasable) {
    ((Erasable) a).erase();
  }
}

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

@Test
public final void testToDoubleArrayLarge() throws Exception {
  if (!isTestLarge()) {
    return;
  }
  Matrix m = createMatrixWithAnnotation(106, 117);
  m.randn(Ret.ORIG);
  double[][] array = m.toDoubleArray();
  for (int r = 0; r < m.getRowCount(); r++) {
    for (int c = 0; c < m.getColumnCount(); c++) {
      assertEquals(getLabel(), m.getAsDouble(r, c), array[r][c], 0.0);
    }
  }
  if (m instanceof Erasable) {
    ((Erasable) m).erase();
  }
}

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

@Test
public final void testEigRandSmall() throws Exception {
  Matrix a = createMatrixWithAnnotation(10, 10);
  if (!isSupported(a, MatrixLibraries.EIG, MatrixLayout.SQUARE, Size.SMALL, EntryType.RANDN)) {
    return;
  }
  a.randn(Ret.ORIG);
  Matrix[] eig = a.eig();
  Matrix prod1 = a.mtimes(eig[0]);
  Matrix prod2 = eig[0].mtimes(eig[1]);
  assertEquals(getLabel(), 0.0, prod1.minus(prod2).getRMS(), TOLERANCE);
  if (a instanceof Erasable) {
    ((Erasable) a).erase();
  }
}

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

@Test
public final void testClear() throws Exception {
  Matrix m = createMatrix(3, 2);
  m.randn(Ret.ORIG);
  m.clear();
  assertEquals(0.0, m.getAsDouble(0, 0), TOLERANCE);
  assertEquals(0.0, m.getAsDouble(1, 0), TOLERANCE);
  assertEquals(0.0, m.getAsDouble(2, 0), TOLERANCE);
  assertEquals(0.0, m.getAsDouble(0, 1), TOLERANCE);
  assertEquals(0.0, m.getAsDouble(1, 1), TOLERANCE);
  assertEquals(0.0, m.getAsDouble(2, 1), TOLERANCE);
}

相关文章

Matrix类方法