CarlStephaniProductBounds.java

  1. package org.drip.spaces.cover;

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

  78. /**
  79.  * <i>CarlStephaniProductBounds</i> implements the Bounds that result from the Convolution Product Product of
  80.  * 2 Normed R<sup>x</sup> To Normed R<sup>x</sup> Function Spaces. The References are:
  81.  *
  82.  * <br><br>
  83.  *  <ul>
  84.  *      <li>
  85.  *          Carl, B. (1985): Inequalities of the Bernstein-Jackson type and the Degree of Compactness of
  86.  *              Operators in Banach Spaces <i>Annals of the Fourier Institute</i> <b>35 (3)</b> 79-118
  87.  *      </li>
  88.  *      <li>
  89.  *          Carl, B., and I. Stephani (1990): <i>Entropy, Compactness, and the Approximation of Operators</i>
  90.  *              <b>Cambridge University Press</b> Cambridge UK
  91.  *      </li>
  92.  *      <li>
  93.  *          Williamson, R. C., A. J. Smola, and B. Scholkopf (2000): Entropy Numbers of Linear Function
  94.  *              Classes, in: <i>Proceedings of the 13th Annual Conference on Computational Learning
  95.  *                  Theory</i> <b>ACM</b> New York
  96.  *      </li>
  97.  *  </ul>
  98.  *
  99.  * <br><br>
  100.  *  <ul>
  101.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ComputationalCore.md">Computational Core Module</a></li>
  102.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/StatisticalLearningLibrary.md">Statistical Learning Library</a></li>
  103.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/spaces/README.md">R<sup>1</sup> and R<sup>d</sup> Vector/Tensor Spaces (Validated and/or Normed), and Function Classes</a></li>
  104.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/spaces/cover/README.md">Vector Spaces Covering Number Estimator</a></li>
  105.  *  </ul>
  106.  * <br><br>
  107.  *
  108.  * @author Lakshmi Krishnamurthy
  109.  */

  110. public class CarlStephaniProductBounds {
  111.     private org.drip.spaces.functionclass.NormedRxToNormedRxFinite _funcClassRxRxA = null;
  112.     private org.drip.spaces.functionclass.NormedRxToNormedRxFinite _funcClassRxRxB = null;

  113.     /**
  114.      * CarlStephaniProductBounds Constructor
  115.      *
  116.      * @param funcClassRxRxA Function Class A
  117.      * @param funcClassRxRxB Function Class B
  118.      *
  119.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  120.      */

  121.     public CarlStephaniProductBounds (
  122.         final org.drip.spaces.functionclass.NormedRxToNormedRxFinite funcClassRxRxA,
  123.         final org.drip.spaces.functionclass.NormedRxToNormedRxFinite funcClassRxRxB)
  124.         throws java.lang.Exception
  125.     {
  126.         if (null == (_funcClassRxRxA = funcClassRxRxA) || null == (_funcClassRxRxB = funcClassRxRxB))
  127.             throw new java.lang.Exception ("CarlStephaniProductBounds ctr: Invalid Inputs");
  128.     }

  129.     /**
  130.      * Retrieve the Function Class A
  131.      *
  132.      * @return The Function Class A
  133.      */

  134.     public org.drip.spaces.functionclass.NormedRxToNormedRxFinite funcClassA()
  135.     {
  136.         return _funcClassRxRxA;
  137.     }

  138.     /**
  139.      * Retrieve the Function Class B
  140.      *
  141.      * @return The Function Class B
  142.      */

  143.     public org.drip.spaces.functionclass.NormedRxToNormedRxFinite funcClassB()
  144.     {
  145.         return _funcClassRxRxB;
  146.     }

  147.     /**
  148.      * Compute the Upper Bound for the Entropy Number of the Operator Population Metric Covering Number
  149.      *  Convolution Product Product across both the Function Classes
  150.      *
  151.      * @param iEntropyNumberIndexA Entropy Number Index for Class A
  152.      * @param iEntropyNumberIndexB Entropy Number Index for Class B
  153.      *
  154.      * @return The Upper Bound for the Entropy Number of the Operator Population Metric Covering Number
  155.      *  Convolution Product Product across both the Function Classes
  156.      *
  157.      * @throws java.lang.Exception Thrown if the Convolution Product Product Population Metric Entropy Number cannot be
  158.      *  Computed
  159.      */

  160.     public double populationMetricEntropyNumber (
  161.         final int iEntropyNumberIndexA,
  162.         final int iEntropyNumberIndexB)
  163.         throws java.lang.Exception
  164.     {
  165.         return org.drip.spaces.cover.CoveringBoundsHelper.CarlStephaniProductBound
  166.             (_funcClassRxRxA.populationMetricCoveringBounds(),
  167.                 _funcClassRxRxB.populationMetricCoveringBounds(), iEntropyNumberIndexA,
  168.                     iEntropyNumberIndexB);
  169.     }

  170.     /**
  171.      * Compute the Upper Bound for the Entropy Number of the Operator Population Supremum Covering Number
  172.      *  Convolution Product across both the Function Classes
  173.      *
  174.      * @param iEntropyNumberIndexA Entropy Number Index for Class A
  175.      * @param iEntropyNumberIndexB Entropy Number Index for Class B
  176.      *
  177.      * @return The Upper Bound for the Entropy Number of the Operator Population Supremum Covering Number
  178.      *  Convolution Product across both the Function Classes
  179.      *
  180.      * @throws java.lang.Exception Thrown if the Convolution Product Population Supremum Dyadic Entropy cannot be
  181.      *  Computed
  182.      */

  183.     public double populationSupremumEntropyNumber (
  184.         final int iEntropyNumberIndexA,
  185.         final int iEntropyNumberIndexB)
  186.         throws java.lang.Exception
  187.     {
  188.         return org.drip.spaces.cover.CoveringBoundsHelper.CarlStephaniProductBound
  189.             (_funcClassRxRxA.populationSupremumCoveringBounds(),
  190.                 _funcClassRxRxB.populationSupremumCoveringBounds(), iEntropyNumberIndexA,
  191.                     iEntropyNumberIndexB);
  192.     }

  193.     /**
  194.      * Compute the Upper Bound for the Entropy Number of the Operator Sample Metric Covering Number
  195.      *  Convolution Product across both the Function Classes
  196.      *
  197.      * @param gvviA The Validated Input Vector Space Instance for Class A
  198.      * @param gvviB The Validated Input Vector Space Instance for Class B
  199.      * @param iEntropyNumberIndexA Entropy Number Index for Class A
  200.      * @param iEntropyNumberIndexB Entropy Number Index for Class B
  201.      *
  202.      * @return The Upper Bound for the Entropy Number of the Operator Sample Metric Covering Number
  203.      *  Convolution Product across both the Function Classes
  204.      *
  205.      * @throws java.lang.Exception Thrown if the Convolution Product Sample Metric Entropy Number cannot be
  206.      *  Computed
  207.      */

  208.     public double sampleMetricEntropyNumber (
  209.         final org.drip.spaces.instance.GeneralizedValidatedVector gvviA,
  210.         final org.drip.spaces.instance.GeneralizedValidatedVector gvviB,
  211.         final int iEntropyNumberIndexA,
  212.         final int iEntropyNumberIndexB)
  213.         throws java.lang.Exception
  214.     {
  215.         return org.drip.spaces.cover.CoveringBoundsHelper.CarlStephaniProductBound
  216.             (_funcClassRxRxA.sampleMetricCoveringBounds (gvviA),
  217.                 _funcClassRxRxB.sampleMetricCoveringBounds (gvviB), iEntropyNumberIndexA,
  218.                     iEntropyNumberIndexB);
  219.     }

  220.     /**
  221.      * Compute the Upper Bound for the Entropy Number of the Operator Sample Supremum Covering Number
  222.      *  Convolution Product across both the Function Classes
  223.      *
  224.      * @param gvviA The Validated Input Vector Space Instance for Class A
  225.      * @param gvviB The Validated Input Vector Space Instance for Class B
  226.      * @param iEntropyNumberIndexA Entropy Number Index for Class A
  227.      * @param iEntropyNumberIndexB Entropy Number Index for Class B
  228.      *
  229.      * @return The Upper Bound for the Entropy Number of the Operator Sample Supremum Covering Number
  230.      *  Convolution Product across both the Function Classes
  231.      *
  232.      * @throws java.lang.Exception Thrown if the Convolution Product Sample Supremum Entropy Number cannot be
  233.      *  Computed
  234.      */

  235.     public double sampleSupremumEntropyNumber (
  236.         final org.drip.spaces.instance.GeneralizedValidatedVector gvviA,
  237.         final org.drip.spaces.instance.GeneralizedValidatedVector gvviB,
  238.         final int iEntropyNumberIndexA,
  239.         final int iEntropyNumberIndexB)
  240.         throws java.lang.Exception
  241.     {
  242.         return org.drip.spaces.cover.CoveringBoundsHelper.CarlStephaniProductBound
  243.             (_funcClassRxRxA.sampleSupremumCoveringBounds (gvviA),
  244.                 _funcClassRxRxB.sampleSupremumCoveringBounds (gvviB), iEntropyNumberIndexA,
  245.                     iEntropyNumberIndexB);
  246.     }

  247.     /**
  248.      * Compute the Normed Upper Entropy Convolution Product Bound across the Function Classes
  249.      *
  250.      * @param mocbA The Maurey Operator Covering Bounds for Class A
  251.      * @param mocbB The Maurey Operator Covering Bounds for Class B
  252.      * @param iEntropyNumberIndex Entropy Number Index for either Class
  253.      * @param bUseSupremumNorm TRUE/FALSE - Use the Supremum/Metric Bound as the Operator Function Class
  254.      *
  255.      * @return The Normed Upper Entropy Convolution Product Bound across the Function Classes
  256.      */

  257.     public org.drip.spaces.cover.CarlStephaniNormedBounds normedEntropyUpperBound (
  258.         final org.drip.spaces.cover.MaureyOperatorCoveringBounds mocbA,
  259.         final org.drip.spaces.cover.MaureyOperatorCoveringBounds mocbB,
  260.         final int iEntropyNumberIndex,
  261.         final boolean bUseSupremumNorm)
  262.     {
  263.         try {
  264.             return org.drip.spaces.cover.CoveringBoundsHelper.CarlStephaniProductNorm (mocbA, mocbB,
  265.                 bUseSupremumNorm ? _funcClassRxRxA.operatorPopulationSupremumNorm() :
  266.                     _funcClassRxRxA.operatorPopulationMetricNorm(), bUseSupremumNorm ?
  267.                         _funcClassRxRxB.operatorPopulationSupremumNorm() :
  268.                             _funcClassRxRxB.operatorPopulationMetricNorm(), iEntropyNumberIndex);
  269.         } catch (java.lang.Exception e) {
  270.             e.printStackTrace();
  271.         }

  272.         return null;
  273.     }

  274.     /**
  275.      * Compute the Population Supremum Carl-Stephani Entropy Number Upper Bound using either the
  276.      *  Metric/Supremum Population Norm
  277.      *  
  278.      * @param iEntropyNumberIndex Entropy Number Index for either Class
  279.      * @param bUseSupremumNorm TRUE/FALSE - Use the Supremum/Metric Bound as the Operator Function Class
  280.      *
  281.      * @return The Population Supremum Carl-Stephani Entropy Number Upper Bound using either the
  282.      *  Metric/Supremum Population Norm
  283.      */

  284.     public org.drip.spaces.cover.CarlStephaniNormedBounds populationSupremumEntropyNorm (
  285.         final int iEntropyNumberIndex,
  286.         final boolean bUseSupremumNorm)
  287.     {
  288.         return normedEntropyUpperBound (_funcClassRxRxA.populationSupremumCoveringBounds(),
  289.             _funcClassRxRxB.populationSupremumCoveringBounds(), iEntropyNumberIndex, bUseSupremumNorm);
  290.     }

  291.     /**
  292.      * Compute the Population Metric Carl-Stephani Entropy Number Upper Bound using either the
  293.      *  Metric/Supremum Population Norm
  294.      *  
  295.      * @param iEntropyNumberIndex Entropy Number Index for either Class
  296.      * @param bUseSupremumNorm TRUE/FALSE - Use the Supremum/Metric Bound as the Operator Function Class
  297.      *
  298.      * @return The Population Metric Carl-Stephani Entropy Number Upper Bound using either the
  299.      *  Metric/Supremum Population Norm
  300.      */

  301.     public org.drip.spaces.cover.CarlStephaniNormedBounds populationMetricEntropyNorm (
  302.         final int iEntropyNumberIndex,
  303.         final boolean bUseSupremumNorm)
  304.     {
  305.         return normedEntropyUpperBound (_funcClassRxRxA.populationMetricCoveringBounds(),
  306.             _funcClassRxRxB.populationMetricCoveringBounds(), iEntropyNumberIndex, bUseSupremumNorm);
  307.     }

  308.     /**
  309.      * Compute the Sample Supremum Carl-Stephani Entropy Number Upper Bound using either the Metric/Supremum
  310.      *  Population Norm
  311.      *  
  312.      * @param gvviA The Validated Input Vector Space Instance for Class A
  313.      * @param gvviB The Validated Input Vector Space Instance for Class B
  314.      * @param iEntropyNumberIndex Entropy Number Index for either Class
  315.      * @param bUseSupremumNorm TRUE/FALSE - Use the Supremum/Metric Bound as the Operator Function Class
  316.      *
  317.      * @return The Sample Supremum Carl-Stephani Entropy Number Upper Bound using either the Metric/Supremum
  318.      *  Population Norm
  319.      */

  320.     public org.drip.spaces.cover.CarlStephaniNormedBounds sampleSupremumEntropyNorm (
  321.         final org.drip.spaces.instance.GeneralizedValidatedVector gvviA,
  322.         final org.drip.spaces.instance.GeneralizedValidatedVector gvviB,
  323.         final int iEntropyNumberIndex,
  324.         final boolean bUseSupremumNorm)
  325.     {
  326.         return normedEntropyUpperBound (_funcClassRxRxA.sampleSupremumCoveringBounds (gvviA),
  327.             _funcClassRxRxB.sampleSupremumCoveringBounds (gvviB), iEntropyNumberIndex, bUseSupremumNorm);
  328.     }

  329.     /**
  330.      * Compute the Sample Metric Carl-Stephani Entropy Number Upper Bound using either the Metric/Supremum
  331.      *  Population Norm
  332.      *  
  333.      * @param gvviA The Validated Input Vector Space Instance for Class A
  334.      * @param gvviB The Validated Input Vector Space Instance for Class B
  335.      * @param iEntropyNumberIndex Entropy Number Index for either Class
  336.      * @param bUseSupremumNorm TRUE/FALSE - Use the Supremum/Metric Bound as the Operator Function Class
  337.      *
  338.      * @return The Sample Metric Carl-Stephani Entropy Number Upper Bound using either the Metric/Supremum
  339.      *  Population Norm
  340.      */

  341.     public org.drip.spaces.cover.CarlStephaniNormedBounds sampleMetricEntropyNorm (
  342.         final org.drip.spaces.instance.GeneralizedValidatedVector gvviA,
  343.         final org.drip.spaces.instance.GeneralizedValidatedVector gvviB,
  344.         final int iEntropyNumberIndex,
  345.         final boolean bUseSupremumNorm)
  346.     {
  347.         return normedEntropyUpperBound (_funcClassRxRxA.sampleMetricCoveringBounds (gvviA),
  348.             _funcClassRxRxB.sampleMetricCoveringBounds (gvviB), iEntropyNumberIndex, bUseSupremumNorm);
  349.     }
  350. }