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

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

本文整理了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

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

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

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

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

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

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

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

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

/**
 * Set the value of the ndarray to the specified value
 *
 * @param value the value to assign
 * @return the ndarray with the values
 */
@Override
public IComplexNDArray assign(Number value) {
  IComplexNDArray one = linearView();
  for (int i = 0; i < one.length(); i++)
    one.putScalar(i, Nd4j.createDouble(value.doubleValue(), 0));
  return this;
}

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

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

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

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

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

/**
 * Return the cos of a complex number
 *
 * @param num the tanh of a complex number
 * @return the tanh of a complex number
 */
public static IComplexNumber cos(IComplexNumber num) {
  Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).cos();
  return Nd4j.createDouble(c.getReal(), c.getImaginary());
}

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

/**
 * Return the tanh of a complex number
 *
 * @param num the tanh of a complex number
 * @return the tanh of a complex number
 */
public static IComplexNumber tanh(IComplexNumber num) {
  Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).tanh();
  return Nd4j.createDouble(c.getReal(), c.getImaginary());
}

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

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

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

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

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

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

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

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

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

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

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

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

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

/**
 * Return the  ceiling value of the given complex number
 *
 * @param num the number to getScalar the absolute value for
 * @return the absolute value of this complex number
 */
public static IComplexNumber ceil(IComplexNumber num) {
  Complex c = new Complex(FastMath.ceil(num.realComponent().doubleValue()),
          FastMath.ceil(num.imaginaryComponent().doubleValue()));
  return Nd4j.createDouble(c.getReal(), c.getImaginary());
}

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

/**
 * Return the  floor value of the given complex number
 *
 * @param num the number to getScalar the absolute value for
 * @return the absolute value of this complex number
 */
public static IComplexNumber floor(IComplexNumber num) {
  Complex c = new Complex(FastMath.floor(num.realComponent().doubleValue()),
          FastMath.floor(num.imaginaryComponent().doubleValue()));
  return Nd4j.createDouble(c.getReal(), c.getImaginary());
}

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

/**
 * Return the tanh of a complex number
 *
 * @param num the tanh of a complex number
 * @return the tanh of a complex number
 */
public static IComplexNumber hardTanh(IComplexNumber num) {
  Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).tanh();
  if (c.getReal() < -1.0)
    c = new Complex(-1.0, c.getImaginary());
  return Nd4j.createDouble(c.getReal(), c.getImaginary());
}

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

/**
 * Compute complex conj (in-place).
 */
@Override
public IComplexNDArray conji() {
  IComplexNDArray reshaped = linearView();
  IComplexDouble c = Nd4j.createDouble(0.0, 0);
  for (int i = 0; i < length(); i++) {
    IComplexNumber conj = reshaped.getComplex(i, c).conj();
    reshaped.putScalar(i, conj);
  }
  return this;
}

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

@Override
public IComplexNDArray hermitian() {
  IComplexNDArray result = Nd4j.createComplex(shape());
  IComplexDouble c = Nd4j.createDouble(0, 0);
  for (int i = 0; i < slices(); i++)
    for (int j = 0; j < columns(); j++)
      result.putScalar(j, i, getComplex(i, j, c).conji());
  return result;
}

相关文章