FrobeniusCovariance.java

  1. package org.drip.function.matrix;

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

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

  63. /**
  64.  * <i>FrobeniusCovariance</i> implements the Frobenius Co-variance of a Square Matrix, which corresponds to
  65.  *  the Projection Shadows of Lagrange Polynomials of the Square Matrix. The References are:
  66.  *  
  67.  * <br><br>
  68.  *  <ul>
  69.  *      <li>
  70.  *          Claerbout, J. F. (1985): <i>Fundamentals of Geo-physical Data Processing</i> <b>Blackwell
  71.  *              Scientific</b>
  72.  *      </li>
  73.  *      <li>
  74.  *          Horn, R. A., and C. R. Johnson (1991): <i>Topics in Matrix Analysis</i> <b>Cambridge University
  75.  *              Press</b>
  76.  *      </li>
  77.  *      <li>
  78.  *          Schwerdtfeger, A. (1938): <i>Les Fonctions de Matrices: Les Fonctions Univalentes I</i>
  79.  *              <b>Hermann</b> Paris, France
  80.  *      </li>
  81.  *      <li>
  82.  *          Sylvester, J. J. (1883): On the Equation to the Secular Inequalities in the Planetary Theory
  83.  *              <i>The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science</i> <b>16
  84.  *              (100)</b> 267-269
  85.  *      </li>
  86.  *      <li>
  87.  *          Wikipedia (2019): Sylvester Formula https://en.wikipedia.org/wiki/Sylvester%27s_formula
  88.  *      </li>
  89.  *  </ul>
  90.  *  
  91.  * <br><br>
  92.  *  <ul>
  93.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/NumericalCore.md">Numerical Core Module</a></li>
  94.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/NumericalSupportLibrary.md">Numerical Support Library</a></li>
  95.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/README.md">Sample</a></li>
  96.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/matrix/README.md">Linear Algebra and Matrix Utilities</a></li>
  97.  *  </ul>
  98.  * <br><br>
  99.  *
  100.  * @author Lakshmi Krishnamurthy
  101.  */

  102. public class FrobeniusCovariance
  103. {
  104.     private java.util.Map<java.lang.Double, org.drip.function.matrix.Square> _componentMap = null;

  105.     /**
  106.      * Empty FrobeniusCovariance Constructor
  107.      */

  108.     public FrobeniusCovariance()
  109.     {
  110.     }

  111.     /**
  112.      * Add a Frobenius Component
  113.      *
  114.      * @param eigenValue The Frobenius Component EigenValue
  115.      * @param component The Frobenius Component
  116.      *
  117.      * @return TRUE - The Frobenius Component successfully added
  118.      */

  119.     public boolean addComponent (
  120.         final double eigenValue,
  121.         final org.drip.function.matrix.Square component)
  122.     {
  123.         if (!org.drip.numerical.common.NumberUtil.IsValid (
  124.                 eigenValue
  125.             ) || null == component
  126.         )
  127.         {
  128.             return false;
  129.         }

  130.         if (null == _componentMap)
  131.         {
  132.             _componentMap = new java.util.TreeMap<java.lang.Double, org.drip.function.matrix.Square>();
  133.         }

  134.         _componentMap.put (
  135.             eigenValue,
  136.             component
  137.         );

  138.         return true;
  139.     }

  140.     /**
  141.      * Retrieve the Map of Frobenius Components
  142.      *
  143.      * @return Map of Frobenius Components
  144.      */

  145.     public java.util.Map<java.lang.Double, org.drip.function.matrix.Square> componentMap()
  146.     {
  147.         return _componentMap;
  148.     }
  149. }