Skip to content

Commit adab93f

Browse files
committed
An attempt to prepare mask for case S -> A B_i.
1 parent 21d6020 commit adab93f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cfpq_matrix/block/block_matrix.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ def __init__(self, base: OptimizedMatrix, block_matrix_space: BlockMatrixSpace):
3535
def mxm(self, other: Matrix, op: Semiring, mask: Matrix, swap_operands: bool = False) -> Matrix:
3636
if self.block_matrix_space.is_single_cell(other.shape):
3737
return self.base.mxm(other, op, mask, swap_operands=swap_operands)
38+
39+
if not mask is None and self.block_matrix_space.is_single_cell(mask.shape):
40+
mask = self.block_matrix_space.repeat_into_hyper_column(mask)
41+
mask = self.block_matrix_space.hyper_rotate(
42+
mask,
43+
BlockMatrixOrientation.VERTICAL
44+
if swap_operands
45+
else BlockMatrixOrientation.HORIZONTAL
46+
)
47+
3848
return self.base.mxm(
3949
self.block_matrix_space.hyper_rotate(
4050
other,
@@ -43,7 +53,7 @@ def mxm(self, other: Matrix, op: Semiring, mask: Matrix, swap_operands: bool = F
4353
else BlockMatrixOrientation.HORIZONTAL
4454
),
4555
op=op,
46-
mask=None,
56+
mask=mask,
4757
swap_operands=swap_operands,
4858
)
4959

0 commit comments

Comments
 (0)