[GAP Forum] block matrix

Luca Giuzzi giuzzi at dmf.unicatt.it
Wed Jun 8 10:25:22 BST 2005


On Tue, Jun 07, 2005 at 11:39:53PM -0400, Vahid Dabbaghian-Abdoly wrote:
> Dear GAP Forum,
> 
> I am want to construct a diagonal block matrix such that the 
> diagonal entries have different dimensions.
> Is there any function or method for such a matrix in GAP?
> 
> Best regards, Vahid
> 
> 
There is no such function I am aware of in GAP ...
(I actually got this snippet from somebody on the mailing list some time
ago)
However, I have been using the following: 

BuildMatrix:=function(A,B,C,D)
  return Concatenation(
     List([1..Length(A)],i->Concatenation(A[i],B[i])),
     List([1..Length(C)],i->Concatenation(C[i],D[i])));
end;


This provides you with a block matrix of the form

[[ A, B],
 [ C, D ]];


In order to get just a block diagonal matrix from A and B
you sohould be able to use the following

BlockDiagonal:=function(A,B)
 local _t1, _t2;
 _t1 := A[1][1]*NullMat(Length(TransposedMat(A)[1]),Length(B[1]));
 _t2 := B[1][1]*NullMat(Length(TransposedMat(B)[1]),Length(A[1]));
 return BuildMatrix (A,_t1,_t2,B);
end;;

Best regards,
 lg

> 
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
> 

-- 




More information about the Forum mailing list