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

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

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

Matrix.getAsDouble介绍

暂无

代码示例

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

public double getDouble(long... coordinates) {
  if (cumprod == null) {
    createMatrix();
  }
  return cumprod.getAsDouble(coordinates);
}

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

public static double calc(Matrix m) {
    double max = -Double.MAX_VALUE;
    double v = 0.0;
    for (long[] c : m.availableCoordinates()) {
      max = (v = m.getAsDouble(c)) > max ? v : max;
    }
    max = max == -Double.MAX_VALUE ? Double.NaN : max;
    return max;
  }
}

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

public static Matrix stringToVector(String string, int size) {
    Matrix m = Matrix.Factory.zeros(size, 1);
    StringTokenizer st = new StringTokenizer(string, " \t\n\r\f,.:;?![]'");
    while (st.hasMoreElements()) {
      long index = Math.abs(st.nextElement().toString().toLowerCase().hashCode()) % size;
      m.setAsDouble(m.getAsDouble(index, 0) + 1, index, 0);
    }
    return m;
  }
}

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

public static double recall(Matrix confusionMatrix, long catIndex) {
  VerifyUtil.verifySquare(confusionMatrix);
  double tp = confusionMatrix.getAsDouble(catIndex, catIndex);
  double fn = 0;
  for (int r = 0; r < confusionMatrix.getRowCount(); r++) {
    if (r == catIndex) {
      continue;
    }
    fn += confusionMatrix.getAsDouble(r, catIndex);
  }
  return recall(tp, fn);
}

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

private List<Sortable<Double, Matrix>> getSortedNeighbors(long... coordinates) {
  List<Sortable<Double, Matrix>> neighbors = new ArrayList<Sortable<Double, Matrix>>();
  List<Integer> candidates = getCandidates(coordinates);
  for (int candidateRow : candidates) {
    double dist = distanceMatrix.getAsDouble(coordinates[ROW], candidateRow);
    Matrix candidate = getSource().selectRows(Ret.LINK, candidateRow);
    neighbors.add(new Sortable<Double, Matrix>(dist, candidate));
  }
  Collections.sort(neighbors);
  return neighbors;
}

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

public Map<String, Object> calculateObjects(Map<String, Object> input) {
  Map<String, Object> result = new HashMap<String, Object>();
  Matrix in = Matrix.Factory.copyFromMatrix(MathUtil.getMatrix(input.get(SOURCE)));
  for (long[] c : in.allCoordinates()) {
    in.setAsDouble(getProbability(in.getAsDouble(c)), c);
  }
  result.put(TARGET, in);
  return result;
}

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

public Long call() throws Exception {
  Matrix newColumn = replaceInColumn(getSource(), bestGuess, column);
  synchronized (imputed) {
    for (int r = 0; r < newColumn.getRowCount(); r++) {
      imputed.setAsDouble(newColumn.getAsDouble(r, 0), r, column);
    }
  }
  return column;
}

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

public Long call() throws Exception {
  Matrix newColumn = replaceInColumn(getSource(), firstGuess, column);
  for (int r = 0; r < newColumn.getRowCount(); r++) {
    imputed.setAsDouble(newColumn.getAsDouble(r, 0), r, column);
  }
  return column;
}

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

public final boolean isDiscrete() {
  for (Sample s : this) {
    Matrix input = s.getAsMatrix(INPUT);
    for (long[] c : input.availableCoordinates()) {
      if (!MathUtil.isDiscrete(input.getAsDouble(c))) {
        return false;
      }
    }
  }
  return true;
}

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

private boolean containsMissingValues(long c) {
  for (int r = 0; r < getSource().getRowCount(); r++) {
    if (MathUtil.isNaNOrInfinite(getSource().getAsDouble(r, c))) {
      return true;
    }
  }
  return false;
}

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

public VolatileSparseObjectMatrix(Matrix m) {
  super(m.getSize());
  this.size = Coordinates.copyOf(m.getSize());
  for (long[] c : m.allCoordinates()) {
    setAsDouble(m.getAsDouble(c), c);
  }
}

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

