%mathpiper,def="MatrixRow"

Function("MatrixRow",{matrix,row})
[
  Check(row > 0, "Argument", "MatrixRow: row index out of range");
  Check(row <= Length(matrix), "Argument", "MatrixRow: row index out of range");

  Local(result);
  result:=matrix[row];

  result;
];

%/mathpiper




%mathpiper_docs,name="MatrixRow",categories="User Functions;Linear Algebra"
*CMD MatrixRow --- obtain the row of a matrix
*STD
*CALL
	MatrixRow(matrix,row)

*PARMS
{matrix} -- a matrix
{row} -- the index of a matrix row

*DESC
Returns the row of a matrix which is specified by {row}.

*E.G.
In> A := {{1,2}, {3,4}};
Result: {{1,2},{3,4}}

In> MatrixRow(A,1)
Result: {1,2}

*SEE MatrixColumn
%/mathpiper_docs

    %output,preserve="false"
      
.   %/output

