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

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

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

Matrix.det介绍

暂无

代码示例

代码示例来源:origin: lessthanoptimal/Java-Matrix-Benchmark

@Override
  public long process(BenchmarkMatrix[] inputs, BenchmarkMatrix[] outputs,
      long numTrials) {
    Matrix matA = inputs[0].getOriginal();
    long prev = System.nanoTime();
    for (long i = 0; i < numTrials; i++) {
      matA.det();
    }
    return System.nanoTime() - prev;
  }
}

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

public static double getDensity(Matrix x, Matrix mean, Matrix covariance) {
  Matrix xmean = x.minus(mean);
  Matrix inverse = covariance.inv();
  double f = 1.0 / Math.sqrt(covariance.det() * Math.pow(2.0 * Math.PI, x.getColumnCount()));
  Matrix matrix = xmean.mtimes(inverse).mtimes(xmean.transpose());
  return f * Math.exp(-0.5 * matrix.doubleValue());
}

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

public void trainAll(ListDataSet dataSet) {
  featureCount = getFeatureCount(dataSet);
  classCount = getClassCount(dataSet);
  dimensions = featureCount + classCount;
  Matrix x = Matrix.Factory.zeros(dataSet.size(), dimensions);
  int i = 0;
  for (Sample s : dataSet) {
    Matrix input = s.getAsMatrix(getInputLabel()).toColumnVector(Ret.LINK);
    for (int c = 0; c < featureCount; c++) {
      x.setAsDouble(input.getAsDouble(0, c), i, c);
    }
    Matrix target = s.getAsMatrix(getTargetLabel()).toColumnVector(Ret.LINK);
    for (int c = 0; c < classCount; c++) {
      x.setAsDouble(target.getAsDouble(0, c), i, c + featureCount);
    }
    i++;
  }
  meanMatrix = x.mean(Ret.NEW, Matrix.ROW, true);
  covarianceMatrix = x.cov(Ret.NEW, true, true);
  try {
    inverse = covarianceMatrix.inv();
    factor = 1.0 / Math.sqrt(covarianceMatrix.det() * Math.pow(2.0 * Math.PI, dimensions));
  } catch (Exception e) {
    inverse = covarianceMatrix.pinv();
    factor = 1.0;
  }
}

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

double determinant = dense.det();

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

double determinant = dense.det();

相关文章

Matrix类方法