/** * Obtains an instance of the Broyden root finder specifying the tolerances. * <p> * This uses SV decomposition. * * @param absoluteTol the absolute tolerance * @param relativeTol the relative tolerance * @param maxSteps the maximum steps * @return the root finder */ public static NewtonVectorRootFinder broyden(double absoluteTol, double relativeTol, int maxSteps) { return new BroydenVectorRootFinder(absoluteTol, relativeTol, maxSteps, new SVDecompositionCommons()); }
(2 * (2 * mu + 3) + 4 * parameter[1] / cutOffStrike + 8 * parameter[2] / (cutOffStrike * cutOffStrike))) / (cutOffStrike * cutOffStrike); DecompositionResult decmp = SVD.apply(DoubleMatrix.ofUnsafe(fD)); return decmp.solve(pDF);
DoubleMatrix fDmatrix = DoubleMatrix.ofUnsafe(fD); DecompositionResult decmp = SVD.apply(fDmatrix); for (int loopparam = 0; loopparam < 4; loopparam++) { 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); }
/** * Obtains an instance of the Broyden root finder. * <p> * This uses SV decomposition and standard tolerances. * * @return the root finder */ public static NewtonVectorRootFinder broyden() { return new BroydenVectorRootFinder(new SVDecompositionCommons()); }
SVDecompositionResult svdRes = svd.apply(newAlpha); double[] w = svdRes.getSingularValues(); DoubleMatrix u = svdRes.getU();
/** * Creates an instance. */ public GeneralizedLeastSquare() { _decomposition = new SVDecompositionCommons(); _algebra = new CommonsMatrixAlgebra(); }