MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Assignment to submatrices



David E. Cox wrote:
> Is there any way to assign directly to submatrices, without building  a
> higher order tensor?  ie if A and B are 2x2's how do I create the 4x4
> matrix  [0 I2x2; A B].

Dave,

The Add-on LinearAlgebra`MatrixManipulation` does the job.

In[1]:=
A= Array[a,{2,2}];

In[2]:=
B = Array[b,{2,2}];

In[3]:=
I22 =IdentityMatrix[2];

In[4]:=
Z=0 I22;

In[5]:=
<<LinearAlgebra`MatrixManipulation`

In[6]:=
BlockMatrix[{{Z,I22},{A,B}}]//MatrixForm

Out[6]//MatrixForm=
0         0         1         0

0         0         0         1

a[1, 1]   a[1, 2]   b[1, 1]   b[1, 2]

a[2, 1]   a[2, 2]   b[2, 1]   b[2, 2]


-- 
Allan Hayes
Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642




  • Prev by Date: Problem with MathLink !!! Help.
  • Next by Date: Sqrt[a^2 b^2]
  • Prev by thread: Re: Assignment to submatrices
  • Next by thread: How draw 3D Arrows?