[pure-lang-svn] SF.net SVN: pure-lang:[853] pure/trunk/lib/matrices.pure
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-09-25 07:31:37
|
Revision: 853 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=853&view=rev Author: agraef Date: 2008-09-25 07:31:35 +0000 (Thu, 25 Sep 2008) Log Message: ----------- Bugfixes. Modified Paths: -------------- pure/trunk/lib/matrices.pure Modified: pure/trunk/lib/matrices.pure =================================================================== --- pure/trunk/lib/matrices.pure 2008-09-25 01:02:54 UTC (rev 852) +++ pure/trunk/lib/matrices.pure 2008-09-25 07:31:35 UTC (rev 853) @@ -112,12 +112,14 @@ 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. We - also add some rules to make slicing work with ranges drawn from a matrix - rather than a list. */ + also add some convenience rules to handle matrix ranges as well "mixed" + ranges (ns,ms) where either ns or ms is a singleton. */ x!!ns::matrix = x!!list ns; -x!!(ns::matrix,ms::matrix) - = x!!(list ns,list ms); +x!!(ns::matrix,ms) = x!!(list ns,ms); +x!!(ns,ms::matrix) = x!!(ns,list ms); +x!!(ns::int,ms) = x!!([ns],ms); +x!!(ns,ms::int) = x!!(ns,[ms]); x::matrix!!(ns,ms) = case ns,ms of ns@(n:_),ms@(m:_) = submat x (n,m) (#ns,#ms) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |