################################################################
# easy Matrix

_Matrix_any := Copy(Matrix);

_Matrix_list := function(arg)
local R, s, rows, cols;

      rows := Length(arg[1]);
      cols := Length(arg[1][1]);
      s := Sequence(Flat(arg[1]));
      if Size(s) <> rows*cols then
        Error("Matrix, all list entries must have the same length.");
      fi;
      R := Parent(s[1]);
      return _Matrix_any(rows, cols, s);
end;

#Unbind(Matrix);
#InstallMethod(
#rec(
#kind := "FUNCTION",
#name := "Matrix",
#sin := [[nof()]],
#sou := [[elt-alg^mat]],
#short := 
#"Construct a matrix from the given arguments."
#),_Matrix_any);

InstallMethod(
rec(
kind := "FUNCTION",
name := "Matrix",
sin := [[list,"L"]],
sou := [[elt-alg^mat]],
short := 
"Construct a matrix from the list of lists 'L'.  All list in 'L' "+
"must have the same length.  All elements in these lists must be "+
"coercible into a common coefficient ring."
),_Matrix_list);

InstallMethod(
rec(
kind := "FUNCTION",
name := "Matrix",
sin := [[seq(seq()),"L"]],
sou := [[elt-alg^mat]],
short := 
"Construct a matrix from the sequence of sequeces 'L'.  All sequences in 'L' "+
"must have the same length.  All elements in these lists must be "+
"coercible into a common coefficient ring."
),_Matrix_list);


