本文整理了Java中Jama.Matrix.minus()
方法的一些代码示例,展示了Matrix.minus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.minus()
方法的具体详情如下:
包路径:Jama.Matrix
类名称:Matrix
方法名:minus
暂无
代码示例来源:origin: marytts/marytts
Matrix r = data.times(b).minus(indVar);
residuals = r.getColumnPackedCopy();
代码示例来源:origin: marytts/marytts
Matrix r = data.times(b).minus(indVar);
residuals = r.getColumnPackedCopy();
代码示例来源:origin: marytts/marytts
Matrix r = X.times(b).minus(y);
residuals = r.getColumnPackedCopy();
代码示例来源:origin: marytts/marytts
Matrix r = X.times(b).minus(y);
residuals = r.getColumnPackedCopy();
代码示例来源:origin: percyliang/fig
public void sub(SuffStats _stats) { // Remove several data points
MultGaussianSuffStats stats = (MultGaussianSuffStats)_stats;
// TODO : in place for efficiency
sum = sum.minus(stats.sum);
outerproducts = outerproducts.minus(stats.outerproducts);
n += stats.n;
}
代码示例来源:origin: stackoverflow.com
import Jama.*
Matrix A = new Matrix(a);
Matrix B = new Matrix(b);
Matrix R = A.minus(B);
代码示例来源:origin: openimaj/openimaj
private static float distance(Matrix a,Matrix b) {
return (float) a.minus(b).norm2();
}
}
代码示例来源:origin: org.openimaj/image-local-features
private static float distance(Matrix a,Matrix b) {
return (float) a.minus(b).norm2();
}
}
代码示例来源:origin: percyliang/fig
public void sub(double[] _x) { // Remove a data point
Matrix x = new Matrix(_x, _x.length);
// TODO : in place for efficiency
sum = sum.minus(x);
outerproducts = outerproducts.minus(x.times(x.transpose()));
n--;
}
public void sub(SuffStats _stats) { // Remove several data points
代码示例来源:origin: gov.nist.math/jama
/** Check norm of difference of Matrices. **/
private static void check(Matrix X, Matrix Y) {
double eps = Math.pow(2.0,-52.0);
if (X.norm1() == 0. & Y.norm1() < 10*eps) return;
if (Y.norm1() == 0. & X.norm1() < 10*eps) return;
if (X.minus(Y).norm1() > 1000*eps*Math.max(X.norm1(),Y.norm1())) {
throw new RuntimeException("The norm of (X-Y) is too large: " + Double.toString(X.minus(Y).norm1()));
}
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public static Matrix subtractAverageColumnFromEachRow(Matrix m)
{
Matrix u = getAverageColumnVector(m);
Matrix h = createRowVector(m.getColumnDimension(), 1.0);
Matrix ret = m.copy();
// System.out.println("Stats::subtractAverageColumnFromEachRow: u,
// h, u*h : ");
// u.print(3, 3);
// h.print(3, 3);
// u.times(h).print(3, 3);
return ret.minus(u.times(h));
}
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
public static Matrix subtractAverageColumnFromEachRow(Matrix m)
{
Matrix u = getAverageColumnVector(m);
Matrix h = createRowVector(m.getColumnDimension(), 1.0);
Matrix ret = m.copy();
// System.out.println("Stats::subtractAverageColumnFromEachRow: u,
// h, u*h : ");
// u.print(3, 3);
// h.print(3, 3);
// u.times(h).print(3, 3);
return ret.minus(u.times(h));
}
代码示例来源:origin: org.ujmp/ujmp-jama
public Matrix minus(Matrix m) {
if (m instanceof JamaDenseDoubleMatrix2D) {
Matrix result = new JamaDenseDoubleMatrix2D(matrix.minus(((JamaDenseDoubleMatrix2D) m).matrix));
MapMatrix<String, Object> a = getMetaData();
if (a != null) {
result.setMetaData(a.clone());
}
return result;
} else {
return super.minus(m);
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public Matrix minus(Matrix m) {
if (m instanceof JamaDenseDoubleMatrix2D) {
Matrix result = new JamaDenseDoubleMatrix2D(matrix.minus(((JamaDenseDoubleMatrix2D) m).matrix));
MapMatrix<String, Object> a = getMetaData();
if (a != null) {
result.setMetaData(a.clone());
}
return result;
} else {
return super.minus(m);
}
}
代码示例来源:origin: senbox-org/s1tbx
private double computeMLD(final double[] u, final ClusterInfo cluster) {
Matrix uMat = new Matrix(u, u.length);
Matrix uMatNew = uMat.minus(new Matrix(cluster.center, cluster.center.length));
return uMatNew.transpose().times(cluster.invCov).times(uMatNew).get(0, 0) + cluster.logDet;
}
代码示例来源:origin: openimaj/openimaj
@Override
public Double aggregate(DoubleSynchronisedTimeSeriesCollection series) {
Matrix squarediffs = null;
for (DoubleTimeSeries ds: series.allseries()) {
if(squarediffs == null){
squarediffs = new Matrix(new double[][]{ds.getData()});
}
else{
squarediffs = squarediffs.minus(new Matrix(new double[][]{ds.getData()}));
squarediffs = squarediffs.arrayTimes(squarediffs );
}
}
return MatrixUtils.sum(squarediffs);
}
代码示例来源:origin: openimaj/openimaj
@Override
public Double aggregate(DoubleSynchronisedTimeSeriesCollection series) {
Matrix squarediffs = null;
int size = 0;
for (DoubleTimeSeries ds: series.allseries()) {
if(squarediffs == null){
squarediffs = new Matrix(new double[][]{ds.getData()});
}
else{
squarediffs = squarediffs.minus(new Matrix(new double[][]{ds.getData()}));
squarediffs = squarediffs.arrayTimes(squarediffs );
}
size = ds.size();
}
return MatrixUtils.sum(squarediffs)/size;
}
代码示例来源:origin: openimaj/openimaj
@Override
public double compare(MultivariateGaussian o1, MultivariateGaussian o2) {
final Matrix sig0 = o1.getCovariance();
final Matrix sig1 = o2.getCovariance();
final Matrix mu0 = o1.getMean();
final Matrix mu1 = o2.getMean();
final int K = o1.numDims();
final Matrix sig1inv = sig1.inverse();
final double sigtrace = MatrixUtils.trace(sig1inv.times(sig0));
final Matrix mudiff = mu1.minus(mu0);
final double xt_s_x = mudiff.transpose().times(sig1inv).times(mudiff).get(0, 0);
final double ln_norm_sig = Math.log(sig0.norm1() / sig1.norm1());
return 0.5 * (sigtrace + xt_s_x - K - ln_norm_sig);
}
代码示例来源:origin: bcdev/beam
public void testUnconstrainedUnmixing() throws IOException {
SpectralUnmixing mlm = new UnconstrainedLSU(endmembers.getArray());
Matrix abundUnconstrBeam = new Matrix(mlm.unmix(spectra.getArray()));
Matrix abundUnconstrEnvi = Matrix.read(getResourceReader("abundances-unconstr-envi.csv"));
Matrix abundUnconstrExpected = Matrix.read(getResourceReader("abundances-unconstr-expected.csv"));
assertEquals("Difference of abundances (BEAM minus ENVI, unconstrained)",
0.0,
maxAbs(abundUnconstrBeam.minus(abundUnconstrEnvi)),
1e-4);
assertEquals("Difference of abundances (BEAM minus EXPECTED, unconstrained)",
0.0,
maxAbs(abundUnconstrBeam.minus(abundUnconstrExpected)),
1e-7);
}
代码示例来源:origin: openimaj/openimaj
@Override
protected void mstep(EMGMM gmm, GaussianMixtureModelEM learner, Matrix X, Matrix responsibilities,
Matrix weightedXsum,
double[] norm)
{
final Matrix avgX2uw = responsibilities.transpose().times(X.arrayTimes(X));
for (int i = 0; i < gmm.gaussians.length; i++) {
final Matrix weightedXsumi = new Matrix(new double[][] { weightedXsum.getArray()[i] });
final Matrix avgX2uwi = new Matrix(new double[][] { avgX2uw.getArray()[i] });
final Matrix avgX2 = avgX2uwi.times(norm[i]);
final Matrix mu = ((AbstractMultivariateGaussian) gmm.gaussians[i]).mean;
final Matrix avgMeans2 = MatrixUtils.pow(mu, 2);
final Matrix avgXmeans = mu.arrayTimes(weightedXsumi).times(norm[i]);
final Matrix covar = MatrixUtils.plus(avgX2.minus(avgXmeans.times(2)).plus(avgMeans2),
learner.minCovar);
((DiagonalMultivariateGaussian) gmm.gaussians[i]).variance = covar.getArray()[0];
}
}
},
内容来源于网络,如有侵权,请联系作者删除!