org.nd4j.linalg.factory.Nd4j.createDouble()方法的使用及代码示例

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

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

Nd4j.createDouble介绍

[英]Create an instance of a complex double
[中]创建一个复杂双精度的实例

代码示例

代码示例来源:origin: deeplearning4j/nd4j

  1. @Override
  2. public IComplexNDArray rdivi(Number n, INDArray result) {
  3. return rdivi(Nd4j.createDouble(n.doubleValue(), 0), result);
  4. }

代码示例来源:origin: deeplearning4j/nd4j

  1. @Override
  2. public IComplexNDArray divi(Number n, INDArray result) {
  3. return divi(Nd4j.createDouble(n.doubleValue(), 0), result);
  4. }

代码示例来源:origin: deeplearning4j/nd4j

  1. @Override
  2. public IComplexNDArray muli(Number n, INDArray result) {
  3. return muli(Nd4j.createDouble(n.doubleValue(), 0), result);
  4. }

代码示例来源:origin: deeplearning4j/nd4j

  1. @Override
  2. public IComplexNDArray addi(Number n, INDArray result) {
  3. return addi(Nd4j.createDouble(n.doubleValue(), 0), result);
  4. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Set the value of the ndarray to the specified value
  3. *
  4. * @param value the value to assign
  5. * @return the ndarray with the values
  6. */
  7. @Override
  8. public IComplexNDArray assign(Number value) {
  9. IComplexNDArray one = linearView();
  10. for (int i = 0; i < one.length(); i++)
  11. one.putScalar(i, Nd4j.createDouble(value.doubleValue(), 0));
  12. return this;
  13. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the absolute value of the given complex number
  3. *
  4. * @param num the number to getScalar the absolute value for
  5. * @return the absolute value of this complex number
  6. */
  7. public static IComplexNumber abs(IComplexNumber num) {
  8. double c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).abs();
  9. return Nd4j.createDouble(c, 0);
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the sin value of the given complex number
  3. *
  4. * @param num the number to getScalar the absolute value for
  5. * @return the absolute value of this complex number
  6. */
  7. public static IComplexNumber asin(IComplexNumber num) {
  8. Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).asin();
  9. return Nd4j.createDouble(c.getReal(), c.getImaginary());
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the cos of a complex number
  3. *
  4. * @param num the tanh of a complex number
  5. * @return the tanh of a complex number
  6. */
  7. public static IComplexNumber cos(IComplexNumber num) {
  8. Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).cos();
  9. return Nd4j.createDouble(c.getReal(), c.getImaginary());
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the tanh of a complex number
  3. *
  4. * @param num the tanh of a complex number
  5. * @return the tanh of a complex number
  6. */
  7. public static IComplexNumber tanh(IComplexNumber num) {
  8. Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).tanh();
  9. return Nd4j.createDouble(c.getReal(), c.getImaginary());
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the sin value of the given complex number
  3. *
  4. * @param num the number to getScalar the absolute value for
  5. * @return the absolute value of this complex number
  6. */
  7. public static IComplexNumber sin(IComplexNumber num) {
  8. Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).sin();
  9. return Nd4j.createDouble(c.getReal(), c.getImaginary());
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the log value of the given complex number
  3. *
  4. * @param num the number to getScalar the absolute value for
  5. * @return the absolute value of this complex number
  6. */
  7. public static IComplexNumber log(IComplexNumber num) {
  8. Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).log();
  9. return Nd4j.createDouble(c.getReal(), c.getImaginary());
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the log value of the given complex number
  3. *
  4. * @param num the number to getScalar the absolute value for
  5. * @return the absolute value of this complex number
  6. */
  7. public static IComplexNumber neg(IComplexNumber num) {
  8. Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).negate();
  9. return Nd4j.createDouble(c.getReal(), c.getImaginary());
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the sin value of the given complex number
  3. *
  4. * @param num the number to getScalar the absolute value for
  5. * @return the absolute value of this complex number
  6. */
  7. public static IComplexNumber atan(IComplexNumber num) {
  8. Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).atan();
  9. return Nd4j.createDouble(c.getReal(), c.getImaginary());
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the sin value of the given complex number
  3. *
  4. * @param num the number to getScalar the absolute value for
  5. * @return the absolute value of this complex number
  6. */
  7. public static IComplexNumber acos(IComplexNumber num) {
  8. Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).acos();
  9. return Nd4j.createDouble(c.getReal(), c.getImaginary());
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the absolute value of the given complex number
  3. *
  4. * @param num the number to getScalar the absolute value for
  5. * @return the absolute value of this complex number
  6. */
  7. public static IComplexNumber sqrt(IComplexNumber num) {
  8. Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).sqrt();
  9. return Nd4j.createDouble(c.getReal(), c.getImaginary());
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the ceiling value of the given complex number
  3. *
  4. * @param num the number to getScalar the absolute value for
  5. * @return the absolute value of this complex number
  6. */
  7. public static IComplexNumber ceil(IComplexNumber num) {
  8. Complex c = new Complex(FastMath.ceil(num.realComponent().doubleValue()),
  9. FastMath.ceil(num.imaginaryComponent().doubleValue()));
  10. return Nd4j.createDouble(c.getReal(), c.getImaginary());
  11. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the floor value of the given complex number
  3. *
  4. * @param num the number to getScalar the absolute value for
  5. * @return the absolute value of this complex number
  6. */
  7. public static IComplexNumber floor(IComplexNumber num) {
  8. Complex c = new Complex(FastMath.floor(num.realComponent().doubleValue()),
  9. FastMath.floor(num.imaginaryComponent().doubleValue()));
  10. return Nd4j.createDouble(c.getReal(), c.getImaginary());
  11. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Return the tanh of a complex number
  3. *
  4. * @param num the tanh of a complex number
  5. * @return the tanh of a complex number
  6. */
  7. public static IComplexNumber hardTanh(IComplexNumber num) {
  8. Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).tanh();
  9. if (c.getReal() < -1.0)
  10. c = new Complex(-1.0, c.getImaginary());
  11. return Nd4j.createDouble(c.getReal(), c.getImaginary());
  12. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Compute complex conj (in-place).
  3. */
  4. @Override
  5. public IComplexNDArray conji() {
  6. IComplexNDArray reshaped = linearView();
  7. IComplexDouble c = Nd4j.createDouble(0.0, 0);
  8. for (int i = 0; i < length(); i++) {
  9. IComplexNumber conj = reshaped.getComplex(i, c).conj();
  10. reshaped.putScalar(i, conj);
  11. }
  12. return this;
  13. }

代码示例来源:origin: deeplearning4j/nd4j

  1. @Override
  2. public IComplexNDArray hermitian() {
  3. IComplexNDArray result = Nd4j.createComplex(shape());
  4. IComplexDouble c = Nd4j.createDouble(0, 0);
  5. for (int i = 0; i < slices(); i++)
  6. for (int j = 0; j < columns(); j++)
  7. result.putScalar(j, i, getComplex(i, j, c).conji());
  8. return result;
  9. }

相关文章