@@ -494,7 +494,6 @@ def _varimax(self, loadings):
494494
495495 d = 0
496496 for _ in range (self .max_iter ):
497-
498497 old_d = d
499498
500499 # take inner product of loading matrix
@@ -560,9 +559,9 @@ def _promax(self, loadings):
560559 # pre-normalization is done in R's
561560 # `kaiser()` function when rotate='Promax'.
562561 array = X .copy ()
563- h2 = sp .diag (np .dot (array , array .T ))
562+ h2 = np .diag (np .dot (array , array .T ))
564563 h2 = np .reshape (h2 , (h2 .shape [0 ], 1 ))
565- weights = array / sp .sqrt (h2 )
564+ weights = array / np .sqrt (h2 )
566565
567566 else :
568567 weights = X .copy ()
@@ -576,20 +575,20 @@ def _promax(self, loadings):
576575
577576 # calculate diagonal of inverse square
578577 try :
579- diag_inv = sp .diag (sp .linalg .inv (sp .dot (coef .T , coef )))
578+ diag_inv = np .diag (sp .linalg .inv (np .dot (coef .T , coef )))
580579 except np .linalg .LinAlgError :
581- diag_inv = sp .diag (sp .linalg .pinv (sp .dot (coef .T , coef )))
580+ diag_inv = np .diag (sp .linalg .pinv (np .dot (coef .T , coef )))
582581
583582 # transform and calculate inner products
584- coef = sp .dot (coef , sp .diag (sp .sqrt (diag_inv )))
585- z = sp .dot (X , coef )
583+ coef = np .dot (coef , np .diag (np .sqrt (diag_inv )))
584+ z = np .dot (X , coef )
586585
587586 if self .normalize :
588587 # post-normalization is done in R's
589588 # `kaiser()` function when rotate='Promax'
590- z = z * sp .sqrt (h2 )
589+ z = z * np .sqrt (h2 )
591590
592- rotation_mtx = sp .dot (rotation_mtx , coef )
591+ rotation_mtx = np .dot (rotation_mtx , coef )
593592
594593 coef_inv = np .linalg .inv (coef )
595594 phi = np .dot (coef_inv , coef_inv .T )
0 commit comments