Skip to content

Commit 3a9b894

Browse files
committed
Looks like it is a bad idea to rotate the mask.
1 parent 4e41cdd commit 3a9b894

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

cfpq_matrix/block/block_matrix.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ def __init__(self, base: OptimizedMatrix, block_matrix_space: BlockMatrixSpace):
3333
super().__init__(base, block_matrix_space)
3434

3535
def mxm(self, other: Matrix, op: Semiring, mask: Matrix, swap_operands: bool = False) -> Matrix:
36-
print ("Self shape")
37-
print (self.shape)
38-
print ("Other shape")
39-
print (other.shape)
4036
if self.block_matrix_space.is_single_cell(other.shape):
4137
return self.base.mxm(other, op, mask, swap_operands=swap_operands)
4238
return self.base.mxm(
@@ -98,11 +94,12 @@ def mxm(self, other: Matrix, op: Semiring, mask:Matrix, swap_operands: bool = Fa
9894
if swap_operands
9995
else BlockMatrixOrientation.VERTICAL
10096
).mxm(other, op, None, swap_operands=swap_operands)
101-
mask = (self.block_matrix_space.hyper_rotate(
102-
mask,
103-
BlockMatrixOrientation.VERTICAL
104-
if swap_operands
105-
else BlockMatrixOrientation.HORIZONTAL)) if not mask is None else mask
97+
mask = None
98+
#(self.block_matrix_space.hyper_rotate(
99+
# mask,
100+
# BlockMatrixOrientation.VERTICAL
101+
# if swap_operands
102+
# else BlockMatrixOrientation.HORIZONTAL)) if not mask is None else mask
106103
return self._force_init_orientation(
107104
BlockMatrixOrientation.VERTICAL
108105
if swap_operands

cfpq_matrix/matrix_to_optimized_adapter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ def to_unoptimized(self) -> Matrix:
3939
def mxm(self, other: Matrix, op: Semiring, mask: Matrix, swap_operands: bool = False) -> Matrix:
4040
if swap_operands:
4141
if not mask is None:
42-
print("Mask applied, swap operands.")
42+
print("Mask applied, swap operands.\n-------\n")
4343
result = Matrix(self.dtype,nrows=other.shape[0],ncols=self.shape[1])
4444
result(~mask.S) << other.mxm(self.base, op).new(self.dtype)
4545
return result
4646
else: return other.mxm(self.base, op).new(self.dtype)
4747
else:
4848
if not mask is None:
49-
print("Mask applied.")
49+
print("Mask applied.\n-------\n")
5050
result = Matrix(self.dtype,nrows=self.shape[0],ncols=other.shape[1])
5151
result(~mask.S) << self.base.mxm(other, op).new(self.dtype)
5252
return result

cfpq_model/label_decomposed_graph.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,6 @@ def mxm(
262262
if swap_operands:
263263
rhs1, rhs2 = rhs2, rhs1
264264
if rhs1 in self.matrices and rhs2 in other.matrices:
265-
266-
if lhs in accum.matrices:
267-
print("Mask shape")
268-
print(accum.matrices[lhs].shape)
269-
270265
matrix_for_mask = max(((accum.matrices[lhs]
271266
if lhs in accum.matrices
272267
else None),
@@ -278,6 +273,12 @@ def mxm(
278273
else None)), key = lambda m: m.nvals if not m is None else -1)
279274
mask = matrix_for_mask if isinstance(matrix_for_mask, Matrix) or matrix_for_mask is None else matrix_for_mask.to_mask()
280275

276+
if not mask is None:
277+
print("Mask shape:")
278+
print(mask.shape)
279+
print ("Mask nnz:")
280+
print(mask.nvals)
281+
281282
mxm = self.matrices[rhs1].mxm(
282283
other.matrices[rhs2],
283284
swap_operands=swap_operands,

0 commit comments

Comments
 (0)