GroupPathExposureAdjustment.java

  1. package org.drip.xva.gross;

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

  76. /**
  77.  * <i>GroupPathExposureAdjustment</i> cumulates the Exposures and the Adjustments across Multiple
  78.  * Netting/Funding Groups on a Single Path Projection Run across multiple Counter Party Groups the constitute
  79.  * a Book. The References are:
  80.  *
  81.  *  <br><br>
  82.  *  <ul>
  83.  *      <li>
  84.  *          Albanese, C., and L. Andersen (2014): Accounting for OTC Derivatives: Funding Adjustments and the
  85.  *              Re-Hypothecation Option https://papers.ssrn.com/sol3/paper.cfm?abstract_id=2482955
  86.  *              <b>eSSRN</b>
  87.  *      </li>
  88.  *      <li>
  89.  *          Burgard, C., and M. Kjaer (2013): Funding Strategies, Funding Costs <i>Risk</i> <b>24 (12)</b>
  90.  *              82-87
  91.  *      </li>
  92.  *      <li>
  93.  *          Burgard, C., and M. Kjaer (2014): PDE Representations of Derivatives with Bilateral Counter-party
  94.  *              Risk and Funding Costs <i>Journal of Credit Risk</i> <b>7 (3)</b> 1-19
  95.  *      </li>
  96.  *      <li>
  97.  *          Burgard, C., and M. Kjaer (2017): Derivatives Funding, Netting, and Accounting
  98.  *              https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2534011 <b>eSSRN</b>
  99.  *      </li>
  100.  *      <li>
  101.  *          Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing
  102.  *              <i>Risk</i> <b>21 (2)</b> 97-102
  103.  *      </li>
  104.  *  </ul>
  105.  *
  106.  *  <br><br>
  107.  *  <ul>
  108.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/PortfolioCore.md">Portfolio Core Module</a></li>
  109.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/XVAAnalyticsLibrary.md">XVA Analytics Library</a></li>
  110.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/xva/README.md">Valuation Adjustments that account for Collateral, CC Credit/Debt and Funding Overhead</a></li>
  111.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/xva/gross/README.md">XVA Gross Adiabat Exposure Aggregation</a></li>
  112.  *  </ul>
  113.  * <br><br>
  114.  *
  115.  * @author Lakshmi Krishnamurthy
  116.  */

  117. public class GroupPathExposureAdjustment implements org.drip.xva.gross.PathExposureAdjustment
  118. {
  119.     private org.drip.xva.gross.MonoPathExposureAdjustment[] _monoPathExposureAdjustmentArray = null;

  120.     /**
  121.      * GroupPathExposureAdjustment Constructor
  122.      *
  123.      * @param monoPathExposureAdjustmentArray Array of Single Counter Party Path Exposure Adjustments
  124.      *
  125.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  126.      */

  127.     public GroupPathExposureAdjustment (
  128.         final org.drip.xva.gross.MonoPathExposureAdjustment[] monoPathExposureAdjustmentArray)
  129.         throws java.lang.Exception
  130.     {
  131.         if (null == (_monoPathExposureAdjustmentArray = monoPathExposureAdjustmentArray) ||
  132.             0 == _monoPathExposureAdjustmentArray.length)
  133.         {
  134.             throw new java.lang.Exception ("GroupPathExposureAdjustment Constructor => Invalid Inputs");
  135.         }

  136.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  137.         if (0 == adiabatGroupCount)
  138.         {
  139.             throw new java.lang.Exception ("GroupPathExposureAdjustment Constructor => Invalid Inputs");
  140.         }

  141.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  142.         {
  143.             if (null == _monoPathExposureAdjustmentArray[adiabatGroupIndex])
  144.             {
  145.                 throw new java.lang.Exception ("GroupPathExposureAdjustment Constructor => Invalid Inputs");
  146.             }
  147.         }
  148.     }

  149.     /**
  150.      * Retrieve the Array of Counter Party Group Paths
  151.      *
  152.      * @return Array of Counter Party Group Paths
  153.      */

  154.     public org.drip.xva.gross.MonoPathExposureAdjustment[] adiabatGroupPaths()
  155.     {
  156.         return _monoPathExposureAdjustmentArray;
  157.     }

  158.     @Override public org.drip.analytics.date.JulianDate[] vertexDates()
  159.     {
  160.         return _monoPathExposureAdjustmentArray[0].vertexDates();
  161.     }

  162.     @Override public double[] vertexCollateralizedExposure()
  163.     {
  164.         int vertexCount = vertexDates().length;

  165.         double[] collateralizedExposure = new double[vertexCount];
  166.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  167.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  168.         {
  169.             collateralizedExposure[vertexIndex] = 0.;
  170.         }

  171.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  172.         {
  173.             double[] counterPartyGroupCollateralizedExposure =
  174.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexCollateralizedExposure();

  175.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  176.             {
  177.                 collateralizedExposure[vertexIndex] += counterPartyGroupCollateralizedExposure[vertexIndex];
  178.             }
  179.         }

  180.         return collateralizedExposure;
  181.     }

  182.     @Override public double[] vertexCollateralizedExposurePV()
  183.     {
  184.         int vertexCount = vertexDates().length;

  185.         double[] collateralizedExposurePV = new double[vertexCount];
  186.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  187.         for (int j = 0; j < vertexCount; ++j)
  188.         {
  189.             collateralizedExposurePV[j] = 0.;
  190.         }

  191.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  192.         {
  193.             double[] counterPartyGroupCollateralizedExposurePV =
  194.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexCollateralizedExposurePV();

  195.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  196.             {
  197.                 collateralizedExposurePV[vertexIndex] +=
  198.                     counterPartyGroupCollateralizedExposurePV[vertexIndex];
  199.             }
  200.         }

  201.         return collateralizedExposurePV;
  202.     }

  203.     @Override public double[] vertexUncollateralizedExposure()
  204.     {
  205.         int vertexCount = vertexDates().length;

  206.         double[] uncollateralizedExposure = new double[vertexCount];
  207.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  208.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  209.         {
  210.             uncollateralizedExposure[vertexIndex] = 0.;
  211.         }

  212.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  213.         {
  214.             double[] pathUncollateralizedExposure =
  215.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexUncollateralizedExposure();

  216.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  217.             {
  218.                 uncollateralizedExposure[vertexIndex] += pathUncollateralizedExposure[vertexIndex];
  219.             }
  220.         }

  221.         return uncollateralizedExposure;
  222.     }

  223.     @Override public double[] vertexUncollateralizedExposurePV()
  224.     {
  225.         int vertexCount = vertexDates().length;

  226.         double[] uncollateralizedExposurePV = new double[vertexCount];
  227.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  228.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  229.         {
  230.             uncollateralizedExposurePV[vertexIndex] = 0.;
  231.         }

  232.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  233.         {
  234.             double[] pathUncollateralizedExposurePV =
  235.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexUncollateralizedExposurePV();

  236.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  237.             {
  238.                 uncollateralizedExposurePV[vertexIndex] += pathUncollateralizedExposurePV[vertexIndex];
  239.             }
  240.         }

  241.         return uncollateralizedExposurePV;
  242.     }

  243.     @Override public double[] vertexCollateralizedPositiveExposure()
  244.     {
  245.         int vertexCount = vertexDates().length;

  246.         double[] collateralizedPositiveExposure = new double[vertexCount];
  247.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  248.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  249.         {
  250.             collateralizedPositiveExposure[vertexIndex] = 0.;
  251.         }

  252.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  253.         {
  254.             double[] pathCollateralizedPositiveExposure =
  255.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexCollateralizedPositiveExposure();

  256.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  257.             {
  258.                 collateralizedPositiveExposure[vertexIndex] +=
  259.                     pathCollateralizedPositiveExposure[vertexIndex];
  260.             }
  261.         }

  262.         return collateralizedPositiveExposure;
  263.     }

  264.     @Override public double[] vertexCollateralizedPositiveExposurePV()
  265.     {
  266.         int vertexCount = vertexDates().length;

  267.         double[] collateralizedPositiveExposurePV = new double[vertexCount];
  268.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  269.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  270.         {
  271.             collateralizedPositiveExposurePV[vertexIndex] = 0.;
  272.         }

  273.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  274.         {
  275.             double[] pathCollateralizedPositiveExposurePV =
  276.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexCollateralizedPositiveExposurePV();

  277.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  278.             {
  279.                 collateralizedPositiveExposurePV[vertexIndex] +=
  280.                     pathCollateralizedPositiveExposurePV[vertexIndex];
  281.             }
  282.         }

  283.         return collateralizedPositiveExposurePV;
  284.     }

  285.     @Override public double[] vertexUncollateralizedPositiveExposure()
  286.     {
  287.         int vertexCount = vertexDates().length;

  288.         double[] uncollateralizedPositiveExposure = new double[vertexCount];
  289.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  290.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  291.         {
  292.             uncollateralizedPositiveExposure[vertexIndex] = 0.;
  293.         }

  294.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  295.         {
  296.             double[] pathUncollateralizedPositiveExposure =
  297.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexUncollateralizedPositiveExposure();

  298.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  299.             {
  300.                 uncollateralizedPositiveExposure[vertexIndex] +=
  301.                     pathUncollateralizedPositiveExposure[vertexIndex];
  302.             }
  303.         }

  304.         return uncollateralizedPositiveExposure;
  305.     }

  306.     @Override public double[] vertexUncollateralizedPositiveExposurePV()
  307.     {
  308.         int vertexCount = vertexDates().length;

  309.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;
  310.         double[] uncollateralizedPositiveExposurePV = new double[vertexCount];

  311.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  312.         {
  313.             uncollateralizedPositiveExposurePV[vertexIndex] = 0.;
  314.         }

  315.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  316.         {
  317.             double[] pathUncollateralizedPositiveExposurePV =
  318.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexUncollateralizedPositiveExposurePV();

  319.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  320.             {
  321.                 uncollateralizedPositiveExposurePV[vertexIndex] +=
  322.                     pathUncollateralizedPositiveExposurePV[vertexIndex];
  323.             }
  324.         }

  325.         return uncollateralizedPositiveExposurePV;
  326.     }

  327.     @Override public double[] vertexCollateralizedNegativeExposure()
  328.     {
  329.         int vertexCount = vertexDates().length;

  330.         double[] collateralizedNegativeExposure = new double[vertexCount];
  331.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  332.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  333.         {
  334.             collateralizedNegativeExposure[vertexIndex] = 0.;
  335.         }

  336.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  337.         {
  338.             double[] pathCollateralizedNegativeExposure =
  339.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexCollateralizedNegativeExposure();

  340.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  341.             {
  342.                 collateralizedNegativeExposure[vertexIndex] +=
  343.                     pathCollateralizedNegativeExposure[vertexIndex];
  344.             }
  345.         }

  346.         return collateralizedNegativeExposure;
  347.     }

  348.     @Override public double[] vertexCollateralizedNegativeExposurePV()
  349.     {
  350.         int vertexCount = vertexDates().length;

  351.         double[] collateralizedNegativeExposurePV = new double[vertexCount];
  352.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  353.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  354.         {
  355.             collateralizedNegativeExposurePV[vertexIndex] = 0.;
  356.         }

  357.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  358.         {
  359.             double[] pathCollateralizedNegativeExposurePV =
  360.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexCollateralizedNegativeExposurePV();

  361.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  362.             {
  363.                 collateralizedNegativeExposurePV[vertexIndex] +=
  364.                     pathCollateralizedNegativeExposurePV[vertexIndex];
  365.             }
  366.         }

  367.         return collateralizedNegativeExposurePV;
  368.     }

  369.     @Override public double[] vertexUncollateralizedNegativeExposure()
  370.     {
  371.         int vertexCount = vertexDates().length;

  372.         double[] uncollateralizedNegativeExposure = new double[vertexCount];
  373.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  374.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  375.         {
  376.             uncollateralizedNegativeExposure[vertexIndex] = 0.;
  377.         }

  378.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  379.         {
  380.             double[] adblPathUncollateralizedNegativeExposure =
  381.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexUncollateralizedNegativeExposure();

  382.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  383.             {
  384.                 uncollateralizedNegativeExposure[vertexIndex] +=
  385.                     adblPathUncollateralizedNegativeExposure[vertexIndex];
  386.             }
  387.         }

  388.         return uncollateralizedNegativeExposure;
  389.     }

  390.     @Override public double[] vertexUncollateralizedNegativeExposurePV()
  391.     {
  392.         int vertexCount = vertexDates().length;

  393.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;
  394.         double[] uncollateralizedNegativeExposurePV = new double[vertexCount];

  395.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  396.         {
  397.             uncollateralizedNegativeExposurePV[vertexIndex] = 0.;
  398.         }

  399.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  400.         {
  401.             double[] pathUncollateralizedNegativeExposurePV =
  402.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexUncollateralizedNegativeExposurePV();

  403.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  404.             {
  405.                 uncollateralizedNegativeExposurePV[vertexIndex] +=
  406.                     pathUncollateralizedNegativeExposurePV[vertexIndex];
  407.             }
  408.         }

  409.         return uncollateralizedNegativeExposurePV;
  410.     }

  411.     @Override public double[] vertexFundingExposure()
  412.     {
  413.         int vertexCount = vertexDates().length;

  414.         double[] fundingExposure = new double[vertexCount];
  415.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  416.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  417.         {
  418.             fundingExposure[vertexIndex] = 0.;
  419.         }

  420.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  421.         {
  422.             double[] pathFundingExposure =
  423.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexFundingExposure();

  424.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  425.             {
  426.                 fundingExposure[vertexIndex] += pathFundingExposure[vertexIndex];
  427.             }
  428.         }

  429.         return fundingExposure;
  430.     }

  431.     @Override public double[] vertexFundingExposurePV()
  432.     {
  433.         int vertexCount = vertexDates().length;

  434.         double[] fundingExposure = new double[vertexCount];
  435.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  436.         for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  437.         {
  438.             fundingExposure[vertexIndex] = 0.;
  439.         }

  440.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  441.         {
  442.             double[] pathFundingExposure =
  443.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].vertexFundingExposurePV();

  444.             for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
  445.             {
  446.                 fundingExposure[vertexIndex] += pathFundingExposure[vertexIndex];
  447.             }
  448.         }

  449.         return fundingExposure;
  450.     }

  451.     @Override public double unilateralCollateralAdjustment()
  452.     {
  453.         double unilateralCollateralAdjustment = 0.;
  454.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  455.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  456.         {
  457.             unilateralCollateralAdjustment +=
  458.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].unilateralCollateralAdjustment();
  459.         }

  460.         return unilateralCollateralAdjustment;
  461.     }

  462.     @Override public double bilateralCollateralAdjustment()
  463.     {
  464.         double bilateralCollateralAdjustment = 0.;
  465.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  466.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  467.         {
  468.             bilateralCollateralAdjustment +=
  469.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].bilateralCollateralAdjustment();
  470.         }

  471.         return bilateralCollateralAdjustment;
  472.     }

  473.     @Override public double collateralAdjustment()
  474.     {
  475.         return bilateralCollateralAdjustment();
  476.     }

  477.     @Override public double unilateralCreditAdjustment()
  478.     {
  479.         double unilateralCreditAdjustment = 0.;
  480.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  481.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  482.         {
  483.             unilateralCreditAdjustment +=
  484.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].unilateralCreditAdjustment();
  485.         }

  486.         return unilateralCreditAdjustment;
  487.     }

  488.     @Override public double bilateralCreditAdjustment()
  489.     {
  490.         double bilateralCreditAdjustment = 0.;
  491.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  492.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  493.         {
  494.             bilateralCreditAdjustment +=
  495.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].bilateralCreditAdjustment();
  496.         }

  497.         return bilateralCreditAdjustment;
  498.     }

  499.     @Override public double creditAdjustment()
  500.     {
  501.         return bilateralCreditAdjustment();
  502.     }

  503.     @Override public double contraLiabilityCreditAdjustment()
  504.     {
  505.         double contraLiabilityCreditAdjustment = 0.;
  506.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  507.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  508.         {
  509.             contraLiabilityCreditAdjustment +=
  510.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].contraLiabilityCreditAdjustment();
  511.         }

  512.         return contraLiabilityCreditAdjustment;
  513.     }

  514.     @Override public double unilateralDebtAdjustment()
  515.     {
  516.         double unilateralDebtAdjustment = 0.;
  517.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  518.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  519.         {
  520.             unilateralDebtAdjustment +=
  521.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].unilateralDebtAdjustment();
  522.         }

  523.         return unilateralDebtAdjustment;
  524.     }

  525.     @Override public double bilateralDebtAdjustment()
  526.     {
  527.         double bilateralDebtAdjustment = 0.;
  528.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  529.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  530.         {
  531.             bilateralDebtAdjustment +=
  532.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].bilateralDebtAdjustment();
  533.         }

  534.         return bilateralDebtAdjustment;
  535.     }

  536.     @Override public double debtAdjustment()
  537.     {
  538.         double debtAdjustment = 0.;
  539.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  540.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  541.         {
  542.             debtAdjustment += _monoPathExposureAdjustmentArray[adiabatGroupIndex].debtAdjustment();
  543.         }

  544.         return debtAdjustment;
  545.     }

  546.     @Override public double contraAssetDebtAdjustment()
  547.     {
  548.         double contraAssetDebtAdjustment = 0.;
  549.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  550.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  551.         {
  552.             contraAssetDebtAdjustment +=
  553.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].contraAssetDebtAdjustment();
  554.         }

  555.         return contraAssetDebtAdjustment;
  556.     }

  557.     @Override public double unilateralFundingValueAdjustment()
  558.     {
  559.         double unilateralFundingValueAdjustment = 0.;
  560.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  561.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  562.         {
  563.             unilateralFundingValueAdjustment +=
  564.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].unilateralFundingValueAdjustment();
  565.         }

  566.         return unilateralFundingValueAdjustment;
  567.     }

  568.     @Override public double bilateralFundingValueAdjustment()
  569.     {
  570.         double bilateralFundingValueAdjustment = 0.;
  571.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  572.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  573.         {
  574.             bilateralFundingValueAdjustment +=
  575.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].bilateralFundingValueAdjustment();
  576.         }

  577.         return bilateralFundingValueAdjustment;
  578.     }

  579.     @Override public double fundingValueAdjustment()
  580.     {
  581.         double fundingValueAdjustment = 0.;
  582.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  583.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  584.         {
  585.             fundingValueAdjustment +=
  586.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].fundingValueAdjustment();
  587.         }

  588.         return fundingValueAdjustment;
  589.     }

  590.     @Override public double fundingDebtAdjustment()
  591.     {
  592.         double fundingDebtAdjustment = 0.;
  593.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  594.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  595.         {
  596.             fundingDebtAdjustment +=
  597.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].fundingDebtAdjustment();
  598.         }

  599.         return fundingDebtAdjustment;
  600.     }

  601.     @Override public double fundingCostAdjustment()
  602.     {
  603.         double fundingCostAdjustment = 0.;
  604.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  605.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  606.         {
  607.             fundingCostAdjustment +=
  608.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].fundingCostAdjustment();
  609.         }

  610.         return fundingCostAdjustment;
  611.     }

  612.     @Override public double fundingBenefitAdjustment()
  613.     {
  614.         double fundingBenefitAdjustment = 0.;
  615.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  616.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  617.         {
  618.             fundingBenefitAdjustment +=
  619.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].fundingBenefitAdjustment();
  620.         }

  621.         return fundingBenefitAdjustment;
  622.     }

  623.     @Override public double symmetricFundingValueAdjustment()
  624.     {
  625.         double symmetricFundingValueAdjustment = 0.;
  626.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  627.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  628.         {
  629.             symmetricFundingValueAdjustment +=
  630.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].symmetricFundingValueAdjustment();
  631.         }

  632.         return symmetricFundingValueAdjustment;
  633.     }

  634.     @Override public double totalAdjustment()
  635.     {
  636.         double totalAdjustment = 0.;
  637.         int adiabatGroupCount = _monoPathExposureAdjustmentArray.length;

  638.         for (int adiabatGroupIndex = 0; adiabatGroupIndex < adiabatGroupCount; ++adiabatGroupIndex)
  639.         {
  640.             totalAdjustment +=
  641.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].creditAdjustment() +
  642.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].debtAdjustment() +
  643.                 _monoPathExposureAdjustmentArray[adiabatGroupIndex].fundingValueAdjustment();
  644.         }

  645.         return totalAdjustment;
  646.     }
  647. }