@@ -143,7 +143,7 @@ def _quaddist(self, value):
143
143
144
144
def _quaddist_chol (self , delta ):
145
145
chol_cov = self .chol_cov
146
- diag = aet .nlinalg . diag (chol_cov )
146
+ diag = aet .diag (chol_cov )
147
147
# Check if the covariance matrix is positive definite.
148
148
ok = aet .all (diag > 0 )
149
149
# If not, replace the diagonal. We return -inf later, but
@@ -160,7 +160,7 @@ def _quaddist_cov(self, delta):
160
160
161
161
def _quaddist_tau (self , delta ):
162
162
chol_tau = self .chol_tau
163
- diag = aet .nlinalg . diag (chol_tau )
163
+ diag = aet .diag (chol_tau )
164
164
# Check if the precision matrix is positive definite.
165
165
ok = aet .all (diag > 0 )
166
166
# If not, replace the diagonal. We return -inf later, but
@@ -1668,7 +1668,7 @@ class MatrixNormal(Continuous):
1668
1668
1669
1669
# Setup left covariance matrix
1670
1670
scale = pm.Lognormal('scale', mu=np.log(true_scale), sigma=0.5)
1671
- rowcov = aet.nlinalg. diag([scale**(2*i) for i in range(m)])
1671
+ rowcov = aet.diag([scale**(2*i) for i in range(m)])
1672
1672
1673
1673
vals = pm.MatrixNormal('vals', mu=mu, colchol=colchol, rowcov=rowcov,
1674
1674
observed=data, shape=(m, n))
@@ -1813,8 +1813,8 @@ def _trquaddist(self, value):
1813
1813
quaddist = self .solve_upper (colchol_cov .T , quaddist )
1814
1814
trquaddist = aet .nlinalg .trace (quaddist )
1815
1815
1816
- coldiag = aet .nlinalg . diag (colchol_cov )
1817
- rowdiag = aet .nlinalg . diag (rowchol_cov )
1816
+ coldiag = aet .diag (colchol_cov )
1817
+ rowdiag = aet .diag (rowchol_cov )
1818
1818
half_collogdet = aet .sum (aet .log (coldiag )) # logdet(M) = 2*Tr(log(L))
1819
1819
half_rowlogdet = aet .sum (aet .log (rowdiag )) # Using Cholesky: M = L L^T
1820
1820
return trquaddist , half_collogdet , half_rowlogdet
@@ -1958,7 +1958,7 @@ def _setup(self, covs, chols, evds, sigma):
1958
1958
else :
1959
1959
# Otherwise use cholesky as usual
1960
1960
self .chols = list (map (self .cholesky , self .covs ))
1961
- self .chol_diags = list (map (aet .nlinalg . diag , self .chols ))
1961
+ self .chol_diags = list (map (aet .diag , self .chols ))
1962
1962
self .sizes = aet .as_tensor_variable ([chol .shape [0 ] for chol in self .chols ])
1963
1963
self .N = aet .prod (self .sizes )
1964
1964
elif chols is not None :
@@ -1970,7 +1970,7 @@ def _setup(self, covs, chols, evds, sigma):
1970
1970
self ._setup_evd (eigh_map )
1971
1971
else :
1972
1972
self .chols = chols
1973
- self .chol_diags = list (map (aet .nlinalg . diag , self .chols ))
1973
+ self .chol_diags = list (map (aet .diag , self .chols ))
1974
1974
self .sizes = aet .as_tensor_variable ([chol .shape [0 ] for chol in self .chols ])
1975
1975
self .N = aet .prod (self .sizes )
1976
1976
else :
0 commit comments