11# encoding: utf-8 
22
3- # (c) 2019 Open Risk (https://www.openriskmanagement.com) 
3+ # (c) 2019-2022  Open Risk (https://www.openriskmanagement.com) 
44# 
55# correlationMatrix is licensed under the Apache 2.0 license a copy of which is included 
66# in the source distribution of correlationMatrix. This is notwithstanding any licenses of 
1414
1515""" This module provides the key correlation matrix classes 
1616
17- * correlationMatrix_  implements the functionality of single period correlation matrix 
18- * TODO correlationMatrixSet_  provides a container for a multiperiod correlation matrix collection 
17+ * correlationMatrix  implements the functionality of single period correlation matrix 
18+ * TODO correlationMatrixSet  provides a container for a multiperiod correlation matrix collection 
1919* TODO PairwiseCorrelation implements functionality for pairwise data analysis of timeseries 
2020* EmpiricalCorrelationMatrix implements the functionality of a continuously observed correlation matrix 
2121
@@ -260,7 +260,9 @@ def validate(self, accuracy=1e-3):
260260
261261        matrix  =  self .matrix 
262262        # checking squareness of matrix 
263-         if  matrix .shape [0 ] !=  matrix .shape [1 ]:
263+         if  len (matrix .shape ) !=  2 :
264+             validation_messages .append (("Matrix Non Square: " , matrix .shape ))
265+         elif  matrix .shape [0 ] !=  matrix .shape [1 ]:
264266            validation_messages .append (("Matrix Dimensions Differ: " , matrix .shape ))
265267        else :
266268            matrix_size  =  matrix .shape [0 ]
@@ -278,7 +280,7 @@ def validate(self, accuracy=1e-3):
278280                for  j  in  range (matrix_size ):
279281                    if  matrix [i , j ] !=  matrix [j , i ]:
280282                        validation_messages .append (("Symmetry violating value: " , (i , j , matrix [i , j ])))
281-             # checking positive semi-definitess  (non-negative eigenvalues) 
283+             # checking positive semi-definiteness  (non-negative eigenvalues) 
282284            Eigenvalues , Decomposition  =  eigh (matrix )
283285            if  not  np .all (Eigenvalues  >  -  EIGENVALUE_TOLERANCE ):
284286                validation_messages .append (("Matrix is not positive semi-definite" ))
0 commit comments