CoveringBoundsHelper.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>CoveringBoundsHelper</i> contains the assortment of Utilities used in the Computation of Upper Bounds
  80.  * for Normed Single Function Spaces and Function Space Products. 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 CoveringBoundsHelper {

  111.     /**
  112.      * Compute the Dyadic Entropy Number from the nth Entropy Number
  113.      *
  114.      * @param dblLogNEntropyNumber Log of the nth Entropy Number
  115.      *
  116.      * @return The Dyadic Entropy Number
  117.      *
  118.      * @throws java.lang.Exception Thrown if the Dyadic Entropy Number cannot be calculated
  119.      */

  120.     public static final double DyadicEntropyNumber (
  121.         final double dblLogNEntropyNumber)
  122.         throws java.lang.Exception
  123.     {
  124.         if (!org.drip.numerical.common.NumberUtil.IsValid (dblLogNEntropyNumber))
  125.             throw new java.lang.Exception ("CoveringBoundsHelper::DyadicEntropyNumber => Invalid Inputs");

  126.         return 1. + (dblLogNEntropyNumber / java.lang.Math.log (2.));
  127.     }

  128.     /**
  129.      * Compute the Upper Bound for the Entropy Number of the Operator Custom Covering Number Metric Product
  130.      *  across both the Function Classes
  131.      *
  132.      * @param mocbA The Maurey Operator Covering Bounds for Class A
  133.      * @param mocbB The Maurey Operator Covering Bounds for Class B
  134.      * @param iEntropyNumberIndexA Entropy Number Index for Class A
  135.      * @param iEntropyNumberIndexB Entropy Number Index for Class B
  136.      *
  137.      * @return The Upper Bound for the Entropy Number of the Operator Custom Covering Number Metric Product
  138.      *  across both the Function Classes
  139.      *
  140.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  141.      */

  142.     public static final double CarlStephaniProductBound (
  143.         final org.drip.spaces.cover.MaureyOperatorCoveringBounds mocbA,
  144.         final org.drip.spaces.cover.MaureyOperatorCoveringBounds mocbB,
  145.         final int iEntropyNumberIndexA,
  146.         final int iEntropyNumberIndexB)
  147.         throws java.lang.Exception
  148.     {
  149.         if (null == mocbA || null == mocbB)
  150.             throw new java.lang.Exception
  151.                 ("CoveringBoundsHelper::CarlStephaniProductBound => Invalid Maurey Bounds for the Function Class");

  152.         return mocbA.entropyNumberUpperBound (iEntropyNumberIndexA) * mocbB.entropyNumberUpperBound
  153.             (iEntropyNumberIndexB);
  154.     }

  155.     /**
  156.      * Compute the Upper Bound for the Entropy Number of the Operator Custom Covering Number Metric Product
  157.      *  across both the Function Classes using the Function Class Norm
  158.      *
  159.      * @param mocbA The Maurey Operator Covering Bounds for Class A
  160.      * @param mocbB The Maurey Operator Covering Bounds for Class B
  161.      * @param dblNormA The Function Class A Norm
  162.      * @param dblNormB The Function Class B Norm
  163.      * @param iEntropyNumberIndex Entropy Number Index for either Class
  164.      *
  165.      * @return The Upper Bound for the Entropy Number of the Operator Custom Covering Number Metric
  166.      *  Product across both the Function Classes using the Function Norm
  167.      */

  168.     public static final org.drip.spaces.cover.CarlStephaniNormedBounds CarlStephaniProductNorm (
  169.         final org.drip.spaces.cover.MaureyOperatorCoveringBounds mocbA,
  170.         final org.drip.spaces.cover.MaureyOperatorCoveringBounds mocbB,
  171.         final double dblNormA,
  172.         final double dblNormB,
  173.         final int iEntropyNumberIndex)
  174.     {
  175.         if (null == mocbA || null == mocbB) return null;

  176.         try {
  177.             return new org.drip.spaces.cover.CarlStephaniNormedBounds (mocbA.entropyNumberUpperBound
  178.                 (iEntropyNumberIndex) * dblNormB, mocbB.entropyNumberUpperBound (iEntropyNumberIndex) *
  179.                     dblNormA);
  180.         } catch (java.lang.Exception e) {
  181.             e.printStackTrace();
  182.         }

  183.         return null;
  184.     }
  185. }