[GAP Forum] Matrix Operations and saving cpu cycles

Alexander Konovalov alexander.konovalov at gmail.com
Mon Apr 10 16:57:07 BST 2006


Dear Ariel,

You can find information about matrices in the GAP Documentation
available online, in particular, in the GAP Tutorial :

http://www.gap-system.org/Manuals/doc/htm/tut/CHAP003.htm#SECT008

and in the GAP Reference Manual :

http://www.gap-system.org/Manuals/doc/htm/ref/CHAP024.htm

Sum and product of matrices are standard operations in GAP.
If you have matrices m1 and m2, type m1+m2, m1*m2 to get the result:

gap> m1:=[[1,2],[3,-1]];
[ [ 1, 2 ], [ 3, -1 ] ]
gap> m2:=[[-1,2],[4,0]];
[ [ -1, 2 ], [ 4, 0 ] ]
gap> m1+m2;
[ [ 0, 4 ], [ 7, -1 ] ]
gap> m1*m2;
[ [ 7, 2 ], [ -7, 6 ] ]

GAP does not have standard functions to swap rows or columns,
but these operations can be easily described in GAP. Please
let me know if you need more help to implement them.

Let me also add the GAP homepage has also its own search tools
available on the page http://www.gap-system.org/search.html.

Besides this, after you installed GAP, the documentation is
available locally on your computer, and you can use the help system
to find necessary information, in particular, invoking the help from
the GAP session as it is explained on the page
http://www.gap-system.org/Manuals/doc/htm/ref/CHAP002.htm
or view it with HTML browser (starting pages is gap4r4/doc/htm/ 
index.htm).

Best wishes,
Alexander Konovalov


>> Im looking for a way to do simple matrix operations,
>> specifically,
>> swap one row with another &
>> swap one column with another,
>> also sums and product.
>>
>> I do not want to create identity matrices and make de
>> product as this will involve much more CPU resources (i think),
>> im doing this for a bigger proyect and want to save cpu cycles.
>>
>> Googling the gap system site didn't help much, i cant find an
>> easy way to do this. Shall i code my own rutine?
>>
>> Thanks very much
>>
>> Ariel



More information about the Forum mailing list