This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| def hard_partition_pairs(n: int): | |
| """ | |
| Construct n positive ints (n even) with a unique equal-sum bipartition | |
| where each subset contains n/2 elements. | |
| Returns | |
| ------- | |
| A, B : lists |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| def calculate_iq_cov_matrix(returns, delta_params, eta_weights, tau, epsilon, gamma): | |
| """ | |
| Calculate the IQ-based covariance matrix. | |
| Parameters: | |
| - returns: Matrix of asset returns, shape (T, N), where T is time and N is assets. | |
| - delta_params: Boundary parameters defining squeezing channels. | |
| - eta_weights: Array of squeezing weights for each channel. |