[GAP Forum] Boolean matrix

Sara Yaftian sara.yaftian at gmail.com
Wed Mar 2 06:03:19 GMT 2016


Dear GAP Forum

I need a m by n Boolean matrix for saving memory in my works. I know
A:=NullMat(m,n);
is a Null matrix but I need boolean version. I wrote the following code

B:=[];
for i in [1..3] do
Add(B,false);
od;
A:=[B];
for j in [1..3] do
Add(A,B);
od;

this is the output:
gap> A;
[ [ false, false, false ], [ false, false, false ], [ false, false, false
], [ false, false, false ] ]

and I obtained a null Boolean matrix but if I use the following command

A[2][3] := true;

I have the following problem

gap> A;
[ [ false, false, true ], [ false, false, true ], [ false, false, true ], [
false, false, true ] ]

I need just A[2][3] := true not A[i][3].

Would you please help me?

Best regards
Sara


More information about the Forum mailing list