a matrix whose some elements are matrixes [message #49282] |
Mon, 10 July 2006 01:19 |
haojuanchina@gmail.co
Messages: 3 Registered: July 2006
|
Junior Member |
|
|
I want obtain a matric whose some elements are matrixes, how to compile
the program?
example: Iwant to abtain the following matrix
G I I I I I 0
I G I 0 0 0 0
I I G I 0 0 0
I 0 I G I 0 0
I 0 0 I G I 0
I 0 0 0 I G I
0 0 0 0 0 I G
in which I is an identity matrix,
1 0 0 0 0 0 0
0 1 0 0 0 0 0
0 0 1 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 1 0 0
0 0 0 0 0 1 0
0 0 0 0 0 0 1
and G is a similar diagonal matrix:
1 -0.25 -0.25 -0.25 -0.25 -0.25 0
-0.25 1 0 0 0 0 0
-0.25 0 1 0 0 0 0
-0.25 0 0 1 0 0 0
-0.25 0 0 0 1 0 0
-0.25 0 0 0 0 1 0
0 0 0 0 0 0 1
I can compile the program of the matrix G:
PRO Matrix
diag =findgen(7)
sub=findgen(6)
super=findgen(6)
diag[0:6]=1
sub[0:5]=-0.25
super[0:5]=-0.25
G = DIAG_MATRIX(diag) + $
DIAG_MATRIX(super, 1) + DIAG_MATRIX(sub, -1)
G[0,1:5]=-0.25
G[1:5,0]=-0.25
print,G
I= DIAG_MATRIX(diag[0:6]);*(-0.25)
print,I
END
but how to get the first matrix in which include the matrix G and I ?
Please give me a help!thanks.
|
|
|