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);
}