Contents Previous Next Subchapters

Accessing A Subblock Of A Matrix
Syntax matrix.blk(starting rowstarting columnrowscolumns)
See Also base , sequential subvectors

Description
References the subblock with upper-left corner at the specified starting row and column, with the specified number of rows and columns, where starting row, starting column, rows and columns are integer scalars. (If starting row, starting column, rows, or columns, is real, or double-precision, it is interpreted as an integer using the same convention as in the int function. )

Tutorial
If you enter
     x = {[1, 2, 3, 4], [5, 6, 7, 8]}
     x.blk(1, 2, 2, 3)
O-Matrix will respond
     {
     [ 2 , 3 , 4 ]
     [ 6 , 7 , 8 ]
     }


You can also use .blk to assign a submatrix. The result will have the type that corresponds to coercion between the type of the original matrix and the subblock. Continuing the example above
     x.blk(1, 2, 2, 2) = fill(6.6, 2, 2)
     print x
results in
     {
     [ 1 , 6.6 , 6.6 , 4 ]
     [ 5 , 6.6 , 6.6 , 8 ]
     }