Package com.opengamma.financial.analytics

Examples of com.opengamma.financial.analytics.DoubleLabelledMatrix2D


      for (int loopy = 0; loopy < y.length; loopy++) {
        vIn[loopy][loopx] = x[loopx] * y[loopy];
        surf.add(new DoublesPair(x[loopx], y[loopy]), vIn[loopy][loopx]);
      }
    }
    DoubleLabelledMatrix2D vOut = SABRCubeUtils.toDoubleLabelledMatrix2D(surf);
    for (int loopx = 0; loopx < x.length; loopx++) {
      for (int loopy = 0; loopy < y.length; loopy++) {
        assertEquals("Surface value - toArray", vIn[loopy][loopx], vOut.getValues()[loopy][loopx], TOLERANCE);
      }
    }
    for (int loopx = 0; loopx < x.length; loopx++) {
      assertEquals("Surface value - toArray", x[loopx], vOut.getXKeys()[loopx], TOLERANCE);
    }
    for (int loopy = 0; loopy < y.length; loopy++) {
      assertEquals("Surface value - toArray", y[loopy], vOut.getYKeys()[loopy], TOLERANCE);
    }
  }
View Full Code Here


    SurfaceValue surf = new SurfaceValue();
    for (int loopx = 0; loopx < x.length; loopx++) {
      vIn[loopx][loopx] = x[loopx] * y[loopx];
      surf.add(new DoublesPair(x[loopx], y[loopx]), vIn[loopx][loopx]);
    }
    DoubleLabelledMatrix2D vOut = SABRCubeUtils.toDoubleLabelledMatrix2D(surf);
    for (int loopx = 0; loopx < x.length; loopx++) {
      assertEquals("Surface value - toArray", vIn[loopx][loopx], vOut.getValues()[loopx][loopx], TOLERANCE);
    }
    for (int loopx = 0; loopx < x.length; loopx++) {
      assertEquals("Surface value - toArray", x[loopx], vOut.getXKeys()[loopx], TOLERANCE);
    }
    for (int loopy = 0; loopy < x.length; loopy++) {
      assertEquals("Surface value - toArray", y[loopy], vOut.getYKeys()[loopy], TOLERANCE);
    }
  }
View Full Code Here

          }
          values[j++][i] = vega;
        }
        i++;
      }
      final DoubleLabelledMatrix2D vegaMatrix = new DoubleLabelledMatrix2D(uniqueX, uniqueY, values);
      return Collections.singleton(new ComputedValue(resultSpec, vegaMatrix));
    }
    throw new OpenGammaRuntimeException("Currently will only accept a VolatilitySurface of type: BlackVolatilitySurfaceMoneynessFcnBackedByGrid");
  }
View Full Code Here

        if (value != null) {
          v[loopy][loopx] = value;
        }
      }
    }
    return new DoubleLabelledMatrix2D(x, y, v);
  }
View Full Code Here

          rowLabels[j] = getFormattedExpiry(expiries[j]);
        }
        values[i][j] = vega[j][i];
      }
    }
    return Collections.singleton(new ComputedValue(spec, new DoubleLabelledMatrix2D(rowValues, rowLabels, columnValues, columnLabels, values)));
  }
View Full Code Here

    if (fittedDataPointsObject == null) {
      throw new OpenGammaRuntimeException("Could not get fitted points for cube");
    }
    final FittedSmileDataPoints fittedDataPoints = (FittedSmileDataPoints) fittedDataPointsObject;
    final Map<DoublesPair, DoubleMatrix2D> inverseJacobians = sabrFittedSurfaces.getInverseJacobians();
    final DoubleLabelledMatrix2D alphaSensitivity = (DoubleLabelledMatrix2D) alphaSensitivityObject;
    final DoubleLabelledMatrix2D nuSensitivity = (DoubleLabelledMatrix2D) nuSensitivityObject;
    final DoubleLabelledMatrix2D rhoSensitivity = (DoubleLabelledMatrix2D) rhoSensitivityObject;
    final double expiry = alphaSensitivity.getXKeys()[0];
    final double maturity = alphaSensitivity.getYKeys()[0];
    final double alpha = alphaSensitivity.getValues()[0][0];
    final double nu = nuSensitivity.getValues()[0][0];
    final double rho = rhoSensitivity.getValues()[0][0];
    final InterpolatedDoublesSurface alphaSurface = data.getSABRParameter().getAlphaSurface();
    final Map<Double, Interpolator1DDataBundle> alphaDataBundle = (Map<Double, Interpolator1DDataBundle>) alphaSurface.getInterpolatorData();
    final InterpolatedDoublesSurface nuSurface = data.getSABRParameter().getNuSurface();
    final Map<Double, Interpolator1DDataBundle> nuDataBundle = (Map<Double, Interpolator1DDataBundle>) nuSurface.getInterpolatorData();
    final InterpolatedDoublesSurface rhoSurface = data.getSABRParameter().getRhoSurface();
View Full Code Here

    return results;
  }

  private DoubleLabelledMatrix2D getMatrix(final SurfaceValue values) {
    final Map.Entry<DoublesPair, Double> entry = Iterables.getOnlyElement(values.getMap().entrySet());
    return new DoubleLabelledMatrix2D(new Double[] {entry.getKey().first}, new Double[] {entry.getKey().second}, new double[][] {new double[] {entry.getValue()}});
  }
View Full Code Here

        }
        values[j++][i] = vega;
      }
      i++;
    }
    final DoubleLabelledMatrix2D matrix = new DoubleLabelledMatrix2D(uniqueX, uniqueY, values);
    return Collections.singleton(new ComputedValue(resultSpec, matrix));
  }
View Full Code Here

          rowLabels[j] = VegaMatrixUtils.getFXVolatilityFormattedExpiry(expiries[j]);
        }
        values[i][j] = vega[j][i];
      }
    }
    return new DoubleLabelledMatrix2D(rowValues, rowLabels, columnValues, columnLabels, values);
  }
View Full Code Here

    for (int i = 0; i < nDelta; i++) {
      for (int j = 0; j < nExpiries; j++) {
        values[i][j] = vega[j][i];
      }
    }
    return new DoubleLabelledMatrix2D(rowValues, rowLabels, columnValues, columnLabels, values);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.financial.analytics.DoubleLabelledMatrix2D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.