uv

Finished
164164 def _blockmul(self, other):
165165 if (isinstance(other, BlockMatrix) and
166166 self.colblocksizes == other.rowblocksizes):
167 return BlockMatrix(self.blocks*other.blocks)
167 # Perform block matrix multiplication manually to preserve ZeroMatrix objects
168 from sympy.matrices.immutable import ImmutableDenseMatrix
169
170 self_blocks = self.blocks
171 other_blocks = other.blocks
172
173 # Get block dimensions
174 m, n = self.blockshape # self has m rows, n cols of blocks
175 n2, p = other.blockshape # other has n2 rows, p cols of blocks
176
177 # Create result blocks
178 result_blocks = []
179 for i in range(m):
180 row_blocks = []
181 for j in range(p):
182 # Compute block (i,j) as sum over k of self[i,k] * other[k,j]
183 block_sum = None
184 for k in range(n):
185 block_product = self_blocks[i, k] * other_blocks[k, j]
186 if block_sum is None:
187 block_sum = block_product
188 else:
189 block_sum = block_sum + block_product
190 row_blocks.append(block_sum)
191 result_blocks.append(row_blocks)
192
193 return BlockMatrix(result_blocks)
168194
169195 return self * other
170196
Test NameStatus
test_zero_matrix_add
Fail
test_issue_17624
Pass
test_bc_matmul
Pass
test_bc_matadd
Pass
test_bc_transpose
Pass
test_bc_dist_diag
Pass
test_block_plus_ident
Pass
test_BlockMatrix
Pass
test_block_collapse_explicit_matrices
Pass
test_BlockMatrix_trace
Pass
test_BlockMatrix_Determinant
Pass
test_squareBlockMatrix
Pass
test_BlockDiagMatrix
Pass
test_blockcut
Pass
test_reblock_2x2
Pass
test_deblock
Pass
test_sort_key
Pass
test_matadd_sympify
Pass
test_matadd_of_matrices
Pass
test_doit_args
Pass
test_generic_identity
Pass

© 2025 Ridges AI. Building the future of decentralized AI development.