private LeastSquareWithPenaltyResults finish( DoubleMatrix alpha, DecompositionResult decmp, double chiSqr, double penalty, DoubleMatrix jacobian, DoubleArray newTheta, DoubleArray sigma) { DoubleMatrix covariance = decmp.solve(DoubleMatrix.identity(alpha.rowCount())); DoubleMatrix bT = getBTranspose(jacobian, sigma); DoubleMatrix inverseJacobian = decmp.solve(bT); return new LeastSquareWithPenaltyResults(chiSqr, penalty, newTheta, covariance, inverseJacobian); }
@Override public DoubleArray getDirection(DoubleMatrix estimate, DoubleArray y) { ArgChecker.notNull(estimate, "estimate"); ArgChecker.notNull(y, "y"); DecompositionResult result = _decomposition.apply(estimate); return result.solve(y); }
private LeastSquareResults finish( DoubleMatrix alpha, DecompositionResult decmp, double newChiSqr, DoubleMatrix jacobian, DoubleArray newTheta, DoubleArray sigma) { DoubleMatrix covariance = decmp.solve(DoubleMatrix.identity(alpha.rowCount())); DoubleMatrix bT = getBTranspose(jacobian, sigma); DoubleMatrix inverseJacobian = decmp.solve(bT); return new LeastSquareResults(newChiSqr, newTheta, covariance, inverseJacobian); }
@Override public DoubleMatrix getInitializedMatrix(Function<DoubleArray, DoubleMatrix> jacobianFunction, DoubleArray x) { ArgChecker.notNull(jacobianFunction, "jacobianFunction"); ArgChecker.notNull(x, "x"); DoubleMatrix estimate = jacobianFunction.apply(x); DecompositionResult decompositionResult = _decomposition.apply(estimate); return decompositionResult.solve(DoubleMatrix.identity(x.size())); }
/** * * the inverse-Jacobian where the i-j entry is the sensitivity of the ith (fitted) parameter (a_i) to the jth data * point (y_j). * @param sigma Set of measurement errors * @param func The model as a function of its parameters only * @param jac The model sensitivity to its parameters (i.e. the Jacobian matrix) as a function of its parameters only * @param originalSolution The value of the parameters at a converged solution * @return inverse-Jacobian */ public DoubleMatrix calInverseJacobian( DoubleArray sigma, Function<DoubleArray, DoubleArray> func, Function<DoubleArray, DoubleMatrix> jac, DoubleArray originalSolution) { DoubleMatrix jacobian = getJacobian(jac, sigma, originalSolution); DoubleMatrix a = getModifiedCurvatureMatrix(jacobian, 0.0); DoubleMatrix bT = getBTranspose(jacobian, sigma); DecompositionResult decRes = _decomposition.apply(a); return decRes.solve(bT); }
(cutOffStrike * cutOffStrike); DecompositionResult decmp = SVD.apply(DoubleMatrix.ofUnsafe(fD)); return decmp.solve(pDF);
result[loopparam] = decmp.solve(pdSabr[loopparam]);
private double[] weights(double forward, double strike, double[] strikes, double timeToExpiry, double atmVol) { double[][] mat = new double[3][3]; double[] vec = new double[3]; for (int i = 0; i < 3; ++i) { mat[0][i] = BlackFormulaRepository.vega(forward, strikes[i], timeToExpiry, atmVol); mat[1][i] = BlackFormulaRepository.vanna(forward, strikes[i], timeToExpiry, atmVol); mat[2][i] = BlackFormulaRepository.volga(forward, strikes[i], timeToExpiry, atmVol); } vec[0] = BlackFormulaRepository.vega(forward, strike, timeToExpiry, atmVol); vec[1] = BlackFormulaRepository.vanna(forward, strike, timeToExpiry, atmVol); vec[2] = BlackFormulaRepository.volga(forward, strike, timeToExpiry, atmVol); DecompositionResult res = SVD.apply(DoubleMatrix.ofUnsafe(mat)); return res.solve(vec); }
try { decmp = _decomposition.apply(alpha); deltaTheta = decmp.solve(beta); } catch (Exception e) { throw new MathException(e);
deltaTheta = decmp.solve(beta); } catch (Exception e) { throw new MathException(e);