pub struct SymbolCorrelationMatrix {
pub symbols: Vec<String>,
pub matrix: Vec<Vec<f64>>,
pub n: usize,
}Expand description
Full Pearson correlation matrix for a fixed set of symbols.
Constructed from complete return histories; not updated incrementally.
For rolling / streaming use, see RollingCorrelation.
Fields§
§symbols: Vec<String>Symbol labels in order.
matrix: Vec<Vec<f64>>n×n correlation matrix (row-major).
n: usizeDimension (number of symbols).
Implementations§
Source§impl SymbolCorrelationMatrix
impl SymbolCorrelationMatrix
Sourcepub fn from_returns(symbols: Vec<String>, returns: Vec<Vec<f64>>) -> Self
pub fn from_returns(symbols: Vec<String>, returns: Vec<Vec<f64>>) -> Self
Build the Pearson correlation matrix from full return series.
symbols and returns must have the same length; all return slices must also
have the same length (the minimum across series is used).
Sourcepub fn get(&self, i: usize, j: usize) -> f64
pub fn get(&self, i: usize, j: usize) -> f64
Get the correlation between symbols at indices i and j.
Returns all symbol pairs where |correlation| > threshold.
Each entry is (symbol_a, symbol_b, correlation) for i < j.
Sourcepub fn eigenvalues(&self) -> Vec<f64>
pub fn eigenvalues(&self) -> Vec<f64>
Compute eigenvalues of the correlation matrix using the Jacobi sweep algorithm.
Returns eigenvalues in descending order. The Jacobi method iteratively zeroes off-diagonal elements via plane rotations.