[pure-lang-svn] SF.net SVN: pure-lang:[838] pure/trunk/lib/matrices.pure
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-09-23 10:58:40
|
Revision: 838 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=838&view=rev Author: agraef Date: 2008-09-23 10:58:30 +0000 (Tue, 23 Sep 2008) Log Message: ----------- Make slicing work with matrix ranges. Modified Paths: -------------- pure/trunk/lib/matrices.pure Modified: pure/trunk/lib/matrices.pure =================================================================== --- pure/trunk/lib/matrices.pure 2008-09-23 10:48:11 UTC (rev 837) +++ pure/trunk/lib/matrices.pure 2008-09-23 10:58:30 UTC (rev 838) @@ -92,8 +92,14 @@ former is specified as a list of int values, the latter as a pair of lists of int values. As with list slicing, index ranges may be non-contiguous and/or non-monotonous. However, the case of contiguous and monotonous - ranges is optimized by making good use of the 'submat' operation below. */ + ranges is optimized by making good use of the 'submat' operation below. We + also add some rules to make slicing work with ranges drawn from a matrix + rather than a list. */ +x!!ns::matrix = x!!list ns; +x!!(ns::matrix,ms::matrix) + = x!!(list ns,list ms); + x::matrix!!(ns,ms) = case ns,ms of ns@(n:_),ms@(m:_) = submat x (n,m) (#ns,#ms) if cont ns && cont ms; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |