# # file: lin.gap # purpose: linear algebra-related GAP stuff # created: pasha jan 19 2005 # modified: pasha feb 15 2005 # modification: cosmetics # # find a kernel of linear mapping f Ker := function (f) local V, W, B, C, A, K, i; V := Source(f); # supposed to be linear spaces defined over the same field W := Range(f); B := Basis(V); C := Basis(W); # matrix of linear mapping A := NullMat (Dimension(V), Dimension(W), LeftActingDomain(V)); for i in [1..Dimension(V)] do A[i] := Coefficients (C, Image (f, B[i])); od; return (SubspaceNC (V, List (NullspaceMat(A), x -> LinearCombination (B, x)), "basis")); end; # end of lin.gap