[pure-lang-svn] SF.net SVN: pure-lang:[801] pure/trunk/lib/primitives.pure
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-09-20 08:20:55
|
Revision: 801 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=801&view=rev Author: agraef Date: 2008-09-20 08:20:26 +0000 (Sat, 20 Sep 2008) Log Message: ----------- Add submatrix operation. Modified Paths: -------------- pure/trunk/lib/primitives.pure Modified: pure/trunk/lib/primitives.pure =================================================================== --- pure/trunk/lib/primitives.pure 2008-09-20 07:56:32 UTC (rev 800) +++ pure/trunk/lib/primitives.pure 2008-09-20 08:20:26 UTC (rev 801) @@ -457,6 +457,11 @@ cols x::matrix = map (col x) (0..m-1) when _,m::int = dim x end; +/* Extract a submatrix of a given size at a given offset. */ + +submat x::matrix (i::int,j::int) (n::int,m::int) + = matrix_slice x i j (i+n) (j+m); + /* Construct matrices from lists of rows and columns. These take either scalars or submatrices as inputs; corresponding dimensions must match. rowcat combines submatrices vertically, like {x;y}; colcat combines them This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |