开发者

Matrix Multiplication , Tensor Product of Matrices , Matrix transpose and Sub-Matrices

I already asked a part of this question before, but the topic changed now. It's not homework. I want to find all possible combinations of four basis vectors (dimension = 4), depending on the user input. Repetition should be allowed.

I.e. lets call the vectors 0, 1, 2 and 3.

If the User enters N=3, the combinations can be:

000 001 002 . . . 333

The application should store each combination separately in a (4xN) Matrix. And cout each Matrix.

For example, if:

"0" is associated with the 4x1 Matrix [column-vector] (0,0,0,0)

"1" with (0,0,0,1)

"2" with (0,0,1,0)

"3" with (0,1,0,0)

the possible combination "000" should be stored in the 4x3 Matrix

0 0 0

0 0 0

0 0 0

0 0 0

and this Matrix should be streamed out to the screen.

开发者_运维百科

Moreover the tensor product of every (4x1) Matrix in each of these matrices should be calculated and stored.

In the given example ("x" means tensor product):

0 x 0 x 0

.

.

.

3 x 3 x 3

has to be computed and stored separately, since I also need the transpose of these product-matrices.

Another point is, I have to initialize a 2x2 Sub-Matrix in a given p x 2 Matrix.

For this application, I don't want to use a matrix library and I am looking for a fast and efficient way, because the size of the matrices grows exponentially.

Since I am absolutely new to C++, I have no clue, how to code this without a library. I know, it must be something with the STL Container vector, but I am not familiar with it.

Thanks for your help,

Kepler

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