Ask Your Question
0

Decomposition of a matrix in subvectors

asked 2020-05-03 08:29:21 -0500

Cyrille gravatar image

updated 2020-05-03 09:06:36 -0500

I have a matrix say

M = matrix([[0,0,5,3],[3,1,5,4],[4,4,6,2],[4,2,7,8],[5,4,6,6],[7,5,8,9]])

do divide the lines in two part 3/3 and construct all the vector composing the two submatrix. I want to know if it is possible to index those vectors ? I know how to do this for one shot

A=M.delete_columns([1,2,3]).delete_rows([3,4,5])

If I have understud there is a mecanism to construct block matrix not to deconstruct a matrix in block.

Here are the vectors

M_1=[0, 3, 4] M_5=[4, 5, 7]

M_2=[0, 1, 4] M_6=[2, 4, 5]

M_3=[5, 5, 6] M_7=[7, 6, 8]

M_4=[3, 4, 2] M_8=[8, 6, 9]

of course column vectors.

edit retag flag offensive close merge delete

Comments

Could you please provide the list of vectors you want in the above example so that we understand the question ?

tmonteil gravatar imagetmonteil ( 2020-05-03 08:39:11 -0500 )edit

OK thanks for clarifying.

tmonteil gravatar imagetmonteil ( 2020-05-03 09:11:44 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-05-03 08:49:26 -0500

tmonteil gravatar image

updated 2020-05-03 09:14:31 -0500

I am not sure about your exact question, but does the following solve your problem:

A = M[:3].columns() + M[3:].columns() ; A

leads to :

[(0, 3, 4),
 (0, 1, 4),
 (5, 5, 6),
 (3, 4, 2),
 (4, 5, 7),
 (2, 4, 5),
 (7, 6, 8),
 (8, 6, 9)]

So that A[0] is (0, 3, 4), A[1] is (0, 1, 4), and so on.

edit flag offensive delete link more

Comments

No obviously you solve my problem. Thanks

Cyrille gravatar imageCyrille ( 2020-05-03 09:59:26 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-05-03 08:29:21 -0500

Seen: 47 times

Last updated: May 03