public CommonsMathBlockDenseDoubleMatrix2D(org.ujmp.core.Matrix source) {
  this(source.getSize());
  for (long[] c : source.availableCoordinates()) {
    setDouble(source.getAsDouble(c), c);
  }
  MapMatrix<String, Object> a = source.getMetaData();
  if (a != null) {
    setMetaData(a.clone());
  }
}

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

public CommonsMathArrayDenseDoubleMatrix2D(org.ujmp.core.Matrix source) {
  this(source.getSize());
  for (long[] c : source.availableCoordinates()) {
    setDouble(source.getAsDouble(c), c);
  }
  MapMatrix<String, Object> a = source.getMetaData();
  if (a != null) {
    setMetaData(a.clone());
  }
}

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

public double getDouble(long... coordinates) {
  if (inv == null) {
    DenseMatrix A = new MTJDenseDoubleMatrix2D(getSource()).getWrappedObject();
    DenseMatrix I = Matrices.identity((int) getSource().getColumnCount());
    DenseMatrix AI = I.copy();
    inv = new MTJDenseDoubleMatrix2D((DenseMatrix) A.solve(I, AI));
  }
  return inv.getAsDouble(coordinates);
}

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

public double getDouble(long... coordinates) {
  if (inv == null) {
    DenseMatrix A = new MTJDenseDoubleMatrix2D(getSource()).getWrappedObject();
    DenseMatrix I = Matrices.identity((int) getSource().getColumnCount());
    DenseMatrix AI = I.copy();
    inv = new MTJDenseDoubleMatrix2D((DenseMatrix) A.solve(I, AI));
  }
  return inv.getAsDouble(coordinates);
}

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

public ColtSparseDoubleMatrix2D(Matrix source) {
  super(source.getRowCount(), source.getColumnCount());
  this.matrix = new SparseDoubleMatrix2D((int) source.getRowCount(), (int) source.getColumnCount());
  for (long[] c : source.availableCoordinates()) {
    setDouble(source.getAsDouble(c), c);
  }
  if (source.getMetaData() != null) {
    setMetaData(source.getMetaData().clone());
  }
}

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

public La4JDenseDoubleMatrix2D(Matrix source) {
  super(source.getRowCount(), source.getColumnCount());
  this.matrix = new Basic2DMatrix((int) source.getRowCount(), (int) source.getColumnCount());
  for (long[] c : source.availableCoordinates()) {
    setDouble(source.getAsDouble(c), c);
  }
  if (source.getMetaData() != null) {
    setMetaData(source.getMetaData().clone());
  }
}

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

public JamaDenseDoubleMatrix2D(Matrix source) {
  super(source.getRowCount(), source.getColumnCount());
  this.matrix = new Jama.Matrix((int) source.getRowCount(), (int) source.getColumnCount());
  for (long[] c : source.availableCoordinates()) {
    setDouble(source.getAsDouble(c), c);
  }
  if (source.getMetaData() != null) {
    setMetaData(source.getMetaData().clone());
  }
}

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

public ColtDenseDoubleMatrix2D(Matrix source) {
  super(source.getRowCount(), source.getColumnCount());
  this.matrix = new DenseDoubleMatrix2D((int) source.getRowCount(), (int) source.getColumnCount());
  for (long[] c : source.availableCoordinates()) {
    setDouble(source.getAsDouble(c), c);
  }
  if (source.getMetaData() != null) {
    setMetaData(source.getMetaData().clone());
  }
}

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

public ColtSparseDoubleMatrix2D(Matrix source) {
  super(source.getRowCount(), source.getColumnCount());
  this.matrix = new SparseDoubleMatrix2D((int) source.getRowCount(), (int) source.getColumnCount());
  for (long[] c : source.availableCoordinates()) {
    setDouble(source.getAsDouble(c), c);
  }
  if (source.getMetaData() != null) {
    setMetaData(source.getMetaData().clone());
  }
}

相关文章

Matrix类方法