Skip to content

Commit e5c6a9a

Browse files
committed
Fix some package and variable names; lint
1 parent dd8c86d commit e5c6a9a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pyttb/ktensor.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -889,21 +889,24 @@ def full(self) -> ttb.tensor:
889889
[63. 85.]]
890890
<BLANKLINE>
891891
"""
892+
892893
def min_split_dims(dims):
893894
"""
894895
solve
895896
min_{i in range(1,d)} product(dims[:i]) + product(dims[i:])
896897
to minimize the memory footprint of the intermediate matrix
897898
"""
898-
sum_of_prods = [np.prod(dims[:i])+np.prod(dims[i:])
899-
for i in range(1,len(dims))]
899+
sum_of_prods = [
900+
np.prod(dims[:i]) + np.prod(dims[i:]) for i in range(1, len(dims))
901+
]
900902
i_min = np.argmin(sum_of_prods) + 1 # note range above starts at 1
901903
return i_min
902904

903905
i_split = min_split_dims(self.shape)
904-
data = ( (ttb.khatrirao(*self.factor_matrices[:i_split],reverse=True) * w) @
905-
ttb.khatrirao(*self.factor_matrices[i_split:],reverse=True).T )
906-
return pyttb.tensor(data, self.shape, copy=False)
906+
data = (
907+
ttb.khatrirao(*self.factor_matrices[:i_split], reverse=True) * self.weights
908+
) @ ttb.khatrirao(*self.factor_matrices[i_split:], reverse=True).T
909+
return ttb.tensor(data, self.shape, copy=False)
907910

908911
def innerprod(
909912
self, other: Union[ttb.tensor, ttb.sptensor, ktensor, ttb.ttensor]

0 commit comments

Comments
 (0)