Skip to content

block_matrix command should be consistent with the syntax of the matrix command #2429

@jasongrout

Description

@jasongrout

The block matrix command uses a slightly different syntax than the matrix command, leading to confusion. It would be great to fix it so that the following examples would work. Assume that the xi variables below are matrices

sage: # Throw an error if the dimensions of the blocks don't match up correctly.
sage: # explicitly specify the positions of the blocks
sage: block_matrix([[x1,x2],[x3,x4]])
sage: block_matrix([[x1,x2,x3],[x4,x5,x6]])
sage: # dimensions are the numbers of block rows and columns
sage: block_matrix(2,3, [x1,x2,x3,x4,x5,x6])
sage: # coerce the matrix to a specific ring
sage: block_matrix(QQ,2,3,[x1,x2,x3,x4,x5,x6])
sage: # 1 and 0 should still be interpreted as the identity and zero matrices
sage: block_matrix([[x1,1],[1,x2]])
sage: # if only one dimension is given, assume the matrix is square
sage: block_matrix(QQ,2,[x1,x2,x3,x4])
sage: block_matrix(2,[x1,x2,x3,x4])
sage: # the following works now
sage: block_matrix([x1,x2,x3,x4])

CC: @jdemeyer

Component: linear algebra

Reviewer: Willem Jan Palenstijn

Issue created by migration from https://trac.sagemath.org/ticket/2429

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions