Provides a default implementation of evaluate(double[]), delegating to evaluate(double[], int, int) in the natural way.
evaluate(double[]),
evaluate(double[], int, int)
Also includes a test method that performs generic parameter validation for the evaluate methods.
test
evaluate
143144145146147148149150151
// 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(); }
37383940414243
* Creates a diagonal weight matrix. * * @param weight List of the values of the diagonal. */ public Weight(double[] weight) { weightMatrix = new DiagonalMatrix(weight); }
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();
41424344454647
38394041424344
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