[clean-list] Matrix operations

John van Groningen johnvg at cs.ru.nl
Mon Jun 10 15:17:02 MEST 2013


On 9-6-2013 1:06, RT Happe wrote:
> Erik Zuurbier wrote:
>> I thought there was once a Clean-library with matrix operations.
>
> That would be Thorsten Zörner's Clean Linear Algebra Subroutines (CLAS),
> maybe to be found somewhere on the web by searching for keywords
> from the related paper; -->
>
> Thorsten H.-G. Zörner and Rinus Plasmeijer:
> Solving Linear Systems with Functional Programming Languages
> http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.33.1815
> http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.33.1815&rep=rep1&type=pdf

The CLAS library and other older versions and libraries can be found at:

ftp://ftp.cs.ru.nl/pub/Clean/

The latest CLAS library is:

ftp://ftp.cs.ru.nl/pub/Clean/supported/CLAS/clas07.zip
ftp://ftp.cs.ru.nl/pub/Clean/supported/CLAS/clas07.tar.gz

or using http:

http://clean.cs.ru.nl/download/supported/CLAS/clas07.zip
http://clean.cs.ru.nl/download/supported/CLAS/clas07.tar.gz

Since Clean 2.3 a unique array element can also be updated in the 
following way (instead of using replace):

   - Updates of unique array elements (since Clean 2.3):

     A unique array element of a (unique) array of unique elements
     can be selected and updated, if the selection (using ![ ]) and
     update (with the same index) occur in the same function and the
     array is not used in between (only the selected element is used).

     For example, below a unique row is selected, updated by inc_a
     and finally the row of the array is updated.

     inc_row :: !*{#*{#Int}} !Int -> *{#*{#Int}};
     inc_row a row_i
       # (row,a) = a![row_i];
         row = inc_a 0 row;
       = {a & [row_i]=row};

     inc_a :: !Int !*{#Int} -> *{#Int};
     inc_a i a
       | i<size a
         # (n,a) = a![i];
           a & [i]=n+1;
         = inc_a (i+1) a;
         = a;

An array with unique elements can only be created using a comprehension,
not with createArray.

Kind regards,

John van Groningen


More information about the clean-list mailing list