MaureyOperatorCoveringBounds.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>MaureyOperatorCoveringBounds</i> implements the estimate the Upper Bounds and/or Absolute Values of the
  80.  * Covering Number for the Hilbert R<sup>d</sup> To Supremum R<sup>d</sup> Operator Class. The Main
  81.  * References are:
  82.  *
  83.  * <br><br>
  84.  *  <ul>
  85.  *      <li>
  86.  *          Carl, B. (1985): Inequalities of the Bernstein-Jackson type and the Degree of Compactness of
  87.  *              Operators in Banach Spaces <i>Annals of the Fourier Institute</i> <b>35 (3)</b> 79-118
  88.  *      </li>
  89.  *      <li>
  90.  *          Carl, B., and I. Stephani (1990): <i>Entropy, Compactness, and the Approximation of Operators</i>
  91.  *              <b>Cambridge University Press</b> Cambridge UK
  92.  *      </li>
  93.  *      <li>
  94.  *          Williamson, R. C., A. J. Smola, and B. Scholkopf (2000): Entropy Numbers of Linear Function
  95.  *              Classes, in: <i>Proceedings of the 13th Annual Conference on Computational Learning
  96.  *                  Theory</i> <b>ACM</b> New York
  97.  *      </li>
  98.  *  </ul>
  99.  *
  100.  * <br><br>
  101.  *  <ul>
  102.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ComputationalCore.md">Computational Core Module</a></li>
  103.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/StatisticalLearningLibrary.md">Statistical Learning Library</a></li>
  104.  *      <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>
  105.  *      <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>
  106.  *  </ul>
  107.  * <br><br>
  108.  *
  109.  * @author Lakshmi Krishnamurthy
  110.  */

  111. public class MaureyOperatorCoveringBounds {

  112.     /**
  113.      * Maurey Constant - from the Hilbert - Supremum Identity Map Estimate
  114.      */

  115.     public static final double HILBERT_SUPREMUM_IDENTITY_CONSTANT = 1.86;

  116.     /**
  117.      * Maurey Constant - from the Williamson-Smola-Scholkopf Estimate
  118.      */

  119.     public static final double WILLIAMSON_SMOLA_SCHOLKOPF_CONSTANT = 103.;

  120.     private int _iSupremumDimension = -1;
  121.     private double _dblOperatorNorm = java.lang.Double.NaN;
  122.     private double _dblMaureyConstant = java.lang.Double.NaN;

  123.     /**
  124.      * Construct an Instance Hilbert To Supremum Identity Map based Maurey Operator Covering Bounds
  125.      *
  126.      * @param iSupremumDimension The Operator Supremum Output Space Dimension
  127.      * @param dblOperatorNorm The Operator Norm of Interest
  128.      *
  129.      * @return The Instance Hilbert To Supremum Identity Map based Maurey Operator Covering Bounds
  130.      */

  131.     public static final MaureyOperatorCoveringBounds HilbertSupremumIdentityMap (
  132.         final int iSupremumDimension,
  133.         final double dblOperatorNorm)
  134.     {
  135.         try {
  136.             return new MaureyOperatorCoveringBounds (HILBERT_SUPREMUM_IDENTITY_CONSTANT,
  137.                 iSupremumDimension, dblOperatorNorm);
  138.         } catch (java.lang.Exception e) {
  139.             e.printStackTrace();
  140.         }

  141.         return null;
  142.     }

  143.     /**
  144.      * Construct an Instance of the Maurey Operator Covering Bounds based upon the Williamson, Smola, and
  145.      *  Scholkopf Estimate
  146.      *
  147.      * @param iSupremumDimension The Operator Supremum Output Space Dimension
  148.      * @param dblOperatorNorm The Operator Norm of Interest
  149.      *
  150.      * @return Maurey Operator Covering Bounds based upon the Williamson, Smola, and Scholkopf Estimate
  151.      */

  152.     public static final MaureyOperatorCoveringBounds WilliamsonSmolaScholkopfEstimate (
  153.         final int iSupremumDimension,
  154.         final double dblOperatorNorm)
  155.     {
  156.         try {
  157.             return new MaureyOperatorCoveringBounds (WILLIAMSON_SMOLA_SCHOLKOPF_CONSTANT,
  158.                 iSupremumDimension, dblOperatorNorm);
  159.         } catch (java.lang.Exception e) {
  160.             e.printStackTrace();
  161.         }

  162.         return null;
  163.     }

  164.     /**
  165.      * MaureyOperatorCoveringBounds Constructor
  166.      *
  167.      * @param dblMaureyConstant The Maurey Constant
  168.      * @param iSupremumDimension The Operator Supremum Output Space Dimension
  169.      * @param dblOperatorNorm The Operator Norm of Interest
  170.      *
  171.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  172.      */

  173.     public MaureyOperatorCoveringBounds (
  174.         final double dblMaureyConstant,
  175.         final int iSupremumDimension,
  176.         final double dblOperatorNorm)
  177.         throws java.lang.Exception
  178.     {
  179.         if (!org.drip.numerical.common.NumberUtil.IsValid (_dblMaureyConstant = dblMaureyConstant) || 0 >=
  180.             (_iSupremumDimension = iSupremumDimension) || !org.drip.numerical.common.NumberUtil.IsValid
  181.                 (_dblOperatorNorm = dblOperatorNorm))
  182.             throw new java.lang.Exception ("MaureyOperatorCoveringBounds ctr => Invalid Inputs");
  183.     }

  184.     /**
  185.      * Retrieve the Maurey Constant
  186.      *
  187.      * @return The Maurey Constant
  188.      */

  189.     public double maureyConstant()
  190.     {
  191.         return _dblMaureyConstant;
  192.     }

  193.     /**
  194.      * Retrieve the Supremum Dimension
  195.      *
  196.      * @return The Supremum Dimension
  197.      */

  198.     public int supremumDimension()
  199.     {
  200.         return _iSupremumDimension;
  201.     }

  202.     /**
  203.      * Retrieve the Operator Norm of Interest
  204.      *
  205.      * @return The Operator Norm of Interest
  206.      */

  207.     public double operatorNorm()
  208.     {
  209.         return _dblOperatorNorm;
  210.     }

  211.     /**
  212.      * Compute the Upper Bound for the Dyadic Entropy Number
  213.      *
  214.      * @param iEntropyNumberIndex The Entropy Number Index
  215.      *
  216.      * @return The Upper Bound for the DyadicEntropy Number
  217.      *
  218.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  219.      */

  220.     public double dyadicEntropyUpperBound (
  221.         final int iEntropyNumberIndex)
  222.         throws java.lang.Exception
  223.     {
  224.         if (0 >= iEntropyNumberIndex)
  225.             throw new java.lang.Exception
  226.                 ("MaureyOperatorCoveringBounds::dyadicEntropyUpperBound => Invalid Inputs");

  227.         return _dblMaureyConstant * _dblOperatorNorm * java.lang.Math.sqrt ((java.lang.Math.log (1. +
  228.             (((double) _iSupremumDimension) / ((double) iEntropyNumberIndex))) / iEntropyNumberIndex));
  229.     }

  230.     /**
  231.      * Compute the Upper Bound for the Entropy Number
  232.      *
  233.      * @param iEntropyNumberIndex The Entropy Number Index
  234.      *
  235.      * @return The Upper Bound for the Entropy Number
  236.      *
  237.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  238.      */

  239.     public double entropyNumberUpperBound (
  240.         final int iEntropyNumberIndex)
  241.         throws java.lang.Exception
  242.     {
  243.         if (0 >= iEntropyNumberIndex)
  244.             throw new java.lang.Exception
  245.                 ("MaureyOperatorCoveringBounds::entropyNumberUpperBound => Invalid Inputs");

  246.         double dblLogNPlus1 = 1. + java.lang.Math.log (iEntropyNumberIndex);

  247.         return _dblMaureyConstant * _dblOperatorNorm * java.lang.Math.sqrt ((1. + (((double)
  248.             _iSupremumDimension) / dblLogNPlus1)) / dblLogNPlus1);
  249.     }
  250. }