| 148 | 148 | |
| 149 | 149 | @property |
| 150 | 150 | def rowblocksizes(self): |
| 151 | return [self.blocks[i, 0].rows for i in range(self.blockshape[0])] | |
| 151 | def _get_rows(block): | |
| 152 | if hasattr(block, 'rows'): | |
| 153 | return block.rows | |
| 154 | elif hasattr(block, 'shape'): | |
| 155 | return block.shape[0] | |
| 156 | else: | |
| 157 | # For scalar objects like Zero, treat as 1x1 | |
| 158 | return 1 | |
| 159 | return [_get_rows(self.blocks[i, 0]) for i in range(self.blockshape[0])] | |
| 152 | 160 | |
| 153 | 161 | @property |
| 154 | 162 | def colblocksizes(self): |
| 155 | return [self.blocks[0, i].cols for i in range(self.blockshape[1])] | |
| 163 | def _get_cols(block): | |
| 164 | if hasattr(block, 'cols'): | |
| 165 | return block.cols | |
| 166 | elif hasattr(block, 'shape'): | |
| 167 | return block.shape[1] | |
| 168 | else: | |
| 169 | # For scalar objects like Zero, treat as 1x1 | |
| 170 | return 1 | |
| 171 | return [_get_cols(self.blocks[0, i]) for i in range(self.blockshape[1])] | |
| 156 | 172 | |
| 157 | 173 | def structurally_equal(self, other): |
| 158 | 174 | return (isinstance(other, BlockMatrix) |
| Test Name | Status |
|---|---|
test_issue_17624 | Fail |
test_zero_matrix_add | Fail |
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.