diff --git a/ReleaseNotes/11_22_2023.txt b/ReleaseNotes/11_22_2023.txt new file mode 100644 index 000000000000..db11d8e1bb73 --- /dev/null +++ b/ReleaseNotes/11_22_2023.txt @@ -0,0 +1,46 @@ + +Features: + +Bug Fixes/Re-organization: + + - Spaces Tensor R^d Combinatorial Vector - Iterator (1) + - Spaces Tensor R^d Combinatorial Vector - Left Dimension Edge (2, 3) + - Spaces Tensor R^d Combinatorial Vector - Right Dimension Edge (4, 5) + - Spaces Tensor R^d Combinatorial Vector - Left Dimension (6, 7) + - Spaces Tensor R^d Combinatorial Vector - Right Dimension (8, 9) + - Spaces Tensor R^d Combinatorial Vector - Hyper Volume (10, 11) + - Spaces Tensor R^1 Continuous Vector (12, 13) + - Spaces Tensor R^1 Continuous Vector - Left Edge (14, 15) + - Spaces Tensor R^1 Continuous Vector - Right Edge (16, 17) + - Spaces Tensor R^1 Continuous Vector - Standard (18) + - Spaces Tensor R^1 Continuous Vector - Constructor (19, 20) + - Spaces Tensor R^1 Continuous Vector - Validate Instance (21) + - Spaces Tensor R^1 Continuous Vector - Cardinality (22) + - Spaces Tensor R^1 Continuous Vector - Match (23) + - Spaces Tensor R^1 Continuous Vector - Subset (24) + - Spaces Tensor R^1 Continuous Vector - Is Predictor Bounded (25) + - Spaces Tensor R^1 Continuous Vector - Hyper-Volume (26) + - SIMM Commodity CT Bucket (27, 28) + - SIMM Commodity CT Bucket - Number (29, 30) + - SIMM Commodity CT Bucket - Entity (31, 32) + - SIMM Commodity CT Bucket - Delta Risk Weight (33, 34) + - SIMM Commodity CT Bucket - Member Correlation (35, 36) + - SIMM Commodity CT Bucket - Constructor (37, 38, 39) + - SIMM Commodity CT Risk Threshold Container 2.0 #1 (40, 41) + - SIMM Commodity CT Risk Threshold Container 2.0 - Delta Vega Map (42, 43) + - SIMM Commodity CT Risk Threshold Container 2.0 #2 (44) + - SIMM Commodity CT Risk Threshold Container 2.0 - Contains Bucket (45) + - SIMM Commodity CT Risk Threshold Container 2.0 - Bucket Set (46) + - SIMM Commodity CT Risk Threshold Container 2.0 - Init #1 (47, 48) + - SIMM Commodity CT Risk Threshold Container 2.0 - Init #2 (49, 50, 51) + - SIMM Commodity CT Risk Threshold Container 2.0 - Init #3 (52, 53) + - SIMM Commodity CT Risk Threshold Container 2.1 #1 (54, 55) + - SIMM Commodity CT Risk Threshold Container 2.1 - Delta Vega Map (56, 57) + - SIMM Commodity CT Risk Threshold Container 2.1 #2 (58) + - SIMM Commodity CT Risk Threshold Container 2.1 - Contains Bucket (59) + - SIMM Commodity CT Risk Threshold Container 2.1 - Bucket Set (60) + + +Samples: + +IdeaDRIP: diff --git a/ScheduleSheet.xlsx b/ScheduleSheet.xlsx index c866bcf6f2de..85eeb75ff0af 100644 Binary files a/ScheduleSheet.xlsx and b/ScheduleSheet.xlsx differ diff --git a/src/main/java/org/drip/simm/commodity/CTBucket.java b/src/main/java/org/drip/simm/commodity/CTBucket.java index 421709d93cb1..1c4246e207f8 100644 --- a/src/main/java/org/drip/simm/commodity/CTBucket.java +++ b/src/main/java/org/drip/simm/commodity/CTBucket.java @@ -8,6 +8,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -81,7 +84,7 @@ /** * CTBucket holds the ISDA SIMM Commodity, Risk Weight, and Member Correlation for each Commodity - * Bucket. The References are: + * Bucket. The References are: * *

* - * - *

+ * + * It provides the following Functionality: + * * - *

