This specific problem is the following differential equation :
x'' = -x
x' -> -x'
270271272273274275276277278
for (int i = 0; i < dim; i++) { sqrtM.setEntry(i, i, FastMath.sqrt(m.getEntry(i, i))); } return sqrtM; } else { final EigenDecomposition dec = new EigenDecomposition(m); return dec.getSquareRoot(); } }
4748495051525354555657
* @throws NonSquareMatrixException if the argument is not * a square matrix. */ public Weight(RealMatrix weight) { if (weight.getColumnDimension() != weight.getRowDimension()) { throw new NonSquareMatrixException(weight.getColumnDimension(), weight.getRowDimension()); } weightMatrix = weight.copy(); }
5152535455565758596061
4849505152535455565758
144145146147148149150151
// Compute transpose(J)J. final RealMatrix jTj = j.transpose().multiply(j); // Compute the covariances matrix. final DecompositionSolver solver = new QRDecomposition(jTj, threshold).getSolver(); return solver.getInverse().getData(); }
919293949596979899100101102
SiteWithPolynomial nearSite = nearestSites.get(row); DefaultPolynomial.populateMatrix(matrix, row, nearSite.pos.x, nearSite.pos.z); vector.setEntry(row, nearSite.pos.y); } QRDecomposition qr = new QRDecomposition(matrix); RealVector solution = qr.getSolver().solve(vector); double[] coeffs = solution.toArray(); for (double coeff : coeffs) { if (coeff > 10e3) {
287288289290291292293294295296
} // solve the rectangular system in the least square sense // to get the best estimate of the Nordsieck vector [s2 ... sk] QRDecomposition decomposition; decomposition = new QRDecomposition(new Array2DRowRealMatrix(a, false)); RealMatrix x = decomposition.getSolver().solve(new Array2DRowRealMatrix(b, false)); return new Array2DRowRealMatrix(x.getData(), false); }
137138139140141142143144145146147148149150
* if the covariance matrix cannot be computed (singular problem). */ public double[][] computeCovariances(double[] params, double threshold) { // Set up the Jacobian. final RealMatrix j = computeWeightedJacobian(params); // Compute transpose(J)J. final RealMatrix jTj = j.transpose().multiply(j); // Compute the covariances matrix. final DecompositionSolver solver = new QRDecomposition(jTj, threshold).getSolver(); return solver.getInverse().getData();
264265266267268269270271272273274275276
* @return the square-root of the weight matrix. */ private RealMatrix squareRoot(RealMatrix m) { if (m instanceof DiagonalMatrix) { final int dim = m.getRowDimension(); final RealMatrix sqrtM = new DiagonalMatrix(dim); for (int i = 0; i < dim; i++) { sqrtM.setEntry(i, i, FastMath.sqrt(m.getEntry(i, i))); } return sqrtM; } else { final EigenDecomposition dec = new EigenDecomposition(m); return dec.getSquareRoot();
8283848586878889909192
List<SiteWithPolynomial> nearestSites = nearestSiteMap.get(site); RealVector vector = new ArrayRealVector(SITES_FOR_APPROX); RealMatrix matrix = new Array2DRowRealMatrix( SITES_FOR_APPROX, DefaultPolynomial.NUM_COEFFS); for (int row = 0; row < SITES_FOR_APPROX; row++) { SiteWithPolynomial nearSite = nearestSites.get(row); DefaultPolynomial.populateMatrix(matrix, row, nearSite.pos.x, nearSite.pos.z);