Closed TomMaullin closed 2 years ago
Places in the code this could be undertaken:
DinvIplusZtZD
could be split into 4 cases:
DinvIplusZtZD
in the one factor model can be reduced to a running sum of matrices of much smaller dimension (probably using einsum even). Two cases would be of possible speedup:
Ddict
and an einsum)D
need never be constructed in full. This would have to be removed from 3 places:
DinvIplusZtZD
Important: For this to work we must first ensure that the factor is given in increasing order (else pd.get_dummies
in blmm_batch
will give Z in a non-diagonal format.).
Update: In PR #45 , the following use case has now been accounted for in the 3D code:
r=1 and nraneffs[0]=1
, the code does not construct ZtZ
, DinvIplusZtZD
or D
. The case r=1 and nraneffs[0]>1
has not been considered.
For the one factor model, large gains can be made by considering that Z'Z is block diagonal. Ideally it would be nice to account for this and implement speedier computation of D(I+Z'ZD)^(-1) for this use case.