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

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

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

Matrix.isScalar介绍

暂无

代码示例

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

private Object getSingleValue(PExpression expression) throws Exception {
  Matrix m = MathUtil.getMatrix(getObject(expression));
  if (m.isScalar()) {
    return m.getAsObject(0, 0);
  } else {
    return m.doubleValue();
  }
}

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

public static final Matrix getMatrix(Object o) {
  if (o == null) {
    return null;
  }
  if (o instanceof Matrix) {
    Matrix m = (Matrix) o;
    if (m.isScalar() && m.getAsObject(0, 0) instanceof Matrix) {
      return getMatrix(m.getAsObject(0, 0));
    } else {
      return m;
    }
  } else {
    return Matrix.Factory.linkToValue(o);
  }
}

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

public Xor(Matrix m1, Matrix m2) {
  super(m1, m2);
  if (m2.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[1] = Matrix.Factory.fill(m2.getAsBoolean(0, 0), m1.getSize());
  } else if (m1.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[0] = Matrix.Factory.fill(m1.getAsBoolean(0, 0), m2.getSize());
  }
}

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

public Or(Matrix m1, Matrix m2) {
  super(m1, m2);
  if (m2.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[1] = Matrix.Factory.fill(m2.getAsBoolean(0, 0), m1.getSize());
  } else if (m1.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[0] = Matrix.Factory.fill(m1.getAsBoolean(0, 0), m2.getSize());
  }
}

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

public Power(Matrix m1, Matrix m2) {
  super(m1, m2);
  if (m2.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[1] = Matrix.Factory.fill(m2.getAsDouble(0, 0), m1.getSize());
  }
}

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

public Eq(Matrix m1, Matrix m2) {
  super(m1, m2);
  if (m2.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[1] = Matrix.Factory.fill(m2.getAsObject(0, 0), m1.getSize());
  } else if (m1.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[0] = Matrix.Factory.fill(m1.getAsObject(0, 0), m2.getSize());
  }
}

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

public And(Matrix m1, Matrix m2) {
  super(m1, m2);
  if (m2.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[1] = Matrix.Factory.fill(m2.getAsBoolean(0, 0), m1.getSize());
  } else if (m1.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[0] = Matrix.Factory.fill(m1.getAsBoolean(0, 0), m2.getSize());
  }
}

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

public Lt(Matrix m1, Matrix m2) {
  super(m1, m2);
  if (m2.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[1] = Matrix.Factory.fill(m2.getAsDouble(0, 0), m1.getSize());
  } else if (m1.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[0] = Matrix.Factory.fill(m1.getAsDouble(0, 0), m2.getSize());
  }
}

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

public Gt(Matrix m1, Matrix m2) {
  super(m1, m2);
  if (m2.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[1] = Matrix.Factory.fill(m2.getAsDouble(0, 0), m1.getSize());
  } else if (m1.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[0] = Matrix.Factory.fill(m1.getAsDouble(0, 0), m2.getSize());
  }
}

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

public Ne(Matrix m1, Matrix m2) {
  super(m1, m2);
  if (m2.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[1] = Matrix.Factory.fill(m2.getAsObject(0, 0), m1.getSize());
  } else if (m1.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[0] = Matrix.Factory.fill(m1.getAsObject(0, 0), m2.getSize());
  }
}

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

public Le(Matrix m1, Matrix m2) {
  super(m1, m2);
  if (m2.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[1] = Matrix.Factory.fill(m2.getAsDouble(0, 0), m1.getSize());
  } else if (m1.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[0] = Matrix.Factory.fill(m1.getAsDouble(0, 0), m2.getSize());
  }
}

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

public Ge(Matrix m1, Matrix m2) {
  super(m1, m2);
  if (m2.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[1] = Matrix.Factory.fill(m2.getAsDouble(0, 0), m1.getSize());
  } else if (m1.isScalar() && !Coordinates.equals(m1.getSize(), m2.getSize())) {
    getSources()[0] = Matrix.Factory.fill(m1.getAsDouble(0, 0), m2.getSize());
  }
}

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

} else if (m.isScalar()) {
  indices = new int[] { 0, 1 };
  values = new double[] { m.getAsDouble(0, 0), 1 - m.getAsDouble(0, 0) };

相关文章

Matrix类方法