RiskFactorAggregateIR.java

  1. package org.drip.simm.margin;

  2. /*
  3.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  4.  */

  5. /*!
  6.  * Copyright (C) 2020 Lakshmi Krishnamurthy
  7.  * Copyright (C) 2019 Lakshmi Krishnamurthy
  8.  * Copyright (C) 2018 Lakshmi Krishnamurthy
  9.  *
  10.  *  This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics,
  11.  *      asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment
  12.  *      analytics, and portfolio construction analytics within and across fixed income, credit, commodity,
  13.  *      equity, FX, and structured products. It also includes auxiliary libraries for algorithm support,
  14.  *      numerical analysis, numerical optimization, spline builder, model validation, statistical learning,
  15.  *      and computational support.
  16.  *  
  17.  *      https://lakshmidrip.github.io/DROP/
  18.  *  
  19.  *  DROP is composed of three modules:
  20.  *  
  21.  *  - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/
  22.  *  - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
  23.  *  - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/
  24.  *
  25.  *  DROP Product Core implements libraries for the following:
  26.  *  - Fixed Income Analytics
  27.  *  - Loan Analytics
  28.  *  - Transaction Cost Analytics
  29.  *
  30.  *  DROP Portfolio Core implements libraries for the following:
  31.  *  - Asset Allocation Analytics
  32.  *  - Asset Liability Management Analytics
  33.  *  - Capital Estimation Analytics
  34.  *  - Exposure Analytics
  35.  *  - Margin Analytics
  36.  *  - XVA Analytics
  37.  *
  38.  *  DROP Computational Core implements libraries for the following:
  39.  *  - Algorithm Support
  40.  *  - Computation Support
  41.  *  - Function Analysis
  42.  *  - Model Validation
  43.  *  - Numerical Analysis
  44.  *  - Numerical Optimizer
  45.  *  - Spline Builder
  46.  *  - Statistical Learning
  47.  *
  48.  *  Documentation for DROP is Spread Over:
  49.  *
  50.  *  - Main                     => https://lakshmidrip.github.io/DROP/
  51.  *  - Wiki                     => https://github.com/lakshmiDRIP/DROP/wiki
  52.  *  - GitHub                   => https://github.com/lakshmiDRIP/DROP
  53.  *  - Repo Layout Taxonomy     => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md
  54.  *  - Javadoc                  => https://lakshmidrip.github.io/DROP/Javadoc/index.html
  55.  *  - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
  56.  *  - Release Versions         => https://lakshmidrip.github.io/DROP/version.html
  57.  *  - Community Credits        => https://lakshmidrip.github.io/DROP/credits.html
  58.  *  - Issues Catalog           => https://github.com/lakshmiDRIP/DROP/issues
  59.  *  - JUnit                    => https://lakshmidrip.github.io/DROP/junit/index.html
  60.  *  - Jacoco                   => https://lakshmidrip.github.io/DROP/jacoco/index.html
  61.  *
  62.  *  Licensed under the Apache License, Version 2.0 (the "License");
  63.  *      you may not use this file except in compliance with the License.
  64.  *  
  65.  *  You may obtain a copy of the License at
  66.  *      http://www.apache.org/licenses/LICENSE-2.0
  67.  *  
  68.  *  Unless required by applicable law or agreed to in writing, software
  69.  *      distributed under the License is distributed on an "AS IS" BASIS,
  70.  *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  71.  *  
  72.  *  See the License for the specific language governing permissions and
  73.  *      limitations under the License.
  74.  */

  75. /**
  76.  * <i>RiskFactorAggregateIR</i> holds the Sensitivity Margin Aggregates for each of the IR Risk Factors -
  77.  * OIS, LIBOR 1M, LIBOR 3M, LIBOR 6M LIBOR 12M, PRIME, and MUNICIPAL. The References are:
  78.  *
  79.  * <br><br>
  80.  *  <ul>
  81.  *      <li>
  82.  *          Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Credit Exposure in the Presence of Initial
  83.  *              Margin https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2806156 <b>eSSRN</b>
  84.  *      </li>
  85.  *      <li>
  86.  *          Albanese, C., S. Caenazzo, and O. Frankel (2017): Regression Sensitivities for Initial Margin
  87.  *              Calculations https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2763488 <b>eSSRN</b>
  88.  *      </li>
  89.  *      <li>
  90.  *          Anfuso, F., D. Aziz, P. Giltinan, and K. Loukopoulus (2017): A Sound Modeling and Back-testing
  91.  *              Framework for Forecasting Initial Margin Requirements
  92.  *                  https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2716279 <b>eSSRN</b>
  93.  *      </li>
  94.  *      <li>
  95.  *          Caspers, P., P. Giltinan, R. Lichters, and N. Nowaczyk (2017): Forecasting Initial Margin
  96.  *              Requirements - A Model Evaluation https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2911167
  97.  *                  <b>eSSRN</b>
  98.  *      </li>
  99.  *      <li>
  100.  *          International Swaps and Derivatives Association (2017): SIMM v2.0 Methodology
  101.  *              https://www.isda.org/a/oFiDE/isda-simm-v2.pdf
  102.  *      </li>
  103.  *  </ul>
  104.  *
  105.  * <br><br>
  106.  *  <ul>
  107.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/PortfolioCore.md">Portfolio Core Module</a></li>
  108.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/MarginAnalyticsLibrary.md">Initial and Variation Margin Analytics</a></li>
  109.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/simm/README.md">Initial Margin Analytics based on ISDA SIMM and its Variants</a></li>
  110.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/simm/margin/README.md">ISDA SIMM Risk Factor Margin Metrics</a></li>
  111.  *  </ul>
  112.  * <br><br>
  113.  *
  114.  * @author Lakshmi Krishnamurthy
  115.  */

  116. public class RiskFactorAggregateIR
  117. {
  118.     private double _concentrationRiskFactor = java.lang.Double.NaN;
  119.     private java.util.Map<java.lang.String, java.lang.Double> _oisSensitivityMargin = null;
  120.     private java.util.Map<java.lang.String, java.lang.Double> _primeSensitivityMargin = null;
  121.     private java.util.Map<java.lang.String, java.lang.Double> _libor1MSensitivityMargin = null;
  122.     private java.util.Map<java.lang.String, java.lang.Double> _libor3MSensitivityMargin = null;
  123.     private java.util.Map<java.lang.String, java.lang.Double> _libor6MSensitivityMargin = null;
  124.     private java.util.Map<java.lang.String, java.lang.Double> _libor12MSensitivityMargin = null;
  125.     private java.util.Map<java.lang.String, java.lang.Double> _municipalSensitivityMargin = null;

  126.     /**
  127.      * RiskFactorAggregateIR Constructor
  128.      *
  129.      * @param oisSensitivityMargin The OIS Sensitivity Margin
  130.      * @param libor1MSensitivityMargin The LIBOR 1M Sensitivity Margin
  131.      * @param libor3MSensitivityMargin The LIBOR 3M Sensitivity Margin
  132.      * @param libor6MSensitivityMargin The LIBOR 6M Sensitivity Margin
  133.      * @param libor12MSensitivityMargin The LIBOR 12M Sensitivity Margin
  134.      * @param primeSensitivityMargin The PRIME Sensitivity Margin
  135.      * @param municipalSensitivityMargin The Municipal Sensitivity Margin
  136.      // * @param sensitivityMargin The Bucket Sensitivity Margin
  137.      * @param concentrationRiskFactor The Currency's Concentration Risk Factor
  138.      *
  139.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  140.      */

  141.     public RiskFactorAggregateIR (
  142.         final java.util.Map<java.lang.String, java.lang.Double> oisSensitivityMargin,
  143.         final java.util.Map<java.lang.String, java.lang.Double> libor1MSensitivityMargin,
  144.         final java.util.Map<java.lang.String, java.lang.Double> libor3MSensitivityMargin,
  145.         final java.util.Map<java.lang.String, java.lang.Double> libor6MSensitivityMargin,
  146.         final java.util.Map<java.lang.String, java.lang.Double> libor12MSensitivityMargin,
  147.         final java.util.Map<java.lang.String, java.lang.Double> primeSensitivityMargin,
  148.         final java.util.Map<java.lang.String, java.lang.Double> municipalSensitivityMargin,
  149.         final double concentrationRiskFactor)
  150.         throws java.lang.Exception
  151.     {
  152.         if (null == (_oisSensitivityMargin = oisSensitivityMargin) || 0 == _oisSensitivityMargin.size() ||
  153.             null == (_libor1MSensitivityMargin = libor1MSensitivityMargin) ||
  154.                 0 == _libor1MSensitivityMargin.size() ||
  155.             null == (_libor3MSensitivityMargin = libor3MSensitivityMargin) ||
  156.                 0 == _libor3MSensitivityMargin.size() ||
  157.             null == (_libor6MSensitivityMargin = libor6MSensitivityMargin) ||
  158.                 0 == _libor6MSensitivityMargin.size() ||
  159.             null == (_libor12MSensitivityMargin = libor12MSensitivityMargin) ||
  160.                 0 == _libor12MSensitivityMargin.size() ||
  161.             null == (_municipalSensitivityMargin = municipalSensitivityMargin) ||
  162.                 0 == _municipalSensitivityMargin.size() ||
  163.             null == (_primeSensitivityMargin = primeSensitivityMargin) ||
  164.                 0 == _primeSensitivityMargin.size() ||
  165.             !org.drip.numerical.common.NumberUtil.IsValid (_concentrationRiskFactor = concentrationRiskFactor))
  166.          {
  167.              throw new java.lang.Exception ("RiskFactorAggregateIR Constructor => Invalid Inputs");
  168.          }
  169.     }

  170.     /**
  171.      * Retrieve the OIS Sensitivity Margin Map
  172.      *
  173.      * @return The OIS Sensitivity Margin Map
  174.      */

  175.     public java.util.Map<java.lang.String, java.lang.Double> oisSensitivityMargin()
  176.     {
  177.         return _oisSensitivityMargin;
  178.     }

  179.     /**
  180.      * Retrieve the LIBOR 1M Sensitivity Margin Map
  181.      *
  182.      * @return The LIBOR 1M Sensitivity Margin Map
  183.      */

  184.     public java.util.Map<java.lang.String, java.lang.Double> libor1MSensitivityMargin()
  185.     {
  186.         return _libor1MSensitivityMargin;
  187.     }

  188.     /**
  189.      * Retrieve the LIBOR 3M Sensitivity Margin Map
  190.      *
  191.      * @return The LIBOR 3M Sensitivity Margin Map
  192.      */

  193.     public java.util.Map<java.lang.String, java.lang.Double> libor3MSensitivityMargin()
  194.     {
  195.         return _libor3MSensitivityMargin;
  196.     }

  197.     /**
  198.      * Retrieve the LIBOR 6M Sensitivity Margin Map
  199.      *
  200.      * @return The LIBOR 6M Sensitivity Margin Map
  201.      */

  202.     public java.util.Map<java.lang.String, java.lang.Double> libor6MSensitivityMargin()
  203.     {
  204.         return _libor6MSensitivityMargin;
  205.     }

  206.     /**
  207.      * Retrieve the LIBOR 12M Sensitivity Margin Map
  208.      *
  209.      * @return The LIBOR 12M Sensitivity Margin Map
  210.      */

  211.     public java.util.Map<java.lang.String, java.lang.Double> libor12MSensitivityMargin()
  212.     {
  213.         return _libor12MSensitivityMargin;
  214.     }

  215.     /**
  216.      * Retrieve the PRIME Sensitivity Margin Map
  217.      *
  218.      * @return The PRIME Sensitivity Margin Map
  219.      */

  220.     public java.util.Map<java.lang.String, java.lang.Double> primeSensitivityMargin()
  221.     {
  222.         return _primeSensitivityMargin;
  223.     }

  224.     /**
  225.      * Retrieve the MUNICIPAL Sensitivity Margin Map
  226.      *
  227.      * @return The MUNICIPAL Sensitivity Margin Map
  228.      */

  229.     public java.util.Map<java.lang.String, java.lang.Double> municipalSensitivityMargin()
  230.     {
  231.         return _municipalSensitivityMargin;
  232.     }

  233.     /**
  234.      * Retrieve the Bucket Concentration Risk Factor
  235.      *
  236.      * @return The Bucket Concentration Risk Factor
  237.      */

  238.     public double concentrationRiskFactor()
  239.     {
  240.         return _concentrationRiskFactor;
  241.     }

  242.     /**
  243.      * Compute the Cumulative OIS Sensitivity Margin
  244.      *
  245.      * @return The Cumulative OIS Sensitivity Margin
  246.      */

  247.     public double cumulativeOISSensitivityMargin()
  248.     {
  249.         double cumulativeOISSensitivityMargin = 0.;

  250.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  251.             _oisSensitivityMargin.entrySet())
  252.         {
  253.             cumulativeOISSensitivityMargin = cumulativeOISSensitivityMargin +
  254.                 oisSensitivityMarginEntry.getValue();
  255.         }

  256.         return cumulativeOISSensitivityMargin;
  257.     }

  258.     /**
  259.      * Compute the Cumulative LIBOR1M Sensitivity Margin
  260.      *
  261.      * @return The Cumulative LIBOR1M Sensitivity Margin
  262.      */

  263.     public double cumulativeLIBOR1MSensitivityMargin()
  264.     {
  265.         double cumulativeLIBOR1MSensitivityMargin = 0.;

  266.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  267.             _libor1MSensitivityMargin.entrySet())
  268.         {
  269.             cumulativeLIBOR1MSensitivityMargin = cumulativeLIBOR1MSensitivityMargin +
  270.                 libor1MSensitivityMarginEntry.getValue();
  271.         }

  272.         return cumulativeLIBOR1MSensitivityMargin;
  273.     }

  274.     /**
  275.      * Compute the Cumulative LIBOR3M Sensitivity Margin
  276.      *
  277.      * @return The Cumulative LIBOR3M Sensitivity Margin
  278.      */

  279.     public double cumulativeLIBOR3MSensitivityMargin()
  280.     {
  281.         double cumulativeLIBOR3MSensitivityMargin = 0.;

  282.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  283.             _libor3MSensitivityMargin.entrySet())
  284.         {
  285.             cumulativeLIBOR3MSensitivityMargin = cumulativeLIBOR3MSensitivityMargin +
  286.                 libor3MSensitivityMarginEntry.getValue();
  287.         }

  288.         return cumulativeLIBOR3MSensitivityMargin;
  289.     }

  290.     /**
  291.      * Compute the Cumulative LIBOR6M Sensitivity Margin
  292.      *
  293.      * @return The Cumulative LIBOR6M Sensitivity Margin
  294.      */

  295.     public double cumulativeLIBOR6MSensitivityMargin()
  296.     {
  297.         double cumulativeLIBOR6MSensitivityMargin = 0.;

  298.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  299.             _libor6MSensitivityMargin.entrySet())
  300.         {
  301.             cumulativeLIBOR6MSensitivityMargin = cumulativeLIBOR6MSensitivityMargin +
  302.                 libor6MSensitivityMarginEntry.getValue();
  303.         }

  304.         return cumulativeLIBOR6MSensitivityMargin;
  305.     }

  306.     /**
  307.      * Compute the Cumulative LIBOR12M Sensitivity Margin
  308.      *
  309.      * @return The Cumulative LIBOR12M Sensitivity Margin
  310.      */

  311.     public double cumulativeLIBOR12MSensitivityMargin()
  312.     {
  313.         double cumulativeLIBOR12MSensitivityMargin = 0.;

  314.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  315.             _libor12MSensitivityMargin.entrySet())
  316.         {
  317.             cumulativeLIBOR12MSensitivityMargin = cumulativeLIBOR12MSensitivityMargin +
  318.                 libor12MSensitivityMarginEntry.getValue();
  319.         }

  320.         return cumulativeLIBOR12MSensitivityMargin;
  321.     }

  322.     /**
  323.      * Compute the Cumulative PRIME Sensitivity Margin
  324.      *
  325.      * @return The Cumulative PRIME Sensitivity Margin
  326.      */

  327.     public double cumulativePRIMESensitivityMargin()
  328.     {
  329.         double cumulativePRIMESensitivityMargin = 0.;

  330.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  331.             _primeSensitivityMargin.entrySet())
  332.         {
  333.             cumulativePRIMESensitivityMargin = cumulativePRIMESensitivityMargin +
  334.                 primeSensitivityMarginEntry.getValue();
  335.         }

  336.         return cumulativePRIMESensitivityMargin;
  337.     }

  338.     /**
  339.      * Compute the Cumulative MUNICIPAL Sensitivity Margin
  340.      *
  341.      * @return The Cumulative MUNICIPAL Sensitivity Margin
  342.      */

  343.     public double cumulativeMUNICIPALSensitivityMargin()
  344.     {
  345.         double cumulativeMUNICIPALSensitivityMargin = 0.;

  346.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  347.             _municipalSensitivityMargin.entrySet())
  348.         {
  349.             cumulativeMUNICIPALSensitivityMargin = cumulativeMUNICIPALSensitivityMargin +
  350.                 municipalSensitivityMarginEntry.getValue();
  351.         }

  352.         return cumulativeMUNICIPALSensitivityMargin;
  353.     }

  354.     /**
  355.      * Compute the Cumulative Sensitivity Margin
  356.      *
  357.      * @return The Cumulative Sensitivity Margin
  358.      */

  359.     public double cumulativeSensitivityMargin()
  360.     {
  361.         return cumulativeOISSensitivityMargin() +
  362.             cumulativeLIBOR1MSensitivityMargin() +
  363.             cumulativeLIBOR3MSensitivityMargin() +
  364.             cumulativeLIBOR6MSensitivityMargin() +
  365.             cumulativeLIBOR12MSensitivityMargin() +
  366.             cumulativePRIMESensitivityMargin() +
  367.             cumulativeMUNICIPALSensitivityMargin();
  368.     }

  369.     /**
  370.      * Compute the Linear OIS-OIS Sensitivity Margin Co-variance
  371.      *
  372.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  373.      *
  374.      * @return The Linear OIS-OIS Sensitivity Margin Co-variance
  375.      *
  376.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  377.      */

  378.     public double linearMarginCovariance_OIS_OIS (
  379.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  380.         throws java.lang.Exception
  381.     {
  382.         if (null == bucketSensitivitySettingsIR)
  383.         {
  384.             throw new java.lang.Exception
  385.                 ("RiskFactorAggregateIR::linearMarginCovariance_OIS_OIS => Invalid Inputs");
  386.         }

  387.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  388.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  389.         double linearMarginCovariance_OIS_OIS = 0.;

  390.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginOuterEntry :
  391.             _oisSensitivityMargin.entrySet())
  392.         {
  393.             java.lang.String outerTenor = oisSensitivityMarginOuterEntry.getKey();

  394.             double outerSensitivityMargin = oisSensitivityMarginOuterEntry.getValue();

  395.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginInnerEntry :
  396.                 _oisSensitivityMargin.entrySet())
  397.             {
  398.                 java.lang.String innerTenor = oisSensitivityMarginInnerEntry.getKey();

  399.                 linearMarginCovariance_OIS_OIS = linearMarginCovariance_OIS_OIS + outerSensitivityMargin *
  400.                     oisSensitivityMarginInnerEntry.getValue() * (
  401.                         outerTenor.equalsIgnoreCase (innerTenor) ? 1. : tenorCorrelation.entry (
  402.                             outerTenor,
  403.                             innerTenor
  404.                         )
  405.                     );
  406.             }
  407.         }

  408.         return linearMarginCovariance_OIS_OIS;
  409.     }

  410.     /**
  411.      * Compute the Curvature OIS-OIS Sensitivity Margin Co-variance
  412.      *
  413.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  414.      *
  415.      * @return The Curvature OIS-OIS Sensitivity Margin Co-variance
  416.      *
  417.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  418.      */

  419.     public double curvatureMarginCovariance_OIS_OIS (
  420.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  421.         throws java.lang.Exception
  422.     {
  423.         if (null == bucketSensitivitySettingsIR)
  424.         {
  425.             throw new java.lang.Exception
  426.                 ("RiskFactorAggregateIR::curvatureMarginCovariance_OIS_OIS => Invalid Inputs");
  427.         }

  428.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  429.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  430.         double curvatureMarginCovariance_OIS_OIS = 0.;

  431.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginOuterEntry :
  432.             _oisSensitivityMargin.entrySet())
  433.         {
  434.             java.lang.String outerTenor = oisSensitivityMarginOuterEntry.getKey();

  435.             double outerSensitivityMargin = oisSensitivityMarginOuterEntry.getValue();

  436.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginInnerEntry :
  437.                 _oisSensitivityMargin.entrySet())
  438.             {
  439.                 java.lang.String innerTenor = oisSensitivityMarginInnerEntry.getKey();

  440.                 double crossTenorCorrelation = outerTenor.equalsIgnoreCase (innerTenor) ? 1. :
  441.                     tenorCorrelation.entry (
  442.                         outerTenor,
  443.                         innerTenor
  444.                     );

  445.                 curvatureMarginCovariance_OIS_OIS = curvatureMarginCovariance_OIS_OIS +
  446.                     outerSensitivityMargin * oisSensitivityMarginInnerEntry.getValue() *
  447.                         crossTenorCorrelation * crossTenorCorrelation;
  448.             }
  449.         }

  450.         return curvatureMarginCovariance_OIS_OIS;
  451.     }

  452.     /**
  453.      * Compute the Linear LIBOR1M-LIBOR1M Sensitivity Margin Co-variance
  454.      *
  455.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  456.      *
  457.      * @return The Linear LIBOR1M-LIBOR1M Sensitivity Margin Co-variance
  458.      *
  459.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  460.      */

  461.     public double linearMarginCovariance_LIBOR1M_LIBOR1M (
  462.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  463.         throws java.lang.Exception
  464.     {
  465.         if (null == bucketSensitivitySettingsIR)
  466.         {
  467.             throw new java.lang.Exception
  468.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR1M_LIBOR1M => Invalid Inputs");
  469.         }

  470.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  471.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  472.         double linearMarginCovariance_LIBOR1M_LIBOR1M = 0.;

  473.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginOuterEntry :
  474.             _libor1MSensitivityMargin.entrySet())
  475.         {
  476.             double outerSensitivityMargin = libor1MSensitivityMarginOuterEntry.getValue();

  477.             java.lang.String outerTenor = libor1MSensitivityMarginOuterEntry.getKey();

  478.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginInnerEntry :
  479.                 _libor1MSensitivityMargin.entrySet())
  480.             {
  481.                 java.lang.String innerTenor = libor1MSensitivityMarginInnerEntry.getKey();

  482.                 linearMarginCovariance_LIBOR1M_LIBOR1M = linearMarginCovariance_LIBOR1M_LIBOR1M +
  483.                     outerSensitivityMargin * libor1MSensitivityMarginInnerEntry.getValue() * (
  484.                         outerTenor.equalsIgnoreCase (innerTenor) ? 1. : tenorCorrelation.entry (
  485.                             outerTenor,
  486.                             innerTenor
  487.                         )
  488.                     );
  489.             }
  490.         }

  491.         return linearMarginCovariance_LIBOR1M_LIBOR1M;
  492.     }

  493.     /**
  494.      * Compute the Curvature LIBOR1M-LIBOR1M Sensitivity Margin Co-variance
  495.      *
  496.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  497.      *
  498.      * @return The Curvature LIBOR1M-LIBOR1M Sensitivity Margin Co-variance
  499.      *
  500.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  501.      */

  502.     public double curvatureMarginCovariance_LIBOR1M_LIBOR1M (
  503.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  504.         throws java.lang.Exception
  505.     {
  506.         if (null == bucketSensitivitySettingsIR)
  507.         {
  508.             throw new java.lang.Exception
  509.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR1M_LIBOR1M => Invalid Inputs");
  510.         }

  511.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  512.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  513.         double linearMarginCovariance_LIBOR1M_LIBOR1M = 0.;

  514.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginOuterEntry :
  515.             _libor1MSensitivityMargin.entrySet())
  516.         {
  517.             double outerSensitivityMargin = libor1MSensitivityMarginOuterEntry.getValue();

  518.             java.lang.String outerTenor = libor1MSensitivityMarginOuterEntry.getKey();

  519.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginInnerEntry :
  520.                 _libor1MSensitivityMargin.entrySet())
  521.             {
  522.                 java.lang.String innerTenor = libor1MSensitivityMarginInnerEntry.getKey();

  523.                 double crossTenorCorrelation = outerTenor.equalsIgnoreCase (innerTenor) ? 1. :
  524.                     tenorCorrelation.entry (
  525.                         outerTenor,
  526.                         innerTenor
  527.                     );

  528.                 linearMarginCovariance_LIBOR1M_LIBOR1M = linearMarginCovariance_LIBOR1M_LIBOR1M +
  529.                     outerSensitivityMargin * libor1MSensitivityMarginInnerEntry.getValue() *
  530.                         crossTenorCorrelation * crossTenorCorrelation;
  531.             }
  532.         }

  533.         return linearMarginCovariance_LIBOR1M_LIBOR1M;
  534.     }

  535.     /**
  536.      * Compute the Linear LIBOR3M-LIBOR3M Sensitivity Margin Co-variance
  537.      *
  538.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  539.      *
  540.      * @return The Linear LIBOR3M-LIBOR3M Sensitivity Margin Co-variance
  541.      *
  542.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  543.      */

  544.     public double linearMarginCovariance_LIBOR3M_LIBOR3M (
  545.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  546.         throws java.lang.Exception
  547.     {
  548.         if (null == bucketSensitivitySettingsIR)
  549.         {
  550.             throw new java.lang.Exception
  551.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR3M_LIBOR3M => Invalid Inputs");
  552.         }

  553.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  554.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  555.         double linearMarginCovariance_LIBOR3M_LIBOR3M = 0.;

  556.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginOuterEntry :
  557.             _libor3MSensitivityMargin.entrySet())
  558.         {
  559.             double outerSensitivityMargin = libor3MSensitivityMarginOuterEntry.getValue();

  560.             java.lang.String outerTenor = libor3MSensitivityMarginOuterEntry.getKey();

  561.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginInnerEntry :
  562.                 _libor3MSensitivityMargin.entrySet())
  563.             {
  564.                 java.lang.String innerTenor = libor3MSensitivityMarginInnerEntry.getKey();

  565.                 linearMarginCovariance_LIBOR3M_LIBOR3M = linearMarginCovariance_LIBOR3M_LIBOR3M +
  566.                     outerSensitivityMargin * libor3MSensitivityMarginInnerEntry.getValue() * (
  567.                         outerTenor.equalsIgnoreCase (innerTenor) ? 1. : tenorCorrelation.entry (
  568.                             outerTenor,
  569.                             innerTenor
  570.                         )
  571.                     );
  572.             }
  573.         }

  574.         return linearMarginCovariance_LIBOR3M_LIBOR3M;
  575.     }

  576.     /**
  577.      * Compute the Curvature LIBOR3M-LIBOR3M Sensitivity Margin Co-variance
  578.      *
  579.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  580.      *
  581.      * @return The Curvature LIBOR3M-LIBOR3M Sensitivity Margin Co-variance
  582.      *
  583.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  584.      */

  585.     public double curvatureMarginCovariance_LIBOR3M_LIBOR3M (
  586.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  587.         throws java.lang.Exception
  588.     {
  589.         if (null == bucketSensitivitySettingsIR)
  590.         {
  591.             throw new java.lang.Exception
  592.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR3M_LIBOR3M => Invalid Inputs");
  593.         }

  594.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  595.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  596.         double curvatureMarginCovariance_LIBOR3M_LIBOR3M = 0.;

  597.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginOuterEntry :
  598.             _libor3MSensitivityMargin.entrySet())
  599.         {
  600.             double outerSensitivityMargin = libor3MSensitivityMarginOuterEntry.getValue();

  601.             java.lang.String outerTenor = libor3MSensitivityMarginOuterEntry.getKey();

  602.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginInnerEntry :
  603.                 _libor3MSensitivityMargin.entrySet())
  604.             {
  605.                 java.lang.String innerTenor = libor3MSensitivityMarginInnerEntry.getKey();

  606.                 double crossTenorCorrelation = outerTenor.equalsIgnoreCase (innerTenor) ? 1. :
  607.                     tenorCorrelation.entry (
  608.                         outerTenor,
  609.                         innerTenor
  610.                     );

  611.                 curvatureMarginCovariance_LIBOR3M_LIBOR3M = curvatureMarginCovariance_LIBOR3M_LIBOR3M +
  612.                     outerSensitivityMargin * libor3MSensitivityMarginInnerEntry.getValue() *
  613.                         crossTenorCorrelation * crossTenorCorrelation;
  614.             }
  615.         }

  616.         return curvatureMarginCovariance_LIBOR3M_LIBOR3M;
  617.     }

  618.     /**
  619.      * Compute the Linear LIBOR6M-LIBOR6M Sensitivity Margin Co-variance
  620.      *
  621.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  622.      *
  623.      * @return The Linear LIBOR6M-LIBOR6M Sensitivity Margin Co-variance
  624.      *
  625.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  626.      */

  627.     public double linearMarginCovariance_LIBOR6M_LIBOR6M (
  628.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  629.         throws java.lang.Exception
  630.     {
  631.         if (null == bucketSensitivitySettingsIR)
  632.         {
  633.             throw new java.lang.Exception
  634.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR6M_LIBOR6M => Invalid Inputs");
  635.         }

  636.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  637.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  638.         double linearMarginCovariance_LIBOR6M_LIBOR6M = 0.;

  639.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginOuterEntry :
  640.             _libor6MSensitivityMargin.entrySet())
  641.         {
  642.             double outerSensitivityMargin = libor6MSensitivityMarginOuterEntry.getValue();

  643.             java.lang.String outerTenor = libor6MSensitivityMarginOuterEntry.getKey();

  644.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginInnerEntry :
  645.                 _libor6MSensitivityMargin.entrySet())
  646.             {
  647.                 java.lang.String innerTenor = libor6MSensitivityMarginInnerEntry.getKey();

  648.                 linearMarginCovariance_LIBOR6M_LIBOR6M = linearMarginCovariance_LIBOR6M_LIBOR6M +
  649.                     outerSensitivityMargin * libor6MSensitivityMarginInnerEntry.getValue() * (
  650.                         outerTenor.equalsIgnoreCase (innerTenor) ? 1. : tenorCorrelation.entry (
  651.                             outerTenor,
  652.                             innerTenor
  653.                         )
  654.                     );
  655.             }
  656.         }

  657.         return linearMarginCovariance_LIBOR6M_LIBOR6M;
  658.     }

  659.     /**
  660.      * Compute the Curvature LIBOR6M-LIBOR6M Sensitivity Margin Co-variance
  661.      *
  662.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  663.      *
  664.      * @return The Curvature LIBOR6M-LIBOR6M Sensitivity Margin Co-variance
  665.      *
  666.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  667.      */

  668.     public double curvatureMarginCovariance_LIBOR6M_LIBOR6M (
  669.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  670.         throws java.lang.Exception
  671.     {
  672.         if (null == bucketSensitivitySettingsIR)
  673.         {
  674.             throw new java.lang.Exception
  675.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR6M_LIBOR6M => Invalid Inputs");
  676.         }

  677.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  678.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  679.         double curvatureMarginCovariance_LIBOR6M_LIBOR6M = 0.;

  680.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginOuterEntry :
  681.             _libor6MSensitivityMargin.entrySet())
  682.         {
  683.             double outerSensitivityMargin = libor6MSensitivityMarginOuterEntry.getValue();

  684.             java.lang.String outerTenor = libor6MSensitivityMarginOuterEntry.getKey();

  685.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginInnerEntry :
  686.                 _libor6MSensitivityMargin.entrySet())
  687.             {
  688.                 java.lang.String innerTenor = libor6MSensitivityMarginInnerEntry.getKey();

  689.                 double crossTenorCorrelation = outerTenor.equalsIgnoreCase (innerTenor) ? 1. :
  690.                     tenorCorrelation.entry (
  691.                         outerTenor,
  692.                         innerTenor
  693.                     );

  694.                 curvatureMarginCovariance_LIBOR6M_LIBOR6M = curvatureMarginCovariance_LIBOR6M_LIBOR6M +
  695.                     outerSensitivityMargin * libor6MSensitivityMarginInnerEntry.getValue() *
  696.                         crossTenorCorrelation * crossTenorCorrelation;
  697.             }
  698.         }

  699.         return curvatureMarginCovariance_LIBOR6M_LIBOR6M;
  700.     }

  701.     /**
  702.      * Compute the Linear LIBOR12M-LIBOR12M Sensitivity Margin Co-variance
  703.      *
  704.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  705.      *
  706.      * @return The Linear LIBOR12M-LIBOR12M Sensitivity Margin Co-variance
  707.      *
  708.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  709.      */

  710.     public double linearMarginCovariance_LIBOR12M_LIBOR12M (
  711.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  712.         throws java.lang.Exception
  713.     {
  714.         if (null == bucketSensitivitySettingsIR)
  715.         {
  716.             throw new java.lang.Exception
  717.                 ("IRFactorAggregate::marginCovariance_LIBOR12M_LIBOR12M => Invalid Inputs");
  718.         }

  719.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  720.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  721.         double linearMarginCovariance_LIBOR12M_LIBOR12M = 0.;

  722.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginOuterEntry :
  723.             _libor12MSensitivityMargin.entrySet())
  724.         {
  725.             double outerSensitivityMargin = libor12MSensitivityMarginOuterEntry.getValue();

  726.             java.lang.String outerTenor = libor12MSensitivityMarginOuterEntry.getKey();

  727.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginInnerEntry
  728.                 : _libor12MSensitivityMargin.entrySet())
  729.             {
  730.                 java.lang.String innerTenor = libor12MSensitivityMarginInnerEntry.getKey();

  731.                 linearMarginCovariance_LIBOR12M_LIBOR12M = linearMarginCovariance_LIBOR12M_LIBOR12M +
  732.                     outerSensitivityMargin * libor12MSensitivityMarginInnerEntry.getValue() * (
  733.                         outerTenor.equalsIgnoreCase (innerTenor) ? 1. : tenorCorrelation.entry (
  734.                             outerTenor,
  735.                             innerTenor
  736.                         )
  737.                     );
  738.             }
  739.         }

  740.         return linearMarginCovariance_LIBOR12M_LIBOR12M;
  741.     }

  742.     /**
  743.      * Compute the Curvature LIBOR12M-LIBOR12M Sensitivity Margin Co-variance
  744.      *
  745.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  746.      *
  747.      * @return The Curvature LIBOR12M-LIBOR12M Sensitivity Margin Co-variance
  748.      *
  749.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  750.      */

  751.     public double curvatureMarginCovariance_LIBOR12M_LIBOR12M (
  752.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  753.         throws java.lang.Exception
  754.     {
  755.         if (null == bucketSensitivitySettingsIR)
  756.         {
  757.             throw new java.lang.Exception
  758.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR12M_LIBOR12M => Invalid Inputs");
  759.         }

  760.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  761.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  762.         double curvatureMarginCovariance_LIBOR12M_LIBOR12M = 0.;

  763.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginOuterEntry :
  764.             _libor12MSensitivityMargin.entrySet())
  765.         {
  766.             double outerSensitivityMargin = libor12MSensitivityMarginOuterEntry.getValue();

  767.             java.lang.String outerTenor = libor12MSensitivityMarginOuterEntry.getKey();

  768.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginInnerEntry
  769.                 : _libor12MSensitivityMargin.entrySet())
  770.             {
  771.                 java.lang.String innerTenor = libor12MSensitivityMarginInnerEntry.getKey();

  772.                 double crossTenorCorrelation = outerTenor.equalsIgnoreCase (innerTenor) ? 1. :
  773.                     tenorCorrelation.entry (
  774.                         outerTenor,
  775.                         innerTenor
  776.                     );

  777.                 curvatureMarginCovariance_LIBOR12M_LIBOR12M = curvatureMarginCovariance_LIBOR12M_LIBOR12M +
  778.                     outerSensitivityMargin * libor12MSensitivityMarginInnerEntry.getValue() *
  779.                         crossTenorCorrelation * crossTenorCorrelation;
  780.             }
  781.         }

  782.         return curvatureMarginCovariance_LIBOR12M_LIBOR12M;
  783.     }

  784.     /**
  785.      * Compute the Linear PRIME-PRIME Sensitivity Margin Co-variance
  786.      *
  787.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  788.      *
  789.      * @return The Linear PRIME-PRIME Sensitivity Margin Co-variance
  790.      *
  791.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  792.      */

  793.     public double linearMarginCovariance_PRIME_PRIME (
  794.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  795.         throws java.lang.Exception
  796.     {
  797.         if (null == bucketSensitivitySettingsIR)
  798.         {
  799.             throw new java.lang.Exception
  800.                 ("IRFactorAggregate::linearMarginCovariance_PRIME_PRIME => Invalid Inputs");
  801.         }

  802.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  803.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  804.         double linearMarginCovariance_PRIME_PRIME = 0.;

  805.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginOuterEntry :
  806.             _primeSensitivityMargin.entrySet())
  807.         {
  808.             double outerSensitivityMargin = primeSensitivityMarginOuterEntry.getValue();

  809.             java.lang.String outerTenor = primeSensitivityMarginOuterEntry.getKey();

  810.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginInnerEntry :
  811.                 _primeSensitivityMargin.entrySet())
  812.             {
  813.                 java.lang.String innerTenor = primeSensitivityMarginInnerEntry.getKey();

  814.                 linearMarginCovariance_PRIME_PRIME = linearMarginCovariance_PRIME_PRIME +
  815.                     outerSensitivityMargin * primeSensitivityMarginInnerEntry.getValue() * (
  816.                         outerTenor.equalsIgnoreCase (innerTenor) ? 1. : tenorCorrelation.entry (
  817.                             outerTenor,
  818.                             innerTenor
  819.                         )
  820.                     );
  821.             }
  822.         }

  823.         return linearMarginCovariance_PRIME_PRIME;
  824.     }

  825.     /**
  826.      * Compute the Curvature PRIME-PRIME Sensitivity Margin Co-variance
  827.      *
  828.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  829.      *
  830.      * @return The Curvature PRIME-PRIME Sensitivity Margin Co-variance
  831.      *
  832.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  833.      */

  834.     public double curvatureMarginCovariance_PRIME_PRIME (
  835.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  836.         throws java.lang.Exception
  837.     {
  838.         if (null == bucketSensitivitySettingsIR)
  839.         {
  840.             throw new java.lang.Exception
  841.                 ("IRFactorAggregate::curvatureMarginCovariance_PRIME_PRIME => Invalid Inputs");
  842.         }

  843.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  844.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  845.         double curvatureMarginCovariance_PRIME_PRIME = 0.;

  846.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginOuterEntry :
  847.             _primeSensitivityMargin.entrySet())
  848.         {
  849.             double outerSensitivityMargin = primeSensitivityMarginOuterEntry.getValue();

  850.             java.lang.String outerTenor = primeSensitivityMarginOuterEntry.getKey();

  851.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginInnerEntry :
  852.                 _primeSensitivityMargin.entrySet())
  853.             {
  854.                 java.lang.String innerTenor = primeSensitivityMarginInnerEntry.getKey();

  855.                 double crossTenorCorrelation = outerTenor.equalsIgnoreCase (innerTenor) ? 1. :
  856.                     tenorCorrelation.entry (
  857.                         outerTenor,
  858.                         innerTenor
  859.                     );

  860.                 curvatureMarginCovariance_PRIME_PRIME = curvatureMarginCovariance_PRIME_PRIME +
  861.                     outerSensitivityMargin * primeSensitivityMarginInnerEntry.getValue() *
  862.                         crossTenorCorrelation * crossTenorCorrelation;
  863.             }
  864.         }

  865.         return curvatureMarginCovariance_PRIME_PRIME;
  866.     }

  867.     /**
  868.      * Compute the Linear MUNICIPAL-MUNICIPAL Sensitivity Margin Co-variance
  869.      *
  870.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  871.      *
  872.      * @return The Linear MUNICIPAL-MUNICIPAL Sensitivity Margin Co-variance
  873.      *
  874.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  875.      */

  876.     public double linearMarginCovariance_MUNICIPAL_MUNICIPAL (
  877.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  878.         throws java.lang.Exception
  879.     {
  880.         if (null == bucketSensitivitySettingsIR)
  881.         {
  882.             throw new java.lang.Exception
  883.                 ("IRFactorAggregate::linearMarginCovariance_MUNICIPAL_MUNICIPAL => Invalid Inputs");
  884.         }

  885.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  886.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  887.         double linearMarginCovariance_MUNICIPAL_MUNICIPAL = 0.;

  888.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginOuterEntry :
  889.             _municipalSensitivityMargin.entrySet())
  890.         {
  891.             double outerSensitivityMargin = municipalSensitivityMarginOuterEntry.getValue();

  892.             java.lang.String outerTenor = municipalSensitivityMarginOuterEntry.getKey();

  893.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginInnerEntry
  894.                 : _municipalSensitivityMargin.entrySet())
  895.             {
  896.                 java.lang.String innerTenor = municipalSensitivityMarginInnerEntry.getKey();

  897.                 linearMarginCovariance_MUNICIPAL_MUNICIPAL = linearMarginCovariance_MUNICIPAL_MUNICIPAL +
  898.                     outerSensitivityMargin * municipalSensitivityMarginInnerEntry.getValue() * (
  899.                         outerTenor.equalsIgnoreCase (innerTenor) ? 1. : tenorCorrelation.entry (
  900.                             outerTenor,
  901.                             innerTenor
  902.                         )
  903.                     );
  904.             }
  905.         }

  906.         return linearMarginCovariance_MUNICIPAL_MUNICIPAL;
  907.     }

  908.     /**
  909.      * Compute the Curvature MUNICIPAL-MUNICIPAL Sensitivity Margin Co-variance
  910.      *
  911.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  912.      *
  913.      * @return The Curvature MUNICIPAL-MUNICIPAL Sensitivity Margin Co-variance
  914.      *
  915.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  916.      */

  917.     public double curvatureMarginCovariance_MUNICIPAL_MUNICIPAL (
  918.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  919.         throws java.lang.Exception
  920.     {
  921.         if (null == bucketSensitivitySettingsIR)
  922.         {
  923.             throw new java.lang.Exception
  924.                 ("IRFactorAggregate::curvatureMarginCovariance_MUNICIPAL_MUNICIPAL => Invalid Inputs");
  925.         }

  926.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  927.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  928.         double curvatureMarginCovariance_MUNICIPAL_MUNICIPAL = 0.;

  929.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginOuterEntry :
  930.             _municipalSensitivityMargin.entrySet())
  931.         {
  932.             double outerSensitivityMargin = municipalSensitivityMarginOuterEntry.getValue();

  933.             java.lang.String outerTenor = municipalSensitivityMarginOuterEntry.getKey();

  934.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginInnerEntry
  935.                 : _municipalSensitivityMargin.entrySet())
  936.             {
  937.                 java.lang.String innerTenor = municipalSensitivityMarginInnerEntry.getKey();

  938.                 double crossTenorCorrelation = outerTenor.equalsIgnoreCase (innerTenor) ? 1. :
  939.                     tenorCorrelation.entry (
  940.                         outerTenor,
  941.                         innerTenor
  942.                     );

  943.                 curvatureMarginCovariance_MUNICIPAL_MUNICIPAL = curvatureMarginCovariance_MUNICIPAL_MUNICIPAL
  944.                     + outerSensitivityMargin * municipalSensitivityMarginInnerEntry.getValue() *
  945.                         crossTenorCorrelation * crossTenorCorrelation;
  946.             }
  947.         }

  948.         return curvatureMarginCovariance_MUNICIPAL_MUNICIPAL;
  949.     }

  950.     /**
  951.      * Compute the Linear OIS-LIBOR1M Sensitivity Margin Co-variance
  952.      *
  953.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  954.      *
  955.      * @return The Linear OIS-LIBOR1M Sensitivity Margin Co-variance
  956.      *
  957.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  958.      */

  959.     public double linearMarginCovariance_OIS_LIBOR1M (
  960.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  961.         throws java.lang.Exception
  962.     {
  963.         if (null == bucketSensitivitySettingsIR)
  964.         {
  965.             throw new java.lang.Exception
  966.                 ("IRFactorAggregate::linearMarginCovariance_OIS_LIBOR1M => Invalid Inputs");
  967.         }

  968.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  969.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  970.         double linearMarginCovariance_OIS_LIBOR1M = 0.;

  971.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  972.             _oisSensitivityMargin.entrySet())
  973.         {
  974.             java.lang.String oisTenor = oisSensitivityMarginEntry.getKey();

  975.             double oisSensitivityMargin = oisSensitivityMarginEntry.getValue();

  976.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  977.                 _libor1MSensitivityMargin.entrySet())
  978.             {
  979.                 java.lang.String libor1MTenor = libor1MSensitivityMarginEntry.getKey();

  980.                 linearMarginCovariance_OIS_LIBOR1M = linearMarginCovariance_OIS_LIBOR1M +
  981.                     oisSensitivityMargin * libor1MSensitivityMarginEntry.getValue() * (
  982.                         oisTenor.equalsIgnoreCase (libor1MTenor) ? 1. : tenorCorrelation.entry (
  983.                             oisTenor,
  984.                             libor1MTenor
  985.                         )
  986.                     );
  987.             }
  988.         }

  989.         return linearMarginCovariance_OIS_LIBOR1M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  990.     }

  991.     /**
  992.      * Compute the Curvature OIS-LIBOR1M Sensitivity Margin Co-variance
  993.      *
  994.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  995.      *
  996.      * @return The Curvature OIS-LIBOR1M Sensitivity Margin Co-variance
  997.      *
  998.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  999.      */

  1000.     public double curvatureMarginCovariance_OIS_LIBOR1M (
  1001.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1002.         throws java.lang.Exception
  1003.     {
  1004.         if (null == bucketSensitivitySettingsIR)
  1005.         {
  1006.             throw new java.lang.Exception
  1007.                 ("IRFactorAggregate::curvatureMarginCovariance_OIS_LIBOR1M => Invalid Inputs");
  1008.         }

  1009.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1010.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1011.         double curvatureMarginCovariance_OIS_LIBOR1M = 0.;

  1012.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  1013.             _oisSensitivityMargin.entrySet())
  1014.         {
  1015.             java.lang.String oisTenor = oisSensitivityMarginEntry.getKey();

  1016.             double oisSensitivityMargin = oisSensitivityMarginEntry.getValue();

  1017.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  1018.                 _libor1MSensitivityMargin.entrySet())
  1019.             {
  1020.                 java.lang.String libor1MTenor = libor1MSensitivityMarginEntry.getKey();

  1021.                 double crossTenorCorrelation = oisTenor.equalsIgnoreCase (libor1MTenor) ? 1. :
  1022.                     tenorCorrelation.entry (
  1023.                         oisTenor,
  1024.                         libor1MTenor
  1025.                     );

  1026.                 curvatureMarginCovariance_OIS_LIBOR1M = curvatureMarginCovariance_OIS_LIBOR1M +
  1027.                     oisSensitivityMargin * libor1MSensitivityMarginEntry.getValue() * crossTenorCorrelation *
  1028.                         crossTenorCorrelation;
  1029.             }
  1030.         }

  1031.         return curvatureMarginCovariance_OIS_LIBOR1M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1032.     }

  1033.     /**
  1034.      * Compute the Linear OIS-LIBOR3M Sensitivity Margin Co-variance
  1035.      *
  1036.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1037.      *
  1038.      * @return The Linear OIS-LIBOR3M Sensitivity Margin Co-variance
  1039.      *
  1040.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1041.      */

  1042.     public double linearMarginCovariance_OIS_LIBOR3M (
  1043.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1044.         throws java.lang.Exception
  1045.     {
  1046.         if (null == bucketSensitivitySettingsIR)
  1047.         {
  1048.             throw new java.lang.Exception
  1049.                 ("IRFactorAggregate::linearMarginCovariance_OIS_LIBOR3M => Invalid Inputs");
  1050.         }

  1051.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1052.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1053.         double linearMarginCovariance_OIS_LIBOR3M = 0.;

  1054.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  1055.             _oisSensitivityMargin.entrySet())
  1056.         {
  1057.             double oisSensitivityMargin = oisSensitivityMarginEntry.getValue();

  1058.             java.lang.String oisTenor = oisSensitivityMarginEntry.getKey();

  1059.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  1060.                 _libor3MSensitivityMargin.entrySet())
  1061.             {
  1062.                 java.lang.String libor3MTenor = libor3MSensitivityMarginEntry.getKey();

  1063.                 linearMarginCovariance_OIS_LIBOR3M = linearMarginCovariance_OIS_LIBOR3M +
  1064.                     oisSensitivityMargin * libor3MSensitivityMarginEntry.getValue() * (
  1065.                         oisTenor.equalsIgnoreCase (libor3MTenor) ? 1. : tenorCorrelation.entry (
  1066.                             oisTenor,
  1067.                             libor3MTenor
  1068.                         )
  1069.                     );
  1070.             }
  1071.         }

  1072.         return linearMarginCovariance_OIS_LIBOR3M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1073.     }

  1074.     /**
  1075.      * Compute the Curvature OIS-LIBOR3M Sensitivity Margin Co-variance
  1076.      *
  1077.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1078.      *
  1079.      * @return The Curvature OIS-LIBOR3M Sensitivity Margin Co-variance
  1080.      *
  1081.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1082.      */

  1083.     public double curvatureMarginCovariance_OIS_LIBOR3M (
  1084.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1085.         throws java.lang.Exception
  1086.     {
  1087.         if (null == bucketSensitivitySettingsIR)
  1088.         {
  1089.             throw new java.lang.Exception
  1090.                 ("IRFactorAggregate::curvatureMarginCovariance_OIS_LIBOR3M => Invalid Inputs");
  1091.         }

  1092.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1093.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1094.         double curvatureMarginCovariance_OIS_LIBOR3M = 0.;

  1095.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  1096.             _oisSensitivityMargin.entrySet())
  1097.         {
  1098.             double oisSensitivityMargin = oisSensitivityMarginEntry.getValue();

  1099.             java.lang.String oisTenor = oisSensitivityMarginEntry.getKey();

  1100.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  1101.                 _libor3MSensitivityMargin.entrySet())
  1102.             {
  1103.                 java.lang.String libor3MTenor = libor3MSensitivityMarginEntry.getKey();

  1104.                 double crossTenorCorrelation = oisTenor.equalsIgnoreCase (libor3MTenor) ? 1. :
  1105.                     tenorCorrelation.entry (
  1106.                         oisTenor,
  1107.                         libor3MTenor
  1108.                     );

  1109.                 curvatureMarginCovariance_OIS_LIBOR3M = curvatureMarginCovariance_OIS_LIBOR3M +
  1110.                     oisSensitivityMargin * libor3MSensitivityMarginEntry.getValue() * crossTenorCorrelation *
  1111.                         crossTenorCorrelation;
  1112.             }
  1113.         }

  1114.         return curvatureMarginCovariance_OIS_LIBOR3M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1115.     }

  1116.     /**
  1117.      * Compute the Linear OIS-LIBOR6M Sensitivity Margin Co-variance
  1118.      *
  1119.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1120.      *
  1121.      * @return The Linear OIS-LIBOR6M Sensitivity Margin Co-variance
  1122.      *
  1123.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1124.      */

  1125.     public double linearMarginCovariance_OIS_LIBOR6M (
  1126.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1127.         throws java.lang.Exception
  1128.     {
  1129.         if (null == bucketSensitivitySettingsIR)
  1130.         {
  1131.             throw new java.lang.Exception
  1132.                 ("IRFactorAggregate::linearMarginCovariance_OIS_LIBOR6M => Invalid Inputs");
  1133.         }

  1134.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1135.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1136.         double linearMarginCovariance_OIS_LIBOR6M = 0.;

  1137.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  1138.             _oisSensitivityMargin.entrySet())
  1139.         {
  1140.             double oisSensitivityMargin = oisSensitivityMarginEntry.getValue();

  1141.             java.lang.String oisTenor = oisSensitivityMarginEntry.getKey();

  1142.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  1143.                 _libor6MSensitivityMargin.entrySet())
  1144.             {
  1145.                 java.lang.String libor6MTenor = libor6MSensitivityMarginEntry.getKey();

  1146.                 linearMarginCovariance_OIS_LIBOR6M = linearMarginCovariance_OIS_LIBOR6M +
  1147.                     oisSensitivityMargin * libor6MSensitivityMarginEntry.getValue() * (
  1148.                         oisTenor.equalsIgnoreCase (libor6MTenor) ? 1. : tenorCorrelation.entry (
  1149.                             oisTenor,
  1150.                             libor6MTenor
  1151.                         )
  1152.                     );
  1153.             }
  1154.         }

  1155.         return linearMarginCovariance_OIS_LIBOR6M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1156.     }

  1157.     /**
  1158.      * Compute the Curvature OIS-LIBOR6M Sensitivity Margin Co-variance
  1159.      *
  1160.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1161.      *
  1162.      * @return The Curvature OIS-LIBOR6M Sensitivity Margin Co-variance
  1163.      *
  1164.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1165.      */

  1166.     public double curvatureMarginCovariance_OIS_LIBOR6M (
  1167.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1168.         throws java.lang.Exception
  1169.     {
  1170.         if (null == bucketSensitivitySettingsIR)
  1171.         {
  1172.             throw new java.lang.Exception
  1173.                 ("IRFactorAggregate::curvatureMarginCovariance_OIS_LIBOR6M => Invalid Inputs");
  1174.         }

  1175.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1176.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1177.         double curvatureMarginCovariance_OIS_LIBOR6M = 0.;

  1178.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  1179.             _oisSensitivityMargin.entrySet())
  1180.         {
  1181.             double oisSensitivityMargin = oisSensitivityMarginEntry.getValue();

  1182.             java.lang.String oisTenor = oisSensitivityMarginEntry.getKey();

  1183.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  1184.                 _libor6MSensitivityMargin.entrySet())
  1185.             {
  1186.                 java.lang.String libor6MTenor = libor6MSensitivityMarginEntry.getKey();

  1187.                 double crossTenorCorrelation = oisTenor.equalsIgnoreCase (libor6MTenor) ? 1. :
  1188.                     tenorCorrelation.entry (
  1189.                         oisTenor,
  1190.                         libor6MTenor
  1191.                     );

  1192.                 curvatureMarginCovariance_OIS_LIBOR6M = curvatureMarginCovariance_OIS_LIBOR6M +
  1193.                     oisSensitivityMargin * libor6MSensitivityMarginEntry.getValue() * crossTenorCorrelation *
  1194.                         crossTenorCorrelation;
  1195.             }
  1196.         }

  1197.         return curvatureMarginCovariance_OIS_LIBOR6M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1198.     }

  1199.     /**
  1200.      * Compute the Linear OIS-LIBOR12M Sensitivity Margin Co-variance
  1201.      *
  1202.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1203.      *
  1204.      * @return The Linear OIS-LIBOR12M Sensitivity Margin Co-variance
  1205.      *
  1206.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1207.      */

  1208.     public double linearMarginCovariance_OIS_LIBOR12M (
  1209.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1210.         throws java.lang.Exception
  1211.     {
  1212.         if (null == bucketSensitivitySettingsIR)
  1213.         {
  1214.             throw new java.lang.Exception
  1215.                 ("IRFactorAggregate::linearMarginCovariance_OIS_LIBOR12M => Invalid Inputs");
  1216.         }

  1217.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1218.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1219.         double linearMarginCovariance_OIS_LIBOR12M = 0.;

  1220.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  1221.             _oisSensitivityMargin.entrySet())
  1222.         {
  1223.             double oisSensitivity = oisSensitivityMarginEntry.getValue();

  1224.             java.lang.String oisTenor = oisSensitivityMarginEntry.getKey();

  1225.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  1226.                 _libor12MSensitivityMargin.entrySet())
  1227.             {
  1228.                 java.lang.String libor12MTenor = libor12MSensitivityMarginEntry.getKey();

  1229.                 linearMarginCovariance_OIS_LIBOR12M = linearMarginCovariance_OIS_LIBOR12M +
  1230.                     oisSensitivity * libor12MSensitivityMarginEntry.getValue() * (
  1231.                         oisTenor.equalsIgnoreCase (libor12MTenor) ? 1. : tenorCorrelation.entry (
  1232.                             oisTenor,
  1233.                             libor12MTenor
  1234.                         )
  1235.                     );
  1236.             }
  1237.         }

  1238.         return linearMarginCovariance_OIS_LIBOR12M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1239.     }

  1240.     /**
  1241.      * Compute the Curvature OIS-LIBOR12M Sensitivity Margin Co-variance
  1242.      *
  1243.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1244.      *
  1245.      * @return The Curvature OIS-LIBOR12M Sensitivity Margin Co-variance
  1246.      *
  1247.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1248.      */

  1249.     public double curvatureMarginCovariance_OIS_LIBOR12M (
  1250.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1251.         throws java.lang.Exception
  1252.     {
  1253.         if (null == bucketSensitivitySettingsIR)
  1254.         {
  1255.             throw new java.lang.Exception
  1256.                 ("IRFactorAggregate::curvatureMarginCovariance_OIS_LIBOR12M => Invalid Inputs");
  1257.         }

  1258.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1259.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1260.         double curvatureMarginCovariance_OIS_LIBOR12M = 0.;

  1261.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  1262.             _oisSensitivityMargin.entrySet())
  1263.         {
  1264.             double oisSensitivity = oisSensitivityMarginEntry.getValue();

  1265.             java.lang.String oisTenor = oisSensitivityMarginEntry.getKey();

  1266.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  1267.                 _libor12MSensitivityMargin.entrySet())
  1268.             {
  1269.                 java.lang.String libor12MTenor = libor12MSensitivityMarginEntry.getKey();

  1270.                 double crossTenorCorrelation = oisTenor.equalsIgnoreCase (libor12MTenor) ? 1. :
  1271.                     tenorCorrelation.entry (
  1272.                         oisTenor,
  1273.                         libor12MTenor
  1274.                     );

  1275.                 curvatureMarginCovariance_OIS_LIBOR12M = curvatureMarginCovariance_OIS_LIBOR12M +
  1276.                     oisSensitivity * libor12MSensitivityMarginEntry.getValue() * crossTenorCorrelation *
  1277.                         crossTenorCorrelation;
  1278.             }
  1279.         }

  1280.         return curvatureMarginCovariance_OIS_LIBOR12M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1281.     }

  1282.     /**
  1283.      * Compute the Linear OIS-PRIME Sensitivity Margin Co-variance
  1284.      *
  1285.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1286.      *
  1287.      * @return The Linear OIS-PRIME Sensitivity Margin Co-variance
  1288.      *
  1289.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1290.      */

  1291.     public double linearMarginCovariance_OIS_PRIME (
  1292.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1293.         throws java.lang.Exception
  1294.     {
  1295.         if (null == bucketSensitivitySettingsIR)
  1296.         {
  1297.             throw new java.lang.Exception
  1298.                 ("IRFactorAggregate::linearMarginCovariance_OIS_PRIME => Invalid Inputs");
  1299.         }

  1300.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1301.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1302.         double linearMarginCovariance_OIS_PRIME = 0.;

  1303.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  1304.             _oisSensitivityMargin.entrySet())
  1305.         {
  1306.             double oisSensitivityMargin = oisSensitivityMarginEntry.getValue();

  1307.             java.lang.String oisTenor = oisSensitivityMarginEntry.getKey();

  1308.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  1309.                 _primeSensitivityMargin.entrySet())
  1310.             {
  1311.                 java.lang.String primeTenor = primeSensitivityMarginEntry.getKey();

  1312.                 linearMarginCovariance_OIS_PRIME = linearMarginCovariance_OIS_PRIME + oisSensitivityMargin *
  1313.                     primeSensitivityMarginEntry.getValue() * (
  1314.                         oisTenor.equalsIgnoreCase (primeTenor) ? 1. : tenorCorrelation.entry (
  1315.                             oisTenor,
  1316.                             primeTenor
  1317.                         )
  1318.                     );
  1319.             }
  1320.         }

  1321.         return linearMarginCovariance_OIS_PRIME * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1322.     }

  1323.     /**
  1324.      * Compute the Curvature OIS-PRIME Sensitivity Margin Co-variance
  1325.      *
  1326.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1327.      *
  1328.      * @return The Curvature OIS-PRIME Sensitivity Margin Co-variance
  1329.      *
  1330.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1331.      */

  1332.     public double curvatureMarginCovariance_OIS_PRIME (
  1333.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1334.         throws java.lang.Exception
  1335.     {
  1336.         if (null == bucketSensitivitySettingsIR)
  1337.         {
  1338.             throw new java.lang.Exception
  1339.                 ("IRFactorAggregate::curvatureMarginCovariance_OIS_PRIME => Invalid Inputs");
  1340.         }

  1341.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1342.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1343.         double curvatureMarginCovariance_OIS_PRIME = 0.;

  1344.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  1345.             _oisSensitivityMargin.entrySet())
  1346.         {
  1347.             double oisSensitivityMargin = oisSensitivityMarginEntry.getValue();

  1348.             java.lang.String oisTenor = oisSensitivityMarginEntry.getKey();

  1349.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  1350.                 _primeSensitivityMargin.entrySet())
  1351.             {
  1352.                 java.lang.String primeTenor = primeSensitivityMarginEntry.getKey();

  1353.                 double crossTenorCorrelation = oisTenor.equalsIgnoreCase (primeTenor) ? 1. :
  1354.                     tenorCorrelation.entry (
  1355.                         oisTenor,
  1356.                         primeTenor
  1357.                     );

  1358.                 curvatureMarginCovariance_OIS_PRIME = curvatureMarginCovariance_OIS_PRIME +
  1359.                     oisSensitivityMargin * primeSensitivityMarginEntry.getValue() * crossTenorCorrelation *
  1360.                         crossTenorCorrelation;
  1361.             }
  1362.         }

  1363.         return curvatureMarginCovariance_OIS_PRIME * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1364.     }

  1365.     /**
  1366.      * Compute the Linear OIS-MUNICIPAL Sensitivity Margin Co-variance
  1367.      *
  1368.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1369.      *
  1370.      * @return The Linear OIS-MUNICIPAL Sensitivity Margin Co-variance
  1371.      *
  1372.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1373.      */

  1374.     public double linearMarginCovariance_OIS_MUNICIPAL (
  1375.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1376.         throws java.lang.Exception
  1377.     {
  1378.         if (null == bucketSensitivitySettingsIR)
  1379.         {
  1380.             throw new java.lang.Exception
  1381.                 ("IRFactorAggregate::linearMarginCovariance_OIS_MUNICIPAL => Invalid Inputs");
  1382.         }

  1383.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1384.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1385.         double linearMarginCovariance_OIS_MUNICIPAL = 0.;

  1386.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  1387.             _oisSensitivityMargin.entrySet())
  1388.         {
  1389.             double oisSensitivityMargin = oisSensitivityMarginEntry.getValue();

  1390.             java.lang.String oisTenor = oisSensitivityMarginEntry.getKey();

  1391.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  1392.                 _municipalSensitivityMargin.entrySet())
  1393.             {
  1394.                 java.lang.String municipalTenor = municipalSensitivityMarginEntry.getKey();

  1395.                 linearMarginCovariance_OIS_MUNICIPAL = linearMarginCovariance_OIS_MUNICIPAL +
  1396.                     oisSensitivityMargin * municipalSensitivityMarginEntry.getValue() * (
  1397.                         oisTenor.equalsIgnoreCase (municipalTenor) ? 1. : tenorCorrelation.entry (
  1398.                             oisTenor,
  1399.                             municipalTenor
  1400.                         )
  1401.                     );
  1402.             }
  1403.         }

  1404.         return linearMarginCovariance_OIS_MUNICIPAL * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1405.     }

  1406.     /**
  1407.      * Compute the Curvature OIS-MUNICIPAL Sensitivity Margin Co-variance
  1408.      *
  1409.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1410.      *
  1411.      * @return The Curvature OIS-MUNICIPAL Sensitivity Margin Co-variance
  1412.      *
  1413.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1414.      */

  1415.     public double curvatureMarginCovariance_OIS_MUNICIPAL (
  1416.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1417.         throws java.lang.Exception
  1418.     {
  1419.         if (null == bucketSensitivitySettingsIR)
  1420.         {
  1421.             throw new java.lang.Exception
  1422.                 ("IRFactorAggregate::curvatureMarginCovariance_OIS_MUNICIPAL => Invalid Inputs");
  1423.         }

  1424.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1425.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1426.         double curvatureMarginCovariance_OIS_MUNICIPAL = 0.;

  1427.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> oisSensitivityMarginEntry :
  1428.             _oisSensitivityMargin.entrySet())
  1429.         {
  1430.             double oisSensitivityMargin = oisSensitivityMarginEntry.getValue();

  1431.             java.lang.String oisTenor = oisSensitivityMarginEntry.getKey();

  1432.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  1433.                 _municipalSensitivityMargin.entrySet())
  1434.             {
  1435.                 java.lang.String municipalTenor = municipalSensitivityMarginEntry.getKey();

  1436.                 double crossTenorCorrelation = oisTenor.equalsIgnoreCase (municipalTenor) ? 1. :
  1437.                     tenorCorrelation.entry (
  1438.                         oisTenor,
  1439.                         municipalTenor
  1440.                     );

  1441.                 curvatureMarginCovariance_OIS_MUNICIPAL = curvatureMarginCovariance_OIS_MUNICIPAL +
  1442.                     oisSensitivityMargin * municipalSensitivityMarginEntry.getValue() * crossTenorCorrelation
  1443.                         * crossTenorCorrelation;
  1444.             }
  1445.         }

  1446.         return curvatureMarginCovariance_OIS_MUNICIPAL * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1447.     }

  1448.     /**
  1449.      * Compute the Linear LIBOR1M-LIBOR3M Sensitivity Margin Co-variance
  1450.      *
  1451.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1452.      *
  1453.      * @return The Linear LIBOR1M-LIBOR3M Sensitivity Margin Co-variance
  1454.      *
  1455.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1456.      */

  1457.     public double linearMarginCovariance_LIBOR1M_LIBOR3M (
  1458.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1459.         throws java.lang.Exception
  1460.     {
  1461.         if (null == bucketSensitivitySettingsIR)
  1462.         {
  1463.             throw new java.lang.Exception
  1464.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR1M_LIBOR3M => Invalid Inputs");
  1465.         }

  1466.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1467.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1468.         double linearMarginCovariance_LIBOR1M_LIBOR3M = 0.;

  1469.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  1470.             _libor1MSensitivityMargin.entrySet())
  1471.         {
  1472.             double libor1MSensitivityMargin = libor1MSensitivityMarginEntry.getValue();

  1473.             java.lang.String libor1MTenor = libor1MSensitivityMarginEntry.getKey();

  1474.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  1475.                 _libor3MSensitivityMargin.entrySet())
  1476.             {
  1477.                 java.lang.String libor3MTenor = libor3MSensitivityMarginEntry.getKey();

  1478.                 linearMarginCovariance_LIBOR1M_LIBOR3M = linearMarginCovariance_LIBOR1M_LIBOR3M +
  1479.                     libor1MSensitivityMargin * libor3MSensitivityMarginEntry.getValue() * (
  1480.                         libor1MTenor.equalsIgnoreCase (libor3MTenor) ? 1. : tenorCorrelation.entry (
  1481.                             libor1MTenor,
  1482.                             libor3MTenor
  1483.                         )
  1484.                     );
  1485.             }
  1486.         }

  1487.         return linearMarginCovariance_LIBOR1M_LIBOR3M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1488.     }

  1489.     /**
  1490.      * Compute the Curvature LIBOR1M-LIBOR3M Sensitivity Margin Co-variance
  1491.      *
  1492.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1493.      *
  1494.      * @return The Curvature LIBOR1M-LIBOR3M Sensitivity Margin Co-variance
  1495.      *
  1496.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1497.      */

  1498.     public double curvatureMarginCovariance_LIBOR1M_LIBOR3M (
  1499.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1500.         throws java.lang.Exception
  1501.     {
  1502.         if (null == bucketSensitivitySettingsIR)
  1503.         {
  1504.             throw new java.lang.Exception
  1505.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR1M_LIBOR3M => Invalid Inputs");
  1506.         }

  1507.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1508.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1509.         double curvatureMarginCovariance_LIBOR1M_LIBOR3M = 0.;

  1510.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  1511.             _libor1MSensitivityMargin.entrySet())
  1512.         {
  1513.             double libor1MSensitivityMargin = libor1MSensitivityMarginEntry.getValue();

  1514.             java.lang.String libor1MTenor = libor1MSensitivityMarginEntry.getKey();

  1515.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  1516.                 _libor3MSensitivityMargin.entrySet())
  1517.             {
  1518.                 java.lang.String libor3MTenor = libor3MSensitivityMarginEntry.getKey();

  1519.                 double crossTenorCorrelation = libor1MTenor.equalsIgnoreCase (libor3MTenor) ? 1. :
  1520.                     tenorCorrelation.entry (
  1521.                         libor1MTenor,
  1522.                         libor3MTenor
  1523.                     );

  1524.                 curvatureMarginCovariance_LIBOR1M_LIBOR3M = curvatureMarginCovariance_LIBOR1M_LIBOR3M +
  1525.                     libor1MSensitivityMargin * libor3MSensitivityMarginEntry.getValue() *
  1526.                         crossTenorCorrelation * crossTenorCorrelation;
  1527.             }
  1528.         }

  1529.         return curvatureMarginCovariance_LIBOR1M_LIBOR3M *
  1530.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  1531.     }

  1532.     /**
  1533.      * Compute the Linear LIBOR1M-LIBOR6M Sensitivity Margin Co-variance
  1534.      *
  1535.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1536.      *
  1537.      * @return The Linear LIBOR1M-LIBOR6M Sensitivity Margin Co-variance
  1538.      *
  1539.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1540.      */

  1541.     public double linearMarginCovariance_LIBOR1M_LIBOR6M (
  1542.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1543.         throws java.lang.Exception
  1544.     {
  1545.         if (null == bucketSensitivitySettingsIR)
  1546.         {
  1547.             throw new java.lang.Exception
  1548.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR1M_LIBOR6M => Invalid Inputs");
  1549.         }

  1550.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1551.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1552.         double linearMarginCovariance_LIBOR1M_LIBOR6M = 0.;

  1553.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  1554.             _libor1MSensitivityMargin.entrySet())
  1555.         {
  1556.             double libor1MSensitivityMargin = libor1MSensitivityMarginEntry.getValue();

  1557.             java.lang.String libor1MTenor = libor1MSensitivityMarginEntry.getKey();

  1558.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  1559.                 _libor6MSensitivityMargin.entrySet())
  1560.             {
  1561.                 java.lang.String libor6MTenor = libor6MSensitivityMarginEntry.getKey();

  1562.                 linearMarginCovariance_LIBOR1M_LIBOR6M = linearMarginCovariance_LIBOR1M_LIBOR6M +
  1563.                     libor1MSensitivityMargin * libor6MSensitivityMarginEntry.getValue() * (
  1564.                         libor1MTenor.equalsIgnoreCase (libor6MTenor) ? 1. : tenorCorrelation.entry (
  1565.                             libor1MTenor,
  1566.                             libor6MTenor
  1567.                         )
  1568.                     );
  1569.             }
  1570.         }

  1571.         return linearMarginCovariance_LIBOR1M_LIBOR6M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1572.     }

  1573.     /**
  1574.      * Compute the Curvature LIBOR1M-LIBOR6M Sensitivity Margin Co-variance
  1575.      *
  1576.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1577.      *
  1578.      * @return The Curvature LIBOR1M-LIBOR6M Sensitivity Margin Co-variance
  1579.      *
  1580.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1581.      */

  1582.     public double curvatureMarginCovariance_LIBOR1M_LIBOR6M (
  1583.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1584.         throws java.lang.Exception
  1585.     {
  1586.         if (null == bucketSensitivitySettingsIR)
  1587.         {
  1588.             throw new java.lang.Exception
  1589.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR1M_LIBOR6M => Invalid Inputs");
  1590.         }

  1591.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1592.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1593.         double curvatureMarginCovariance_LIBOR1M_LIBOR6M = 0.;

  1594.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  1595.             _libor1MSensitivityMargin.entrySet())
  1596.         {
  1597.             double libor1MSensitivityMargin = libor1MSensitivityMarginEntry.getValue();

  1598.             java.lang.String libor1MTenor = libor1MSensitivityMarginEntry.getKey();

  1599.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  1600.                 _libor6MSensitivityMargin.entrySet())
  1601.             {
  1602.                 java.lang.String libor6MTenor = libor6MSensitivityMarginEntry.getKey();

  1603.                 double crossTenorCorrelation = libor1MTenor.equalsIgnoreCase (libor6MTenor) ? 1. :
  1604.                     tenorCorrelation.entry (
  1605.                         libor1MTenor,
  1606.                         libor6MTenor
  1607.                     );

  1608.                 curvatureMarginCovariance_LIBOR1M_LIBOR6M = curvatureMarginCovariance_LIBOR1M_LIBOR6M +
  1609.                     libor1MSensitivityMargin * libor6MSensitivityMarginEntry.getValue() *
  1610.                         crossTenorCorrelation * crossTenorCorrelation;
  1611.             }
  1612.         }

  1613.         return curvatureMarginCovariance_LIBOR1M_LIBOR6M *
  1614.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  1615.     }

  1616.     /**
  1617.      * Compute the Linear LIBOR1M-LIBOR12M Sensitivity Margin Co-variance
  1618.      *
  1619.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1620.      *
  1621.      * @return The Linear LIBOR1M-LIBOR12M Sensitivity Margin Co-variance
  1622.      *
  1623.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1624.      */

  1625.     public double linearMarginCovariance_LIBOR1M_LIBOR12M (
  1626.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1627.         throws java.lang.Exception
  1628.     {
  1629.         if (null == bucketSensitivitySettingsIR)
  1630.         {
  1631.             throw new java.lang.Exception
  1632.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR1M_LIBOR12M => Invalid Inputs");
  1633.         }

  1634.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1635.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1636.         double linearMarginCovariance_LIBOR1M_LIBOR12M = 0.;

  1637.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  1638.             _libor1MSensitivityMargin.entrySet())
  1639.         {
  1640.             double libor1MSensitivityMargin = libor1MSensitivityMarginEntry.getValue();

  1641.             java.lang.String libor1MTenor = libor1MSensitivityMarginEntry.getKey();

  1642.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  1643.                 _libor12MSensitivityMargin.entrySet())
  1644.             {
  1645.                 java.lang.String libor12MTenor = libor12MSensitivityMarginEntry.getKey();

  1646.                 linearMarginCovariance_LIBOR1M_LIBOR12M = linearMarginCovariance_LIBOR1M_LIBOR12M +
  1647.                     libor1MSensitivityMargin * libor12MSensitivityMarginEntry.getValue() * (
  1648.                         libor1MTenor.equalsIgnoreCase (libor12MTenor) ? 1. : tenorCorrelation.entry (
  1649.                             libor1MTenor,
  1650.                             libor12MTenor
  1651.                         )
  1652.                     );
  1653.             }
  1654.         }

  1655.         return linearMarginCovariance_LIBOR1M_LIBOR12M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1656.     }

  1657.     /**
  1658.      * Compute the Curvature LIBOR1M-LIBOR12M Sensitivity Margin Co-variance
  1659.      *
  1660.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1661.      *
  1662.      * @return The Curvature LIBOR1M-LIBOR12M Sensitivity Margin Co-variance
  1663.      *
  1664.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1665.      */

  1666.     public double curvatureMarginCovariance_LIBOR1M_LIBOR12M (
  1667.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1668.         throws java.lang.Exception
  1669.     {
  1670.         if (null == bucketSensitivitySettingsIR)
  1671.         {
  1672.             throw new java.lang.Exception
  1673.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR1M_LIBOR12M => Invalid Inputs");
  1674.         }

  1675.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1676.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1677.         double curvatureMarginCovariance_LIBOR1M_LIBOR12M = 0.;

  1678.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  1679.             _libor1MSensitivityMargin.entrySet())
  1680.         {
  1681.             double libor1MSensitivityMargin = libor1MSensitivityMarginEntry.getValue();

  1682.             java.lang.String libor1MTenor = libor1MSensitivityMarginEntry.getKey();

  1683.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  1684.                 _libor12MSensitivityMargin.entrySet())
  1685.             {
  1686.                 java.lang.String libor12MTenor = libor12MSensitivityMarginEntry.getKey();

  1687.                 double crossTenorCorrelation = libor1MTenor.equalsIgnoreCase (libor12MTenor) ? 1. :
  1688.                     tenorCorrelation.entry (
  1689.                         libor1MTenor,
  1690.                         libor12MTenor
  1691.                     );

  1692.                 curvatureMarginCovariance_LIBOR1M_LIBOR12M = curvatureMarginCovariance_LIBOR1M_LIBOR12M +
  1693.                     libor1MSensitivityMargin * libor12MSensitivityMarginEntry.getValue() *
  1694.                         crossTenorCorrelation * crossTenorCorrelation;
  1695.             }
  1696.         }

  1697.         return curvatureMarginCovariance_LIBOR1M_LIBOR12M *
  1698.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  1699.     }

  1700.     /**
  1701.      * Compute the Linear LIBOR1M-PRIME Sensitivity Margin Co-variance
  1702.      *
  1703.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1704.      *
  1705.      * @return The Linear LIBOR1M-PRIME Sensitivity Margin Co-variance
  1706.      *
  1707.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1708.      */

  1709.     public double linearMarginCovariance_LIBOR1M_PRIME (
  1710.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1711.         throws java.lang.Exception
  1712.     {
  1713.         if (null == bucketSensitivitySettingsIR)
  1714.         {
  1715.             throw new java.lang.Exception
  1716.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR1M_PRIME => Invalid Inputs");
  1717.         }

  1718.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1719.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1720.         double linearMarginCovariance_LIBOR1M_PRIME = 0.;

  1721.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  1722.             _libor1MSensitivityMargin.entrySet())
  1723.         {
  1724.             double libor1MSensitivityMargin = libor1MSensitivityMarginEntry.getValue();

  1725.             java.lang.String libor1MTenor = libor1MSensitivityMarginEntry.getKey();

  1726.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  1727.                 _primeSensitivityMargin.entrySet())
  1728.             {
  1729.                 java.lang.String primeTenor = primeSensitivityMarginEntry.getKey();

  1730.                 linearMarginCovariance_LIBOR1M_PRIME = linearMarginCovariance_LIBOR1M_PRIME +
  1731.                     libor1MSensitivityMargin * primeSensitivityMarginEntry.getValue() * (
  1732.                         libor1MTenor.equalsIgnoreCase (primeTenor) ? 1. : tenorCorrelation.entry (
  1733.                             libor1MTenor,
  1734.                             primeTenor
  1735.                         )
  1736.                     );
  1737.             }
  1738.         }

  1739.         return linearMarginCovariance_LIBOR1M_PRIME * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1740.     }

  1741.     /**
  1742.      * Compute the Curvature LIBOR1M-PRIME Sensitivity Margin Co-variance
  1743.      *
  1744.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1745.      *
  1746.      * @return The Curvature LIBOR1M-PRIME Sensitivity Margin Co-variance
  1747.      *
  1748.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1749.      */

  1750.     public double curvatureMarginCovariance_LIBOR1M_PRIME (
  1751.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1752.         throws java.lang.Exception
  1753.     {
  1754.         if (null == bucketSensitivitySettingsIR)
  1755.         {
  1756.             throw new java.lang.Exception
  1757.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR1M_PRIME => Invalid Inputs");
  1758.         }

  1759.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1760.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1761.         double curvatureMarginCovariance_LIBOR1M_PRIME = 0.;

  1762.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  1763.             _libor1MSensitivityMargin.entrySet())
  1764.         {
  1765.             double libor1MSensitivityMargin = libor1MSensitivityMarginEntry.getValue();

  1766.             java.lang.String libor1MTenor = libor1MSensitivityMarginEntry.getKey();

  1767.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  1768.                 _primeSensitivityMargin.entrySet())
  1769.             {
  1770.                 java.lang.String primeTenor = primeSensitivityMarginEntry.getKey();

  1771.                 double crossTenorCorrelation = libor1MTenor.equalsIgnoreCase (primeTenor) ? 1. :
  1772.                     tenorCorrelation.entry (
  1773.                         libor1MTenor,
  1774.                         primeTenor
  1775.                     );

  1776.                 curvatureMarginCovariance_LIBOR1M_PRIME = curvatureMarginCovariance_LIBOR1M_PRIME +
  1777.                     libor1MSensitivityMargin * primeSensitivityMarginEntry.getValue() * crossTenorCorrelation
  1778.                         * crossTenorCorrelation;
  1779.             }
  1780.         }

  1781.         return curvatureMarginCovariance_LIBOR1M_PRIME * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1782.     }

  1783.     /**
  1784.      * Compute the Linear LIBOR1M-MUNICIPAL Sensitivity Margin Co-variance
  1785.      *
  1786.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1787.      *
  1788.      * @return The Linear LIBOR1M-MUNICIPAL Sensitivity Margin Co-variance
  1789.      *
  1790.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1791.      */

  1792.     public double linearMarginCovariance_LIBOR1M_MUNICIPAL (
  1793.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1794.         throws java.lang.Exception
  1795.     {
  1796.         if (null == bucketSensitivitySettingsIR)
  1797.         {
  1798.             throw new java.lang.Exception
  1799.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR1M_MUNICIPAL => Invalid Inputs");
  1800.         }

  1801.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1802.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1803.         double linearMarginCovariance_LIBOR1M_MUNICIPAL = 0.;

  1804.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  1805.             _libor1MSensitivityMargin.entrySet())
  1806.         {
  1807.             double libor1MSensitivityMargin = libor1MSensitivityMarginEntry.getValue();

  1808.             java.lang.String libor1MTenor = libor1MSensitivityMarginEntry.getKey();

  1809.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  1810.                 _municipalSensitivityMargin.entrySet())
  1811.             {
  1812.                 java.lang.String municipalTenor = municipalSensitivityMarginEntry.getKey();

  1813.                 linearMarginCovariance_LIBOR1M_MUNICIPAL = linearMarginCovariance_LIBOR1M_MUNICIPAL +
  1814.                     libor1MSensitivityMargin * municipalSensitivityMarginEntry.getValue() * (
  1815.                         libor1MTenor.equalsIgnoreCase (municipalTenor) ? 1. : tenorCorrelation.entry (
  1816.                             libor1MTenor,
  1817.                             municipalTenor
  1818.                         )
  1819.                     );
  1820.             }
  1821.         }

  1822.         return linearMarginCovariance_LIBOR1M_MUNICIPAL *
  1823.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  1824.     }

  1825.     /**
  1826.      * Compute the Curvature LIBOR1M-MUNICIPAL Sensitivity Margin Co-variance
  1827.      *
  1828.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1829.      *
  1830.      * @return The Curvature LIBOR1M-MUNICIPAL Sensitivity Margin Co-variance
  1831.      *
  1832.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1833.      */

  1834.     public double curvatureMarginCovariance_LIBOR1M_MUNICIPAL (
  1835.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1836.         throws java.lang.Exception
  1837.     {
  1838.         if (null == bucketSensitivitySettingsIR)
  1839.         {
  1840.             throw new java.lang.Exception
  1841.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR1M_MUNICIPAL => Invalid Inputs");
  1842.         }

  1843.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1844.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1845.         double curvatureMarginCovariance_LIBOR1M_MUNICIPAL = 0.;

  1846.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor1MSensitivityMarginEntry :
  1847.             _libor1MSensitivityMargin.entrySet())
  1848.         {
  1849.             double libor1MSensitivityMargin = libor1MSensitivityMarginEntry.getValue();

  1850.             java.lang.String libor1MTenor = libor1MSensitivityMarginEntry.getKey();

  1851.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  1852.                 _municipalSensitivityMargin.entrySet())
  1853.             {
  1854.                 java.lang.String municipalTenor = municipalSensitivityMarginEntry.getKey();

  1855.                 double crossTenorCorrelation = libor1MTenor.equalsIgnoreCase (municipalTenor) ? 1. :
  1856.                     tenorCorrelation.entry (
  1857.                         libor1MTenor,
  1858.                         municipalTenor
  1859.                     );

  1860.                 curvatureMarginCovariance_LIBOR1M_MUNICIPAL = curvatureMarginCovariance_LIBOR1M_MUNICIPAL +
  1861.                     libor1MSensitivityMargin * municipalSensitivityMarginEntry.getValue() *
  1862.                         crossTenorCorrelation * crossTenorCorrelation;
  1863.             }
  1864.         }

  1865.         return curvatureMarginCovariance_LIBOR1M_MUNICIPAL *
  1866.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  1867.     }

  1868.     /**
  1869.      * Compute the Linear LIBOR3M-LIBOR6M Sensitivity Margin Co-variance
  1870.      *
  1871.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1872.      *
  1873.      * @return The Linear LIBOR3M-LIBOR6M Sensitivity Margin Co-variance
  1874.      *
  1875.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1876.      */

  1877.     public double linearMarginCovariance_LIBOR3M_LIBOR6M (
  1878.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1879.         throws java.lang.Exception
  1880.     {
  1881.         if (null == bucketSensitivitySettingsIR)
  1882.         {
  1883.             throw new java.lang.Exception
  1884.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR3M_LIBOR6M => Invalid Inputs");
  1885.         }

  1886.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1887.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1888.         double linearMarginCovariance_LIBOR3M_LIBOR6M = 0.;

  1889.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  1890.             _libor3MSensitivityMargin.entrySet())
  1891.         {
  1892.             double libor3MSensitivityMargin = libor3MSensitivityMarginEntry.getValue();

  1893.             java.lang.String libor3MTenor = libor3MSensitivityMarginEntry.getKey();

  1894.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  1895.                 _libor6MSensitivityMargin.entrySet())
  1896.             {
  1897.                 java.lang.String libor6MTenor = libor6MSensitivityMarginEntry.getKey();

  1898.                 linearMarginCovariance_LIBOR3M_LIBOR6M = linearMarginCovariance_LIBOR3M_LIBOR6M +
  1899.                     libor3MSensitivityMargin * libor6MSensitivityMarginEntry.getValue() * (
  1900.                         libor3MTenor.equalsIgnoreCase (libor6MTenor) ? 1. : tenorCorrelation.entry (
  1901.                             libor3MTenor,
  1902.                             libor6MTenor
  1903.                         )
  1904.                     );
  1905.             }
  1906.         }

  1907.         return linearMarginCovariance_LIBOR3M_LIBOR6M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1908.     }

  1909.     /**
  1910.      * Compute the Curvature LIBOR3M-LIBOR6M Sensitivity Margin Co-variance
  1911.      *
  1912.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1913.      *
  1914.      * @return The Curvature LIBOR3M-LIBOR6M Sensitivity Margin Co-variance
  1915.      *
  1916.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1917.      */

  1918.     public double curvatureMarginCovariance_LIBOR3M_LIBOR6M (
  1919.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1920.         throws java.lang.Exception
  1921.     {
  1922.         if (null == bucketSensitivitySettingsIR)
  1923.         {
  1924.             throw new java.lang.Exception
  1925.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR3M_LIBOR6M => Invalid Inputs");
  1926.         }

  1927.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1928.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1929.         double curvatureMarginCovariance_LIBOR3M_LIBOR6M = 0.;

  1930.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  1931.             _libor3MSensitivityMargin.entrySet())
  1932.         {
  1933.             double libor3MSensitivityMargin = libor3MSensitivityMarginEntry.getValue();

  1934.             java.lang.String libor3MTenor = libor3MSensitivityMarginEntry.getKey();

  1935.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  1936.                 _libor6MSensitivityMargin.entrySet())
  1937.             {
  1938.                 java.lang.String libor6MTenor = libor6MSensitivityMarginEntry.getKey();

  1939.                 double crossTenorCorrelation = libor3MTenor.equalsIgnoreCase (libor6MTenor) ? 1. :
  1940.                     tenorCorrelation.entry (
  1941.                         libor3MTenor,
  1942.                         libor6MTenor
  1943.                     );

  1944.                 curvatureMarginCovariance_LIBOR3M_LIBOR6M = curvatureMarginCovariance_LIBOR3M_LIBOR6M +
  1945.                     libor3MSensitivityMargin * libor6MSensitivityMarginEntry.getValue() *
  1946.                         crossTenorCorrelation * crossTenorCorrelation;
  1947.             }
  1948.         }

  1949.         return curvatureMarginCovariance_LIBOR3M_LIBOR6M *
  1950.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  1951.     }

  1952.     /**
  1953.      * Compute the Linear LIBOR3M-LIBOR12M Sensitivity Margin Co-variance
  1954.      *
  1955.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1956.      *
  1957.      * @return The Linear LIBOR3M-LIBOR12M Sensitivity Margin Co-variance
  1958.      *
  1959.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  1960.      */

  1961.     public double linearMarginCovariance_LIBOR3M_LIBOR12M (
  1962.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  1963.         throws java.lang.Exception
  1964.     {
  1965.         if (null == bucketSensitivitySettingsIR)
  1966.         {
  1967.             throw new java.lang.Exception
  1968.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR3M_LIBOR12M => Invalid Inputs");
  1969.         }

  1970.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  1971.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  1972.         double linearMarginCovariance_LIBOR3M_LIBOR12M = 0.;

  1973.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  1974.             _libor3MSensitivityMargin.entrySet())
  1975.         {
  1976.             double libor3MSensitivityMargin = libor3MSensitivityMarginEntry.getValue();

  1977.             java.lang.String libor3MTenor = libor3MSensitivityMarginEntry.getKey();

  1978.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  1979.                 _libor12MSensitivityMargin.entrySet())
  1980.             {
  1981.                 java.lang.String libor12MTenor = libor12MSensitivityMarginEntry.getKey();

  1982.                 linearMarginCovariance_LIBOR3M_LIBOR12M = linearMarginCovariance_LIBOR3M_LIBOR12M +
  1983.                     libor3MSensitivityMargin * libor12MSensitivityMarginEntry.getValue() * (
  1984.                         libor3MTenor.equalsIgnoreCase (libor12MTenor) ? 1. : tenorCorrelation.entry (
  1985.                             libor3MTenor,
  1986.                             libor12MTenor
  1987.                         )
  1988.                     );
  1989.             }
  1990.         }

  1991.         return linearMarginCovariance_LIBOR3M_LIBOR12M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  1992.     }

  1993.     /**
  1994.      * Compute the Curvature LIBOR3M-LIBOR12M Sensitivity Margin Co-variance
  1995.      *
  1996.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  1997.      *
  1998.      * @return The Curvature LIBOR3M-LIBOR12M Sensitivity Margin Co-variance
  1999.      *
  2000.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2001.      */

  2002.     public double curvatureMarginCovariance_LIBOR3M_LIBOR12M (
  2003.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2004.         throws java.lang.Exception
  2005.     {
  2006.         if (null == bucketSensitivitySettingsIR)
  2007.         {
  2008.             throw new java.lang.Exception
  2009.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR3M_LIBOR12M => Invalid Inputs");
  2010.         }

  2011.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2012.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2013.         double curvatureMarginCovariance_LIBOR3M_LIBOR12M = 0.;

  2014.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  2015.             _libor3MSensitivityMargin.entrySet())
  2016.         {
  2017.             double libor3MSensitivityMargin = libor3MSensitivityMarginEntry.getValue();

  2018.             java.lang.String libor3MTenor = libor3MSensitivityMarginEntry.getKey();

  2019.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  2020.                 _libor12MSensitivityMargin.entrySet())
  2021.             {
  2022.                 java.lang.String libor12MTenor = libor12MSensitivityMarginEntry.getKey();

  2023.                 double crossTenorCorrelation = libor3MTenor.equalsIgnoreCase (libor12MTenor) ? 1. :
  2024.                     tenorCorrelation.entry (
  2025.                         libor3MTenor,
  2026.                         libor12MTenor
  2027.                     );

  2028.                 curvatureMarginCovariance_LIBOR3M_LIBOR12M = curvatureMarginCovariance_LIBOR3M_LIBOR12M +
  2029.                     libor3MSensitivityMargin * libor12MSensitivityMarginEntry.getValue() *
  2030.                         crossTenorCorrelation * crossTenorCorrelation;
  2031.             }
  2032.         }

  2033.         return curvatureMarginCovariance_LIBOR3M_LIBOR12M *
  2034.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  2035.     }

  2036.     /**
  2037.      * Compute the Linear LIBOR3M-PRIME Sensitivity Margin Co-variance
  2038.      *
  2039.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2040.      *
  2041.      * @return The Linear LIBOR3M-PRIME Sensitivity Margin Co-variance
  2042.      *
  2043.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2044.      */

  2045.     public double linearMarginCovariance_LIBOR3M_PRIME (
  2046.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2047.         throws java.lang.Exception
  2048.     {
  2049.         if (null == bucketSensitivitySettingsIR)
  2050.         {
  2051.             throw new java.lang.Exception
  2052.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR3M_PRIME => Invalid Inputs");
  2053.         }

  2054.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2055.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2056.         double linearMarginCovariance_LIBOR3M_PRIME = 0.;

  2057.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  2058.             _libor3MSensitivityMargin.entrySet())
  2059.         {
  2060.             double libor3MSensitivityMargin = libor3MSensitivityMarginEntry.getValue();

  2061.             java.lang.String libor3MTenor = libor3MSensitivityMarginEntry.getKey();

  2062.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  2063.                 _primeSensitivityMargin.entrySet())
  2064.             {
  2065.                 java.lang.String primeTenor = primeSensitivityMarginEntry.getKey();

  2066.                 linearMarginCovariance_LIBOR3M_PRIME = linearMarginCovariance_LIBOR3M_PRIME +
  2067.                     libor3MSensitivityMargin * primeSensitivityMarginEntry.getValue() * (
  2068.                         libor3MTenor.equalsIgnoreCase (primeTenor) ? 1. : tenorCorrelation.entry (
  2069.                             libor3MTenor,
  2070.                             primeTenor
  2071.                         )
  2072.                     );
  2073.             }
  2074.         }

  2075.         return linearMarginCovariance_LIBOR3M_PRIME * bucketSensitivitySettingsIR.crossCurveCorrelation();
  2076.     }

  2077.     /**
  2078.      * Compute the Curvature LIBOR3M-PRIME Sensitivity Margin Co-variance
  2079.      *
  2080.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2081.      *
  2082.      * @return The Curvature LIBOR3M-PRIME Sensitivity Margin Co-variance
  2083.      *
  2084.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2085.      */

  2086.     public double curvatureMarginCovariance_LIBOR3M_PRIME (
  2087.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2088.         throws java.lang.Exception
  2089.     {
  2090.         if (null == bucketSensitivitySettingsIR)
  2091.         {
  2092.             throw new java.lang.Exception
  2093.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR3M_PRIME => Invalid Inputs");
  2094.         }

  2095.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2096.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2097.         double curvatureMarginCovariance_LIBOR3M_PRIME = 0.;

  2098.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  2099.             _libor3MSensitivityMargin.entrySet())
  2100.         {
  2101.             double libor3MSensitivityMargin = libor3MSensitivityMarginEntry.getValue();

  2102.             java.lang.String libor3MTenor = libor3MSensitivityMarginEntry.getKey();

  2103.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  2104.                 _primeSensitivityMargin.entrySet())
  2105.             {
  2106.                 java.lang.String primeTenor = primeSensitivityMarginEntry.getKey();

  2107.                 double crossTenorCorrelation = libor3MTenor.equalsIgnoreCase (primeTenor) ? 1. :
  2108.                     tenorCorrelation.entry (
  2109.                         libor3MTenor,
  2110.                         primeTenor
  2111.                     );

  2112.                 curvatureMarginCovariance_LIBOR3M_PRIME = curvatureMarginCovariance_LIBOR3M_PRIME +
  2113.                     libor3MSensitivityMargin * primeSensitivityMarginEntry.getValue() * crossTenorCorrelation
  2114.                         * crossTenorCorrelation;
  2115.             }
  2116.         }

  2117.         return curvatureMarginCovariance_LIBOR3M_PRIME * bucketSensitivitySettingsIR.crossCurveCorrelation();
  2118.     }

  2119.     /**
  2120.      * Compute the Linear LIBOR3M-MUNICIPAL Sensitivity Margin Co-variance
  2121.      *
  2122.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2123.      *
  2124.      * @return The Linear LIBOR3M-MUNICIPAL Sensitivity Margin Co-variance
  2125.      *
  2126.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2127.      */

  2128.     public double linearMarginCovariance_LIBOR3M_MUNICIPAL (
  2129.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2130.         throws java.lang.Exception
  2131.     {
  2132.         if (null == bucketSensitivitySettingsIR)
  2133.         {
  2134.             throw new java.lang.Exception
  2135.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR3M_MUNICIPAL => Invalid Inputs");
  2136.         }

  2137.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2138.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2139.         double linearMarginCovariance_LIBOR3M_MUNICIPAL = 0.;

  2140.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  2141.             _libor3MSensitivityMargin.entrySet())
  2142.         {
  2143.             double libor3MSensitivityMargin = libor3MSensitivityMarginEntry.getValue();

  2144.             java.lang.String libor3MTenor = libor3MSensitivityMarginEntry.getKey();

  2145.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  2146.                 _municipalSensitivityMargin.entrySet())
  2147.             {
  2148.                 java.lang.String municipalTenor = municipalSensitivityMarginEntry.getKey();

  2149.                 linearMarginCovariance_LIBOR3M_MUNICIPAL = linearMarginCovariance_LIBOR3M_MUNICIPAL +
  2150.                     libor3MSensitivityMargin * municipalSensitivityMarginEntry.getValue() * (
  2151.                         libor3MTenor.equalsIgnoreCase (municipalTenor) ? 1. : tenorCorrelation.entry (
  2152.                             libor3MTenor,
  2153.                             municipalTenor
  2154.                         )
  2155.                     );
  2156.             }
  2157.         }

  2158.         return linearMarginCovariance_LIBOR3M_MUNICIPAL *
  2159.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  2160.     }

  2161.     /**
  2162.      * Compute the Curvature LIBOR3M-MUNICIPAL Sensitivity Margin Co-variance
  2163.      *
  2164.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2165.      *
  2166.      * @return The Curvature LIBOR3M-MUNICIPAL Sensitivity Margin Co-variance
  2167.      *
  2168.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2169.      */

  2170.     public double curvatureMarginCovariance_LIBOR3M_MUNICIPAL (
  2171.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2172.         throws java.lang.Exception
  2173.     {
  2174.         if (null == bucketSensitivitySettingsIR)
  2175.         {
  2176.             throw new java.lang.Exception
  2177.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR3M_MUNICIPAL => Invalid Inputs");
  2178.         }

  2179.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2180.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2181.         double curvatureMarginCovariance_LIBOR3M_MUNICIPAL = 0.;

  2182.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor3MSensitivityMarginEntry :
  2183.             _libor3MSensitivityMargin.entrySet())
  2184.         {
  2185.             double libor3MSensitivityMargin = libor3MSensitivityMarginEntry.getValue();

  2186.             java.lang.String libor3MTenor = libor3MSensitivityMarginEntry.getKey();

  2187.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  2188.                 _municipalSensitivityMargin.entrySet())
  2189.             {
  2190.                 java.lang.String municipalTenor = municipalSensitivityMarginEntry.getKey();

  2191.                 double crossTenorCorrelation = libor3MTenor.equalsIgnoreCase (municipalTenor) ? 1. :
  2192.                     tenorCorrelation.entry (
  2193.                         libor3MTenor,
  2194.                         municipalTenor
  2195.                     );

  2196.                 curvatureMarginCovariance_LIBOR3M_MUNICIPAL = curvatureMarginCovariance_LIBOR3M_MUNICIPAL +
  2197.                     libor3MSensitivityMargin * municipalSensitivityMarginEntry.getValue() *
  2198.                         crossTenorCorrelation * crossTenorCorrelation;
  2199.             }
  2200.         }

  2201.         return curvatureMarginCovariance_LIBOR3M_MUNICIPAL *
  2202.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  2203.     }

  2204.     /**
  2205.      * Compute the Linear LIBOR6M-LIBOR12M Sensitivity Margin Co-variance
  2206.      *
  2207.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2208.      *
  2209.      * @return The Linear LIBOR6M-LIBOR12M Sensitivity Margin Co-variance
  2210.      *
  2211.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2212.      */

  2213.     public double linearMarginCovariance_LIBOR6M_LIBOR12M (
  2214.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2215.         throws java.lang.Exception
  2216.     {
  2217.         if (null == bucketSensitivitySettingsIR)
  2218.         {
  2219.             throw new java.lang.Exception
  2220.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR6M_LIBOR12M => Invalid Inputs");
  2221.         }

  2222.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2223.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2224.         double linearMarginCovariance_LIBOR6M_LIBOR12M = 0.;

  2225.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  2226.             _libor6MSensitivityMargin.entrySet())
  2227.         {
  2228.             double libor6MSensitivityMargin = libor6MSensitivityMarginEntry.getValue();

  2229.             java.lang.String libor6MTenor = libor6MSensitivityMarginEntry.getKey();

  2230.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  2231.                 _libor12MSensitivityMargin.entrySet())
  2232.             {
  2233.                 java.lang.String libor12MTenor = libor12MSensitivityMarginEntry.getKey();

  2234.                 linearMarginCovariance_LIBOR6M_LIBOR12M = linearMarginCovariance_LIBOR6M_LIBOR12M +
  2235.                     libor6MSensitivityMargin * libor12MSensitivityMarginEntry.getValue() * (
  2236.                         libor6MTenor.equalsIgnoreCase (libor12MTenor) ? 1. : tenorCorrelation.entry (
  2237.                             libor6MTenor,
  2238.                             libor12MTenor
  2239.                         )
  2240.                     );
  2241.             }
  2242.         }

  2243.         return linearMarginCovariance_LIBOR6M_LIBOR12M * bucketSensitivitySettingsIR.crossCurveCorrelation();
  2244.     }

  2245.     /**
  2246.      * Compute the Curvature LIBOR6M-LIBOR12M Sensitivity Margin Co-variance
  2247.      *
  2248.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2249.      *
  2250.      * @return The Curvature LIBOR6M-LIBOR12M Sensitivity Margin Co-variance
  2251.      *
  2252.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2253.      */

  2254.     public double curvatureMarginCovariance_LIBOR6M_LIBOR12M (
  2255.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2256.         throws java.lang.Exception
  2257.     {
  2258.         if (null == bucketSensitivitySettingsIR)
  2259.         {
  2260.             throw new java.lang.Exception
  2261.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR6M_LIBOR12M => Invalid Inputs");
  2262.         }

  2263.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2264.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2265.         double curvatureMarginCovariance_LIBOR6M_LIBOR12M = 0.;

  2266.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  2267.             _libor6MSensitivityMargin.entrySet())
  2268.         {
  2269.             double libor6MSensitivityMargin = libor6MSensitivityMarginEntry.getValue();

  2270.             java.lang.String libor6MTenor = libor6MSensitivityMarginEntry.getKey();

  2271.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  2272.                 _libor12MSensitivityMargin.entrySet())
  2273.             {
  2274.                 java.lang.String libor12MTenor = libor12MSensitivityMarginEntry.getKey();

  2275.                 double crossTenorCorrelation = libor6MTenor.equalsIgnoreCase (libor12MTenor) ? 1. :
  2276.                     tenorCorrelation.entry (
  2277.                         libor6MTenor,
  2278.                         libor12MTenor
  2279.                     );

  2280.                 curvatureMarginCovariance_LIBOR6M_LIBOR12M = curvatureMarginCovariance_LIBOR6M_LIBOR12M +
  2281.                     libor6MSensitivityMargin * libor12MSensitivityMarginEntry.getValue() *
  2282.                         crossTenorCorrelation * crossTenorCorrelation;
  2283.             }
  2284.         }

  2285.         return curvatureMarginCovariance_LIBOR6M_LIBOR12M *
  2286.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  2287.     }

  2288.     /**
  2289.      * Compute the Linear LIBOR6M-PRIME Sensitivity Margin Co-variance
  2290.      *
  2291.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2292.      *
  2293.      * @return The Linear LIBOR6M-PRIME Sensitivity Margin Co-variance
  2294.      *
  2295.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2296.      */

  2297.     public double linearMarginCovariance_LIBOR6M_PRIME (
  2298.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2299.         throws java.lang.Exception
  2300.     {
  2301.         if (null == bucketSensitivitySettingsIR)
  2302.         {
  2303.             throw new java.lang.Exception
  2304.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR6M_PRIME => Invalid Inputs");
  2305.         }

  2306.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2307.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2308.         double linearMarginCovariance_LIBOR6M_PRIME = 0.;

  2309.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  2310.             _libor6MSensitivityMargin.entrySet())
  2311.         {
  2312.             double libor6MSensitivityMargin = libor6MSensitivityMarginEntry.getValue();

  2313.             java.lang.String libor6MTenor = libor6MSensitivityMarginEntry.getKey();

  2314.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  2315.                 _primeSensitivityMargin.entrySet())
  2316.             {
  2317.                 java.lang.String primeTenor = primeSensitivityMarginEntry.getKey();

  2318.                 linearMarginCovariance_LIBOR6M_PRIME = linearMarginCovariance_LIBOR6M_PRIME +
  2319.                     libor6MSensitivityMargin * primeSensitivityMarginEntry.getValue() * (
  2320.                         libor6MTenor.equalsIgnoreCase (primeTenor) ? 1. : tenorCorrelation.entry (
  2321.                             libor6MTenor,
  2322.                             primeTenor
  2323.                         )
  2324.                     );
  2325.             }
  2326.         }

  2327.         return linearMarginCovariance_LIBOR6M_PRIME * bucketSensitivitySettingsIR.crossCurveCorrelation();
  2328.     }

  2329.     /**
  2330.      * Compute the Curvature LIBOR6M-PRIME Sensitivity Margin Co-variance
  2331.      *
  2332.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2333.      *
  2334.      * @return The Curvature LIBOR6M-PRIME Sensitivity Margin Co-variance
  2335.      *
  2336.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2337.      */

  2338.     public double curvatureMarginCovariance_LIBOR6M_PRIME (
  2339.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2340.         throws java.lang.Exception
  2341.     {
  2342.         if (null == bucketSensitivitySettingsIR)
  2343.         {
  2344.             throw new java.lang.Exception
  2345.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR6M_PRIME => Invalid Inputs");
  2346.         }

  2347.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2348.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2349.         double curvatureMarginCovariance_LIBOR6M_PRIME = 0.;

  2350.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  2351.             _libor6MSensitivityMargin.entrySet())
  2352.         {
  2353.             double libor6MSensitivityMargin = libor6MSensitivityMarginEntry.getValue();

  2354.             java.lang.String libor6MTenor = libor6MSensitivityMarginEntry.getKey();

  2355.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  2356.                 _primeSensitivityMargin.entrySet())
  2357.             {
  2358.                 java.lang.String primeTenor = primeSensitivityMarginEntry.getKey();

  2359.                 double crossTenorCorrelation = libor6MTenor.equalsIgnoreCase (primeTenor) ? 1. :
  2360.                     tenorCorrelation.entry (
  2361.                         libor6MTenor,
  2362.                         primeTenor
  2363.                     );

  2364.                 curvatureMarginCovariance_LIBOR6M_PRIME = curvatureMarginCovariance_LIBOR6M_PRIME +
  2365.                     libor6MSensitivityMargin * primeSensitivityMarginEntry.getValue() * crossTenorCorrelation
  2366.                         * crossTenorCorrelation;
  2367.             }
  2368.         }

  2369.         return curvatureMarginCovariance_LIBOR6M_PRIME * bucketSensitivitySettingsIR.crossCurveCorrelation();
  2370.     }

  2371.     /**
  2372.      * Compute the Linear LIBOR6M-MUNICIPAL Sensitivity Margin Co-variance
  2373.      *
  2374.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2375.      *
  2376.      * @return The Linear LIBOR6M-MUNICIPAL Sensitivity Margin Co-variance
  2377.      *
  2378.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2379.      */

  2380.     public double linearMarginCovariance_LIBOR6M_MUNICIPAL (
  2381.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2382.         throws java.lang.Exception
  2383.     {
  2384.         if (null == bucketSensitivitySettingsIR)
  2385.         {
  2386.             throw new java.lang.Exception
  2387.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR6M_MUNICIPAL => Invalid Inputs");
  2388.         }

  2389.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2390.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2391.         double linearMarginCovariance_LIBOR6M_MUNICIPAL = 0.;

  2392.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  2393.             _libor6MSensitivityMargin.entrySet())
  2394.         {
  2395.             double libor6MSensitivityMargin = libor6MSensitivityMarginEntry.getValue();

  2396.             java.lang.String libor6MTenor = libor6MSensitivityMarginEntry.getKey();

  2397.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  2398.                 _municipalSensitivityMargin.entrySet())
  2399.             {
  2400.                 java.lang.String municipalTenor = municipalSensitivityMarginEntry.getKey();

  2401.                 linearMarginCovariance_LIBOR6M_MUNICIPAL = linearMarginCovariance_LIBOR6M_MUNICIPAL +
  2402.                     libor6MSensitivityMargin * municipalSensitivityMarginEntry.getValue() * (
  2403.                         libor6MTenor.equalsIgnoreCase (municipalTenor) ? 1. : tenorCorrelation.entry (
  2404.                             libor6MTenor,
  2405.                             municipalTenor
  2406.                         )
  2407.                     );
  2408.             }
  2409.         }

  2410.         return linearMarginCovariance_LIBOR6M_MUNICIPAL *
  2411.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  2412.     }

  2413.     /**
  2414.      * Compute the Curvature LIBOR6M-MUNICIPAL Sensitivity Margin Co-variance
  2415.      *
  2416.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2417.      *
  2418.      * @return The Curvature LIBOR6M-MUNICIPAL Sensitivity Margin Co-variance
  2419.      *
  2420.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2421.      */

  2422.     public double curvatureMarginCovariance_LIBOR6M_MUNICIPAL (
  2423.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2424.         throws java.lang.Exception
  2425.     {
  2426.         if (null == bucketSensitivitySettingsIR)
  2427.         {
  2428.             throw new java.lang.Exception
  2429.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR6M_MUNICIPAL => Invalid Inputs");
  2430.         }

  2431.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2432.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2433.         double curvatureMarginCovariance_LIBOR6M_MUNICIPAL = 0.;

  2434.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor6MSensitivityMarginEntry :
  2435.             _libor6MSensitivityMargin.entrySet())
  2436.         {
  2437.             double libor6MSensitivityMargin = libor6MSensitivityMarginEntry.getValue();

  2438.             java.lang.String libor6MTenor = libor6MSensitivityMarginEntry.getKey();

  2439.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  2440.                 _municipalSensitivityMargin.entrySet())
  2441.             {
  2442.                 java.lang.String municipalTenor = municipalSensitivityMarginEntry.getKey();

  2443.                 double crossTenorCorrelation = libor6MTenor.equalsIgnoreCase (municipalTenor) ? 1. :
  2444.                     tenorCorrelation.entry (
  2445.                         libor6MTenor,
  2446.                         municipalTenor
  2447.                     );

  2448.                 curvatureMarginCovariance_LIBOR6M_MUNICIPAL = curvatureMarginCovariance_LIBOR6M_MUNICIPAL +
  2449.                     libor6MSensitivityMargin * municipalSensitivityMarginEntry.getValue() *
  2450.                         crossTenorCorrelation * crossTenorCorrelation;
  2451.             }
  2452.         }

  2453.         return curvatureMarginCovariance_LIBOR6M_MUNICIPAL *
  2454.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  2455.     }

  2456.     /**
  2457.      * Compute the Linear LIBOR12M-PRIME Sensitivity Margin Co-variance
  2458.      *
  2459.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2460.      *
  2461.      * @return The Linear LIBOR12M-PRIME Sensitivity Margin Co-variance
  2462.      *
  2463.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2464.      */

  2465.     public double linearMarginCovariance_LIBOR12M_PRIME (
  2466.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2467.         throws java.lang.Exception
  2468.     {
  2469.         if (null == bucketSensitivitySettingsIR)
  2470.         {
  2471.             throw new java.lang.Exception
  2472.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR12M_PRIME => Invalid Inputs");
  2473.         }

  2474.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2475.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2476.         double linearMarginCovariance_LIBOR12M_PRIME = 0.;

  2477.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  2478.             _libor12MSensitivityMargin.entrySet())
  2479.         {
  2480.             double libor12MSensitivityMargin = libor12MSensitivityMarginEntry.getValue();

  2481.             java.lang.String libor12MTenor = libor12MSensitivityMarginEntry.getKey();

  2482.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  2483.                 _primeSensitivityMargin.entrySet())
  2484.             {
  2485.                 java.lang.String primeTenor = primeSensitivityMarginEntry.getKey();

  2486.                 linearMarginCovariance_LIBOR12M_PRIME = linearMarginCovariance_LIBOR12M_PRIME +
  2487.                     libor12MSensitivityMargin * primeSensitivityMarginEntry.getValue() * (
  2488.                         libor12MTenor.equalsIgnoreCase (primeTenor) ? 1. : tenorCorrelation.entry (
  2489.                             libor12MTenor,
  2490.                             primeTenor
  2491.                         )
  2492.                     );
  2493.             }
  2494.         }

  2495.         return linearMarginCovariance_LIBOR12M_PRIME * bucketSensitivitySettingsIR.crossCurveCorrelation();
  2496.     }

  2497.     /**
  2498.      * Compute the Curvature LIBOR12M-PRIME Sensitivity Margin Co-variance
  2499.      *
  2500.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2501.      *
  2502.      * @return The Curvature LIBOR12M-PRIME Sensitivity Margin Co-variance
  2503.      *
  2504.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2505.      */

  2506.     public double curvatureMarginCovariance_LIBOR12M_PRIME (
  2507.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2508.         throws java.lang.Exception
  2509.     {
  2510.         if (null == bucketSensitivitySettingsIR)
  2511.         {
  2512.             throw new java.lang.Exception
  2513.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR12M_PRIME => Invalid Inputs");
  2514.         }

  2515.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2516.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2517.         double curvatureMarginCovariance_LIBOR12M_PRIME = 0.;

  2518.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  2519.             _libor12MSensitivityMargin.entrySet())
  2520.         {
  2521.             double libor12MSensitivityMargin = libor12MSensitivityMarginEntry.getValue();

  2522.             java.lang.String libor12MTenor = libor12MSensitivityMarginEntry.getKey();

  2523.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  2524.                 _primeSensitivityMargin.entrySet())
  2525.             {
  2526.                 java.lang.String primeTenor = primeSensitivityMarginEntry.getKey();

  2527.                 double crossTenorCorrelation = libor12MTenor.equalsIgnoreCase (primeTenor) ? 1. :
  2528.                     tenorCorrelation.entry (
  2529.                         libor12MTenor,
  2530.                         primeTenor
  2531.                     );

  2532.                 curvatureMarginCovariance_LIBOR12M_PRIME = curvatureMarginCovariance_LIBOR12M_PRIME +
  2533.                     libor12MSensitivityMargin * primeSensitivityMarginEntry.getValue() *
  2534.                         crossTenorCorrelation * crossTenorCorrelation;
  2535.             }
  2536.         }

  2537.         return curvatureMarginCovariance_LIBOR12M_PRIME *
  2538.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  2539.     }

  2540.     /**
  2541.      * Compute the Linear LIBOR12M-MUNICIPAL Sensitivity Margin Co-variance
  2542.      *
  2543.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2544.      *
  2545.      * @return The Linear LIBOR12M-MUNICIPAL Sensitivity Margin Co-variance
  2546.      *
  2547.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2548.      */

  2549.     public double linearMarginCovariance_LIBOR12M_MUNICIPAL (
  2550.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2551.         throws java.lang.Exception
  2552.     {
  2553.         if (null == bucketSensitivitySettingsIR)
  2554.         {
  2555.             throw new java.lang.Exception
  2556.                 ("IRFactorAggregate::linearMarginCovariance_LIBOR12M_MUNICIPAL => Invalid Inputs");
  2557.         }

  2558.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2559.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2560.         double linearMarginCovariance_LIBOR12M_MUNICIPAL = 0.;

  2561.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  2562.             _libor12MSensitivityMargin.entrySet())
  2563.         {
  2564.             double libor12MSensitivityMargin = libor12MSensitivityMarginEntry.getValue();

  2565.             java.lang.String libor12MTenor = libor12MSensitivityMarginEntry.getKey();

  2566.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  2567.                 _municipalSensitivityMargin.entrySet())
  2568.             {
  2569.                 java.lang.String municipalTenor = municipalSensitivityMarginEntry.getKey();

  2570.                 linearMarginCovariance_LIBOR12M_MUNICIPAL = linearMarginCovariance_LIBOR12M_MUNICIPAL +
  2571.                     libor12MSensitivityMargin * municipalSensitivityMarginEntry.getValue() * (
  2572.                         libor12MTenor.equalsIgnoreCase (municipalTenor) ? 1. : tenorCorrelation.entry (
  2573.                             libor12MTenor,
  2574.                             municipalTenor
  2575.                         )
  2576.                     );
  2577.             }
  2578.         }

  2579.         return linearMarginCovariance_LIBOR12M_MUNICIPAL *
  2580.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  2581.     }

  2582.     /**
  2583.      * Compute the Curvature LIBOR12M-MUNICIPAL Sensitivity Margin Co-variance
  2584.      *
  2585.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2586.      *
  2587.      * @return The Curvature LIBOR12M-MUNICIPAL Sensitivity Margin Co-variance
  2588.      *
  2589.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2590.      */

  2591.     public double curvatureMarginCovariance_LIBOR12M_MUNICIPAL (
  2592.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2593.         throws java.lang.Exception
  2594.     {
  2595.         if (null == bucketSensitivitySettingsIR)
  2596.         {
  2597.             throw new java.lang.Exception
  2598.                 ("IRFactorAggregate::curvatureMarginCovariance_LIBOR12M_MUNICIPAL => Invalid Inputs");
  2599.         }

  2600.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2601.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2602.         double curvatureMarginCovariance_LIBOR12M_MUNICIPAL = 0.;

  2603.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> libor12MSensitivityMarginEntry :
  2604.             _libor12MSensitivityMargin.entrySet())
  2605.         {
  2606.             double libor12MSensitivityMargin = libor12MSensitivityMarginEntry.getValue();

  2607.             java.lang.String libor12MTenor = libor12MSensitivityMarginEntry.getKey();

  2608.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  2609.                 _municipalSensitivityMargin.entrySet())
  2610.             {
  2611.                 java.lang.String municipalTenor = municipalSensitivityMarginEntry.getKey();

  2612.                 double crossTenorCorrelation = libor12MTenor.equalsIgnoreCase (municipalTenor) ? 1. :
  2613.                     tenorCorrelation.entry (
  2614.                         libor12MTenor,
  2615.                         municipalTenor
  2616.                     );

  2617.                 curvatureMarginCovariance_LIBOR12M_MUNICIPAL = curvatureMarginCovariance_LIBOR12M_MUNICIPAL +
  2618.                     libor12MSensitivityMargin * municipalSensitivityMarginEntry.getValue() *
  2619.                         crossTenorCorrelation * crossTenorCorrelation;
  2620.             }
  2621.         }

  2622.         return curvatureMarginCovariance_LIBOR12M_MUNICIPAL *
  2623.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  2624.     }

  2625.     /**
  2626.      * Compute the Linear PRIME-MUNICIPAL Sensitivity Margin Co-variance
  2627.      *
  2628.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2629.      *
  2630.      * @return The Linear PRIME-MUNICIPAL Sensitivity Margin Co-variance
  2631.      *
  2632.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2633.      */

  2634.     public double linearMarginCovariance_PRIME_MUNICIPAL (
  2635.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2636.         throws java.lang.Exception
  2637.     {
  2638.         if (null == bucketSensitivitySettingsIR)
  2639.         {
  2640.             throw new java.lang.Exception
  2641.                 ("IRFactorAggregate::linearMarginCovariance_PRIME_MUNICIPAL => Invalid Inputs");
  2642.         }

  2643.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2644.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2645.         double linearMarginCovariance_PRIME_MUNICIPAL = 0.;

  2646.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  2647.             _primeSensitivityMargin.entrySet())
  2648.         {
  2649.             double primeSensitivityMargin = primeSensitivityMarginEntry.getValue();

  2650.             java.lang.String primeTenor = primeSensitivityMarginEntry.getKey();

  2651.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  2652.                 _municipalSensitivityMargin.entrySet())
  2653.             {
  2654.                 java.lang.String municipalTenor = municipalSensitivityMarginEntry.getKey();

  2655.                 linearMarginCovariance_PRIME_MUNICIPAL = linearMarginCovariance_PRIME_MUNICIPAL +
  2656.                     primeSensitivityMargin * municipalSensitivityMarginEntry.getValue() * (
  2657.                         primeTenor.equalsIgnoreCase (municipalTenor) ? 1. : tenorCorrelation.entry (
  2658.                             primeTenor,
  2659.                             municipalTenor
  2660.                         )
  2661.                     );
  2662.             }
  2663.         }

  2664.         return linearMarginCovariance_PRIME_MUNICIPAL * bucketSensitivitySettingsIR.crossCurveCorrelation();
  2665.     }

  2666.     /**
  2667.      * Compute the Curvature PRIME-MUNICIPAL Sensitivity Margin Co-variance
  2668.      *
  2669.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2670.      *
  2671.      * @return The Curvature PRIME-MUNICIPAL Sensitivity Margin Co-variance
  2672.      *
  2673.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  2674.      */

  2675.     public double curvatureMarginCovariance_PRIME_MUNICIPAL (
  2676.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2677.         throws java.lang.Exception
  2678.     {
  2679.         if (null == bucketSensitivitySettingsIR)
  2680.         {
  2681.             throw new java.lang.Exception
  2682.                 ("IRFactorAggregate::curvatureMarginCovariance_PRIME_MUNICIPAL => Invalid Inputs");
  2683.         }

  2684.         org.drip.measure.stochastic.LabelCorrelation tenorCorrelation =
  2685.             bucketSensitivitySettingsIR.crossTenorCorrelation();

  2686.         double curvatureMarginCovariance_PRIME_MUNICIPAL = 0.;

  2687.         for (java.util.Map.Entry<java.lang.String, java.lang.Double> primeSensitivityMarginEntry :
  2688.             _primeSensitivityMargin.entrySet())
  2689.         {
  2690.             double primeSensitivityMargin = primeSensitivityMarginEntry.getValue();

  2691.             java.lang.String primeTenor = primeSensitivityMarginEntry.getKey();

  2692.             for (java.util.Map.Entry<java.lang.String, java.lang.Double> municipalSensitivityMarginEntry :
  2693.                 _municipalSensitivityMargin.entrySet())
  2694.             {
  2695.                 java.lang.String municipalTenor = municipalSensitivityMarginEntry.getKey();

  2696.                 double crossTenorCorrelation = primeTenor.equalsIgnoreCase (municipalTenor) ? 1. :
  2697.                     tenorCorrelation.entry (
  2698.                         primeTenor,
  2699.                         municipalTenor
  2700.                     );

  2701.                 curvatureMarginCovariance_PRIME_MUNICIPAL = curvatureMarginCovariance_PRIME_MUNICIPAL +
  2702.                     primeSensitivityMargin * municipalSensitivityMarginEntry.getValue() *
  2703.                         crossTenorCorrelation * crossTenorCorrelation;
  2704.             }
  2705.         }

  2706.         return curvatureMarginCovariance_PRIME_MUNICIPAL *
  2707.             bucketSensitivitySettingsIR.crossCurveCorrelation();
  2708.     }

  2709.     /**
  2710.      * Compute the Linear Margin Co-variance
  2711.      *
  2712.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2713.      *
  2714.      * @return The Linear Margin Co-variance
  2715.      */

  2716.     public org.drip.simm.margin.SensitivityAggregateIR linearMargin (
  2717.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2718.     {
  2719.         try
  2720.         {
  2721.             return new org.drip.simm.margin.SensitivityAggregateIR (
  2722.                 linearMarginCovariance_OIS_OIS (bucketSensitivitySettingsIR),
  2723.                 linearMarginCovariance_OIS_LIBOR1M (bucketSensitivitySettingsIR),
  2724.                 linearMarginCovariance_OIS_LIBOR3M (bucketSensitivitySettingsIR),
  2725.                 linearMarginCovariance_OIS_LIBOR6M (bucketSensitivitySettingsIR),
  2726.                 linearMarginCovariance_OIS_LIBOR12M (bucketSensitivitySettingsIR),
  2727.                 linearMarginCovariance_OIS_PRIME (bucketSensitivitySettingsIR),
  2728.                 linearMarginCovariance_OIS_MUNICIPAL (bucketSensitivitySettingsIR),
  2729.                 linearMarginCovariance_LIBOR1M_LIBOR1M (bucketSensitivitySettingsIR),
  2730.                 linearMarginCovariance_LIBOR1M_LIBOR3M (bucketSensitivitySettingsIR),
  2731.                 linearMarginCovariance_LIBOR1M_LIBOR6M (bucketSensitivitySettingsIR),
  2732.                 linearMarginCovariance_LIBOR1M_LIBOR12M (bucketSensitivitySettingsIR),
  2733.                 linearMarginCovariance_LIBOR1M_PRIME (bucketSensitivitySettingsIR),
  2734.                 linearMarginCovariance_LIBOR1M_MUNICIPAL (bucketSensitivitySettingsIR),
  2735.                 linearMarginCovariance_LIBOR3M_LIBOR3M (bucketSensitivitySettingsIR),
  2736.                 linearMarginCovariance_LIBOR3M_LIBOR6M (bucketSensitivitySettingsIR),
  2737.                 linearMarginCovariance_LIBOR3M_LIBOR12M (bucketSensitivitySettingsIR),
  2738.                 linearMarginCovariance_LIBOR3M_PRIME (bucketSensitivitySettingsIR),
  2739.                 linearMarginCovariance_LIBOR3M_MUNICIPAL (bucketSensitivitySettingsIR),
  2740.                 linearMarginCovariance_LIBOR6M_LIBOR6M (bucketSensitivitySettingsIR),
  2741.                 linearMarginCovariance_LIBOR6M_LIBOR12M (bucketSensitivitySettingsIR),
  2742.                 linearMarginCovariance_LIBOR6M_PRIME (bucketSensitivitySettingsIR),
  2743.                 linearMarginCovariance_LIBOR6M_MUNICIPAL (bucketSensitivitySettingsIR),
  2744.                 linearMarginCovariance_LIBOR12M_LIBOR12M (bucketSensitivitySettingsIR),
  2745.                 linearMarginCovariance_LIBOR12M_PRIME (bucketSensitivitySettingsIR),
  2746.                 linearMarginCovariance_LIBOR12M_MUNICIPAL (bucketSensitivitySettingsIR),
  2747.                 linearMarginCovariance_PRIME_PRIME (bucketSensitivitySettingsIR),
  2748.                 linearMarginCovariance_PRIME_MUNICIPAL (bucketSensitivitySettingsIR),
  2749.                 linearMarginCovariance_MUNICIPAL_MUNICIPAL (bucketSensitivitySettingsIR),
  2750.                 cumulativeSensitivityMargin()
  2751.             );
  2752.         }
  2753.         catch (java.lang.Exception e)
  2754.         {
  2755.             e.printStackTrace();
  2756.         }

  2757.         return null;
  2758.     }

  2759.     /**
  2760.      * Compute the Curvature Margin Co-variance
  2761.      *
  2762.      * @param bucketSensitivitySettingsIR The IR Currency Bucket Curve Tenor Sensitivity Settings
  2763.      *
  2764.      * @return The Curvature Margin Co-variance
  2765.      */

  2766.     public org.drip.simm.margin.SensitivityAggregateIR curvatureMargin (
  2767.         final org.drip.simm.parameters.BucketSensitivitySettingsIR bucketSensitivitySettingsIR)
  2768.     {
  2769.         try
  2770.         {
  2771.             return new org.drip.simm.margin.SensitivityAggregateIR (
  2772.                 curvatureMarginCovariance_OIS_OIS (bucketSensitivitySettingsIR),
  2773.                 curvatureMarginCovariance_OIS_LIBOR1M (bucketSensitivitySettingsIR),
  2774.                 curvatureMarginCovariance_OIS_LIBOR3M (bucketSensitivitySettingsIR),
  2775.                 curvatureMarginCovariance_OIS_LIBOR6M (bucketSensitivitySettingsIR),
  2776.                 curvatureMarginCovariance_OIS_LIBOR12M (bucketSensitivitySettingsIR),
  2777.                 curvatureMarginCovariance_OIS_PRIME (bucketSensitivitySettingsIR),
  2778.                 curvatureMarginCovariance_OIS_MUNICIPAL (bucketSensitivitySettingsIR),
  2779.                 curvatureMarginCovariance_LIBOR1M_LIBOR1M (bucketSensitivitySettingsIR),
  2780.                 curvatureMarginCovariance_LIBOR1M_LIBOR3M (bucketSensitivitySettingsIR),
  2781.                 curvatureMarginCovariance_LIBOR1M_LIBOR6M (bucketSensitivitySettingsIR),
  2782.                 curvatureMarginCovariance_LIBOR1M_LIBOR12M (bucketSensitivitySettingsIR),
  2783.                 curvatureMarginCovariance_LIBOR1M_PRIME (bucketSensitivitySettingsIR),
  2784.                 curvatureMarginCovariance_LIBOR1M_MUNICIPAL (bucketSensitivitySettingsIR),
  2785.                 curvatureMarginCovariance_LIBOR3M_LIBOR3M (bucketSensitivitySettingsIR),
  2786.                 curvatureMarginCovariance_LIBOR3M_LIBOR6M (bucketSensitivitySettingsIR),
  2787.                 curvatureMarginCovariance_LIBOR3M_LIBOR12M (bucketSensitivitySettingsIR),
  2788.                 curvatureMarginCovariance_LIBOR3M_PRIME (bucketSensitivitySettingsIR),
  2789.                 curvatureMarginCovariance_LIBOR3M_MUNICIPAL (bucketSensitivitySettingsIR),
  2790.                 curvatureMarginCovariance_LIBOR6M_LIBOR6M (bucketSensitivitySettingsIR),
  2791.                 curvatureMarginCovariance_LIBOR6M_LIBOR12M (bucketSensitivitySettingsIR),
  2792.                 curvatureMarginCovariance_LIBOR6M_PRIME (bucketSensitivitySettingsIR),
  2793.                 curvatureMarginCovariance_LIBOR6M_MUNICIPAL (bucketSensitivitySettingsIR),
  2794.                 curvatureMarginCovariance_LIBOR12M_LIBOR12M (bucketSensitivitySettingsIR),
  2795.                 curvatureMarginCovariance_LIBOR12M_PRIME (bucketSensitivitySettingsIR),
  2796.                 curvatureMarginCovariance_LIBOR12M_MUNICIPAL (bucketSensitivitySettingsIR),
  2797.                 curvatureMarginCovariance_PRIME_PRIME (bucketSensitivitySettingsIR),
  2798.                 curvatureMarginCovariance_PRIME_MUNICIPAL (bucketSensitivitySettingsIR),
  2799.                 curvatureMarginCovariance_MUNICIPAL_MUNICIPAL (bucketSensitivitySettingsIR),
  2800.                 cumulativeSensitivityMargin()
  2801.             );
  2802.         }
  2803.         catch (java.lang.Exception e)
  2804.         {
  2805.             e.printStackTrace();
  2806.         }

  2807.         return null;
  2808.     }
  2809. }