"Fossies" - the Fresh Open Source Software Archive

Member "KASH3-lib-archindep-2008-07-31/lib/matrix.g" (3 Sep 2008, 1291 Bytes) of package /linux/misc/old/KASH3-lib-archindep-2008-07-31.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ################################################################
    2 # easy Matrix
    3 
    4 _Matrix_any := Copy(Matrix);
    5 
    6 _Matrix_list := function(arg)
    7 local R, s, rows, cols;
    8 
    9       rows := Length(arg[1]);
   10       cols := Length(arg[1][1]);
   11       s := Sequence(Flat(arg[1]));
   12       if Size(s) <> rows*cols then
   13         Error("Matrix, all list entries must have the same length.");
   14       fi;
   15       R := Parent(s[1]);
   16       return _Matrix_any(rows, cols, s);
   17 end;
   18 
   19 #Unbind(Matrix);
   20 #InstallMethod(
   21 #rec(
   22 #kind := "FUNCTION",
   23 #name := "Matrix",
   24 #sin := [[nof()]],
   25 #sou := [[elt-alg^mat]],
   26 #short := 
   27 #"Construct a matrix from the given arguments."
   28 #),_Matrix_any);
   29 
   30 InstallMethod(
   31 rec(
   32 kind := "FUNCTION",
   33 name := "Matrix",
   34 sin := [[list,"L"]],
   35 sou := [[elt-alg^mat]],
   36 short := 
   37 "Construct a matrix from the list of lists 'L'.  All list in 'L' "+
   38 "must have the same length.  All elements in these lists must be "+
   39 "coercible into a common coefficient ring."
   40 ),_Matrix_list);
   41 
   42 InstallMethod(
   43 rec(
   44 kind := "FUNCTION",
   45 name := "Matrix",
   46 sin := [[seq(seq()),"L"]],
   47 sou := [[elt-alg^mat]],
   48 short := 
   49 "Construct a matrix from the sequence of sequeces 'L'.  All sequences in 'L' "+
   50 "must have the same length.  All elements in these lists must be "+
   51 "coercible into a common coefficient ring."
   52 ),_Matrix_list);
   53 
   54