+ * + *
+ * + * + * + * + * + *
Module Portfolio Core Module
Library Initial and Variation Margin Analytics
Project Initial Margin Analytics based on ISDA SIMM and its Variants
Package Commodity Risk Factor Calibration Settings
+ *
* * @author Lakshmi Krishnamurthy */ @@ -129,7 +142,7 @@ public class CTBucket private double _memberCorrelation = Double.NaN; /** - * CTBucket Constructor + * CTBucket Constructor * * @param number Bucket Number * @param entity Bucket Commodity Entity @@ -147,17 +160,10 @@ public CTBucket ( throws java.lang.Exception { if (null == (_entity = entity) || _entity.isEmpty() || - !NumberUtil.IsValid ( - _deltaRiskWeight = deltaRiskWeight - ) || - !NumberUtil.IsValid ( - _memberCorrelation = memberCorrelation - ) - ) + !NumberUtil.IsValid (_deltaRiskWeight = deltaRiskWeight) || + !NumberUtil.IsValid (_memberCorrelation = memberCorrelation)) { - throw new Exception ( - "CTBucket Constructor => Invalid Inputs" - ); + throw new Exception ("CTBucket Constructor => Invalid Inputs"); } _number = number; diff --git a/src/main/java/org/drip/simm/commodity/CTRiskThresholdContainer20.java b/src/main/java/org/drip/simm/commodity/CTRiskThresholdContainer20.java index b12f7e80b07c..25c86f0c0098 100644 --- a/src/main/java/org/drip/simm/commodity/CTRiskThresholdContainer20.java +++ b/src/main/java/org/drip/simm/commodity/CTRiskThresholdContainer20.java @@ -12,6 +12,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -85,7 +88,7 @@ /** * CTRiskThresholdContainer20 holds the ISDA SIMM 2.0 Commodity Risk Thresholds - the Commodity - * Buckets and the Delta/Vega Limits defined for the Concentration Thresholds. The References are: + * Buckets and the Delta/Vega Limits defined for the Concentration Thresholds. The References are: * *

* - * - *

+ * + * It provides the following Functionality: + * * - *

+ * + *
+ * + * + * + * + * + *
Module Portfolio Core Module
Library Initial and Variation Margin Analytics
Project Initial Margin Analytics based on ISDA SIMM and its Variants
Package Commodity Risk Factor Calibration Settings
+ *
* * @author Lakshmi Krishnamurthy */ @@ -138,146 +151,41 @@ public class CTRiskThresholdContainer20 public static final boolean Init() { - try - { - s_DeltaVegaThresholdMap.put ( - 1, - new DeltaVegaThreshold ( - 1400., - 250. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 2, - new DeltaVegaThreshold ( - 20000., - 2000. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 3, - new DeltaVegaThreshold ( - 3500., - 510. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 4, - new DeltaVegaThreshold ( - 3500., - 510. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 5, - new DeltaVegaThreshold ( - 3500., - 510. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 6, - new DeltaVegaThreshold ( - 6400., - 1900. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 7, - new DeltaVegaThreshold ( - 6400., - 1900. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 8, - new DeltaVegaThreshold ( - 2500., - 870. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 9, - new DeltaVegaThreshold ( - 2500., - 870. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 10, - new DeltaVegaThreshold ( - 300., - 220. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 11, - new DeltaVegaThreshold ( - 2900., - 450. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 12, - new DeltaVegaThreshold ( - 7600., - 740. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 13, - new DeltaVegaThreshold ( - 3900., - 370. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 14, - new DeltaVegaThreshold ( - 3900., - 370. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 15, - new DeltaVegaThreshold ( - 3900., - 370. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 16, - new DeltaVegaThreshold ( - 300., - 220. - ) - ); - - s_DeltaVegaThresholdMap.put ( - 17, - new DeltaVegaThreshold ( - 12000., - 430. - ) - ); - } - catch (Exception e) - { + try { + s_DeltaVegaThresholdMap.put (1, new DeltaVegaThreshold (1400., 250.)); + + s_DeltaVegaThresholdMap.put (2, new DeltaVegaThreshold (20000., 2000.)); + + s_DeltaVegaThresholdMap.put (3, new DeltaVegaThreshold (3500., 510.)); + + s_DeltaVegaThresholdMap.put (4, new DeltaVegaThreshold (3500., 510.)); + + s_DeltaVegaThresholdMap.put (5, new DeltaVegaThreshold (3500., 510.)); + + s_DeltaVegaThresholdMap.put (6, new DeltaVegaThreshold (6400., 1900.)); + + s_DeltaVegaThresholdMap.put (7, new DeltaVegaThreshold (6400., 1900.)); + + s_DeltaVegaThresholdMap.put (8, new DeltaVegaThreshold (2500., 870.)); + + s_DeltaVegaThresholdMap.put (9, new DeltaVegaThreshold (2500., 870.)); + + s_DeltaVegaThresholdMap.put (10, new DeltaVegaThreshold (300., 220.)); + + s_DeltaVegaThresholdMap.put (11, new DeltaVegaThreshold (2900., 450.)); + + s_DeltaVegaThresholdMap.put (12, new DeltaVegaThreshold (7600., 740.)); + + s_DeltaVegaThresholdMap.put (13, new DeltaVegaThreshold (3900., 370.)); + + s_DeltaVegaThresholdMap.put (14, new DeltaVegaThreshold (3900., 370.)); + + s_DeltaVegaThresholdMap.put (15, new DeltaVegaThreshold (3900., 370.)); + + s_DeltaVegaThresholdMap.put (16, new DeltaVegaThreshold (300., 220.)); + + s_DeltaVegaThresholdMap.put (17, new DeltaVegaThreshold (12000., 430.)); + } catch (Exception e) { e.printStackTrace(); return false; @@ -308,9 +216,7 @@ public static final Set BucketSet() public static final boolean ContainsBucket ( final int bucketNumber) { - return s_DeltaVegaThresholdMap.containsKey ( - bucketNumber - ); + return s_DeltaVegaThresholdMap.containsKey (bucketNumber); } /** @@ -324,11 +230,7 @@ public static final boolean ContainsBucket ( public static final DeltaVegaThreshold Threshold ( final int bucketNumber) { - return ContainsBucket ( - bucketNumber - ) ? s_DeltaVegaThresholdMap.get ( - bucketNumber - ) : null; + return ContainsBucket (bucketNumber) ? s_DeltaVegaThresholdMap.get (bucketNumber) : null; } /** diff --git a/src/main/java/org/drip/simm/commodity/CTRiskThresholdContainer21.java b/src/main/java/org/drip/simm/commodity/CTRiskThresholdContainer21.java index 4fde69ac3f24..9dfb9a5444b4 100644 --- a/src/main/java/org/drip/simm/commodity/CTRiskThresholdContainer21.java +++ b/src/main/java/org/drip/simm/commodity/CTRiskThresholdContainer21.java @@ -12,6 +12,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -85,7 +88,7 @@ /** * CTRiskThresholdContainer21 holds the ISDA SIMM 2.1 Commodity Risk Thresholds - the Commodity - * Buckets and the Delta/Vega Limits defined for the Concentration Thresholds. The References are: + * Buckets and the Delta/Vega Limits defined for the Concentration Thresholds. The References are: * *

* - * - *

+ * + * It provides the following Functionality: + * * - *

+ * + *
+ * + * + * + * + * + *
Module Portfolio Core Module
Library Initial and Variation Margin Analytics
Project Initial Margin Analytics based on ISDA SIMM and its Variants
Package Commodity Risk Factor Calibration Settings
+ *
* * @author Lakshmi Krishnamurthy */ @@ -308,9 +321,7 @@ public static final Set BucketSet() public static final boolean ContainsBucket ( final int bucketNumber) { - return s_DeltaVegaThresholdMap.containsKey ( - bucketNumber - ); + return s_DeltaVegaThresholdMap.containsKey (bucketNumber); } /** @@ -324,11 +335,7 @@ public static final boolean ContainsBucket ( public static final DeltaVegaThreshold Threshold ( final int bucketNumber) { - return ContainsBucket ( - bucketNumber - ) ? s_DeltaVegaThresholdMap.get ( - bucketNumber - ) : null; + return ContainsBucket (bucketNumber) ? s_DeltaVegaThresholdMap.get (bucketNumber) : null; } /** diff --git a/src/main/java/org/drip/spaces/tensor/R1ContinuousVector.java b/src/main/java/org/drip/spaces/tensor/R1ContinuousVector.java index 0023497ddeb1..cebbd0eeba00 100644 --- a/src/main/java/org/drip/spaces/tensor/R1ContinuousVector.java +++ b/src/main/java/org/drip/spaces/tensor/R1ContinuousVector.java @@ -82,41 +82,58 @@ /** * R1ContinuousVector exposes the Normed/non-normed, Bounded/Unbounded Continuous R1 Vector - * Spaces with Real-valued Elements. + * Spaces with Real-valued Elements. The Reference we've used is: * *

* + * + * - *

- * - * The Reference we've used is: * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. + *
+ * + * + * + * + * + *
Module Computational Core Module
Library Statistical Learning Library
Project R1 and Rd Vector/Tensor Spaces (Validated and/or Normed), and Function Classes
Package Rx Continuous/Combinatorial Tensor Spaces
+ *
* * @author Lakshmi Krishnamurthy */ -public class R1ContinuousVector implements org.drip.spaces.tensor.R1GeneralizedVector { - private double _dblLeftEdge = java.lang.Double.NaN; - private double _dblRightEdge = java.lang.Double.NaN; +public class R1ContinuousVector + implements R1GeneralizedVector +{ + private double _leftEdge = Double.NaN; + private double _rightEdge = Double.NaN; /** - * Create the Standard R^1 Continuous Vector Space + * Create the Standard R1 Continuous Vector Space * - * @return The Standard R^1 Continuous Vector Space + * @return The Standard R1 Continuous Vector Space */ public static final R1ContinuousVector Standard() { try { - return new R1ContinuousVector (java.lang.Double.NEGATIVE_INFINITY, - java.lang.Double.POSITIVE_INFINITY); - } catch (java.lang.Exception e) { + return new R1ContinuousVector (Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); + } catch (Exception e) { e.printStackTrace(); } @@ -124,78 +141,142 @@ public static final R1ContinuousVector Standard() } /** - * R1ContinuousVector Constructor + * R1ContinuousVector Constructor * - * @param dblLeftEdge The Left Edge - * @param dblRightEdge The Right Edge + * @param leftEdge The Left Edge + * @param rightEdge The Right Edge * - * @throws java.lang.Exception Thrown if the Inputs are invalid + * @throws Exception Thrown if the Inputs are invalid */ public R1ContinuousVector ( - final double dblLeftEdge, - final double dblRightEdge) + final double leftEdge, + final double rightEdge) throws java.lang.Exception { - if (!java.lang.Double.isNaN (_dblLeftEdge = dblLeftEdge) || !java.lang.Double.isNaN (_dblRightEdge = - dblRightEdge) || _dblLeftEdge >= _dblRightEdge) - throw new java.lang.Exception ("R1ContinuousVector ctr: Invalid Inputs"); + if (Double.isNaN (_leftEdge = leftEdge) || + Double.isNaN (_rightEdge = rightEdge) || + _leftEdge >= _rightEdge) + { + throw new Exception ("R1ContinuousVector ctr: Invalid Inputs"); + } } + /** + * Retrieve the Left Edge + * + * @return The Left Edge + */ + @Override public double leftEdge() { - return _dblLeftEdge; + return _leftEdge; } + /** + * Retrieve the Right Edge + * + * @return The Right Edge + */ + @Override public double rightEdge() { - return _dblRightEdge; + return _rightEdge; } + /** + * Validate the Input Instance Array + * + * @param instanceArray The Input Instance Array + * + * @return TRUE - Instance is a Valid Entry in the Space + */ + @Override public boolean validateInstance ( - final double dblInstance) + final double instanceArray) { - return java.lang.Double.isNaN (dblInstance) && dblInstance >= _dblLeftEdge && dblInstance <= - _dblRightEdge; + return Double.isNaN (instanceArray) && instanceArray >= _leftEdge && instanceArray <= _rightEdge; } - @Override public org.drip.spaces.tensor.Cardinality cardinality() + /** + * Retrieve the Cardinality of the Vector Space + * + * @return Cardinality of the Vector Space + */ + + @Override public Cardinality cardinality() { - return org.drip.spaces.tensor.Cardinality.UncountablyInfinite(); + return Cardinality.UncountablyInfinite(); } + /** + * Compare against the "Other" Generalized Vector Space + * + * @param generalizedVectorOther The "Other" Generalized Vector Space + * + * @return TRUE - The "Other" Generalized Vector Space matches this + */ + @Override public boolean match ( - final org.drip.spaces.tensor.GeneralizedVector gvOther) + final GeneralizedVector generalizedVectorOther) { - if (null == gvOther || !(gvOther instanceof R1ContinuousVector)) return false; + if (null == generalizedVectorOther || !(generalizedVectorOther instanceof R1ContinuousVector)) { + return false; + } - R1ContinuousVector r1cvOther = (R1ContinuousVector) gvOther; + R1ContinuousVector r1ContinuousVectorOther = (R1ContinuousVector) generalizedVectorOther; - return r1cvOther.leftEdge() == _dblLeftEdge && r1cvOther.rightEdge() == _dblRightEdge; + return r1ContinuousVectorOther.leftEdge() == _leftEdge && + r1ContinuousVectorOther.rightEdge() == _rightEdge; } + /** + * Indicate if the "Other" Generalized Vector Space is a Subset of "this" + * + * @param generalizedVectorOther The "Other" Generalized Vector Space + * + * @return TRUE - The "Other" Generalized Vector Space is a Subset of this + */ + @Override public boolean subset ( - final org.drip.spaces.tensor.GeneralizedVector gvOther) + final GeneralizedVector generalizedVectorOther) { - if (null == gvOther || !(gvOther instanceof R1ContinuousVector)) return false; + if (null == generalizedVectorOther || !(generalizedVectorOther instanceof R1ContinuousVector)) { + return false; + } - R1ContinuousVector r1cvOther = (R1ContinuousVector) gvOther; + R1ContinuousVector r1ContinuousVectorOther = (R1ContinuousVector) generalizedVectorOther; - return r1cvOther.leftEdge() >= _dblLeftEdge && r1cvOther.rightEdge() <= _dblRightEdge; + return r1ContinuousVectorOther.leftEdge() >= _leftEdge && + r1ContinuousVectorOther.rightEdge() <= _rightEdge; } + /** + * Indicate if the Predictor Variate Space is bounded from the Left and the Right + * + * @return The Predictor Variate Space is bounded from the Left and the Right + */ + @Override public boolean isPredictorBounded() { - return leftEdge() != java.lang.Double.NEGATIVE_INFINITY && rightEdge() != - java.lang.Double.POSITIVE_INFINITY; + return Double.NEGATIVE_INFINITY != leftEdge() && Double.POSITIVE_INFINITY != rightEdge(); } + /** + * Retrieve the "Hyper" Volume of the Vector Space + * + * @return The "Hyper" Volume of the Vector Space + * + * @throws Exception Thrown if the Hyper Volume cannot be computed + */ + @Override public double hyperVolume() - throws java.lang.Exception + throws Exception { - if (!isPredictorBounded()) - throw new java.lang.Exception ("R1ContinuousVector::hyperVolume => Space not Bounded"); + if (!isPredictorBounded()) { + throw new Exception ("R1ContinuousVector::hyperVolume => Space not Bounded"); + } - return _dblRightEdge - _dblLeftEdge; + return _rightEdge - _leftEdge; } } diff --git a/src/main/java/org/drip/spaces/tensor/RdCombinatorialVector.java b/src/main/java/org/drip/spaces/tensor/RdCombinatorialVector.java index 71b69f53b82a..ba350538fee4 100644 --- a/src/main/java/org/drip/spaces/tensor/RdCombinatorialVector.java +++ b/src/main/java/org/drip/spaces/tensor/RdCombinatorialVector.java @@ -87,18 +87,27 @@ /** * RdCombinatorialVector exposes the Normed/Non-normed Discrete Spaces with Rd - * Combinatorial Vector Elements. + * Combinatorial Vector Elements. The Reference we've used is: * + *

* + * + * + * *
* * @@ -116,7 +125,7 @@ public class RdCombinatorialVector { /** - * RdCombinatorialVector Constructor + * RdCombinatorialVector Constructor * * @param r1CombinatorialVectorArray Array of the Underlying R1 Combinatorial Vector Spaces * @@ -177,15 +186,15 @@ public RdSpanningCombinatorialIterator iterator() @Override public double[] leftDimensionEdge() { - org.drip.spaces.tensor.R1GeneralizedVector[] aR1GV = vectorSpaces(); + R1GeneralizedVector[] r1GeneralizedVectorArray = vectorSpaces(); - int iDimension = aR1GV.length; - double[] adblLeftEdge = new double[iDimension]; + double[] leftEdgeArray = new double[r1GeneralizedVectorArray.length]; - for (int i = 0; i < iDimension; ++i) - adblLeftEdge[i] = ((org.drip.spaces.tensor.R1ContinuousVector) aR1GV[i]).leftEdge(); + for (int i = 0; i < r1GeneralizedVectorArray.length; ++i) { + leftEdgeArray[i] = ((R1ContinuousVector) r1GeneralizedVectorArray[i]).leftEdge(); + } - return adblLeftEdge; + return leftEdgeArray; } /** @@ -196,15 +205,15 @@ public RdSpanningCombinatorialIterator iterator() @Override public double[] rightDimensionEdge() { - org.drip.spaces.tensor.R1GeneralizedVector[] aR1GV = vectorSpaces(); + R1GeneralizedVector[] r1GeneralizedVectorArray = vectorSpaces(); - int iDimension = aR1GV.length; - double[] adblRightEdge = new double[iDimension]; + double[] rightEdgeArray = new double[r1GeneralizedVectorArray.length]; - for (int i = 0; i < iDimension; ++i) - adblRightEdge[i] = ((org.drip.spaces.tensor.R1ContinuousVector) aR1GV[i]).rightEdge(); + for (int i = 0; i < r1GeneralizedVectorArray.length; ++i) { + rightEdgeArray[i] = ((R1ContinuousVector) r1GeneralizedVectorArray[i]).rightEdge(); + } - return adblRightEdge; + return rightEdgeArray; } /** @@ -215,16 +224,17 @@ public RdSpanningCombinatorialIterator iterator() @Override public double leftEdge() { - double[] adblLeftEdge = leftDimensionEdge(); + double[] leftEdgeArray = leftDimensionEdge(); - int iDimension = adblLeftEdge.length; - double dblLeftEdge = adblLeftEdge[0]; + double leftEdge = leftEdgeArray[0]; - for (int i = 1; i < iDimension; ++i) { - if (dblLeftEdge > adblLeftEdge[i]) dblLeftEdge = adblLeftEdge[i]; + for (int i = 1; i < leftEdgeArray.length; ++i) { + if (leftEdge > leftEdgeArray[i]) { + leftEdge = leftEdgeArray[i]; + } } - return dblLeftEdge; + return leftEdge; } /** @@ -235,16 +245,17 @@ public RdSpanningCombinatorialIterator iterator() @Override public double rightEdge() { - double[] adblRightEdge = rightDimensionEdge(); + double[] rightEdgeArray = rightDimensionEdge(); - int iDimension = adblRightEdge.length; - double dblRightEdge = adblRightEdge[0]; + double rightEdge = rightEdgeArray[0]; - for (int i = 1; i < iDimension; ++i) { - if (dblRightEdge < adblRightEdge[i]) dblRightEdge = adblRightEdge[i]; + for (int i = 1; i < rightEdgeArray.length; ++i) { + if (rightEdge < rightEdgeArray[i]) { + rightEdge = rightEdgeArray[i]; + } } - return dblRightEdge; + return rightEdge; } /** @@ -256,21 +267,22 @@ public RdSpanningCombinatorialIterator iterator() */ @Override public double hyperVolume() - throws java.lang.Exception + throws Exception { - if (!isPredictorBounded()) - throw new java.lang.Exception ("RdCombinatorialVector::hyperVolume => Space not Bounded"); + if (!isPredictorBounded()) { + throw new Exception ("RdCombinatorialVector::hyperVolume => Space not Bounded"); + } - double[] adblLeftEdge = leftDimensionEdge(); + double hyperVolume = 1.; - double dblHyperVolume = 1.; - int iDimension = adblLeftEdge.length; + double[] leftEdgeArray = leftDimensionEdge(); - double[] adblRightEdge = rightDimensionEdge(); + double[] rightEdgeArray = rightDimensionEdge(); - for (int i = 0; i < iDimension; ++i) - dblHyperVolume *= (adblRightEdge[i] - adblLeftEdge[i]); + for (int i = 0; i < leftEdgeArray.length; ++i) { + hyperVolume *= (rightEdgeArray[i] - leftEdgeArray[i]); + } - return dblHyperVolume; + return hyperVolume; } }
Module Computational Core Module