File tree Expand file tree Collapse file tree 1 file changed +5
-15
lines changed
Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -144,21 +144,11 @@ def __call__(self, X):
144144 # (3) Use LAPACK routine TRMM (scipy.linalg.blas.dtrmm)
145145 # I choose to implement (1) and (2), but avoid the LACACK calls for now.
146146
147- if N < K : # Fewer rows (obs) than columns (vars) => left-to-right
148- # Equivalent to: X_n = X_n @ np.linalg.inv(P).T
149- X_n = sp .linalg .solve_triangular (
150- P , X_n .T , lower = True
151- ).T # Removes existing correlations
152-
153- X_n = X_n @ self .P .T # Adds new desired correlations
154-
155- else : # More rows (obs) than columns (vars) => right-to-left
156- transform = sp .linalg .solve_triangular (
157- P .T , self .P .T , lower = False
158- ) # Remove existing + add desired, as one transformation
159- X_n = X_n @ transform
160-
161- return mean + X_n * std
147+ # When it comes to evaluation order (point (1) above), it's better to
148+ # evaluate left-to-right if N < K, and right-to-left if N > K.
149+ # Since N > K (must have rows > columns), we evaluate right-to-left
150+ transform = sp .linalg .solve_triangular (P .T , self .P .T , lower = False )
151+ return mean + X_n @ (transform * std )
162152
163153
164154class ImanConover (Correlator ):
You can’t perform that action at this time.
0 commit comments