[pure-lang-svn] SF.net SVN: pure-lang:[852] pure/trunk/NEWS
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-09-25 01:03:04
|
Revision: 852 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=852&view=rev Author: agraef Date: 2008-09-25 01:02:54 +0000 (Thu, 25 Sep 2008) Log Message: ----------- Updated NEWS. Modified Paths: -------------- pure/trunk/NEWS Modified: pure/trunk/NEWS =================================================================== --- pure/trunk/NEWS 2008-09-25 00:55:11 UTC (rev 851) +++ pure/trunk/NEWS 2008-09-25 01:02:54 UTC (rev 852) @@ -2,59 +2,38 @@ ** Pure 0.7 (in progress) Basic GSL (GNU Scientific Library) matrix support has been implemented, -including matrix comprehensions. Here's some preliminary documentation (at the -time of this writing, the manual still needs to be updated). For more -information on GSL please refer to http://www.gnu.org/software/gsl. +including matrix comprehensions. Here's a brief overview of the new features. +For more information on GSL please refer to http://www.gnu.org/software/gsl. GSL double, complex and integer matrices can be created with the new {x,y;u,v} syntax, which works more or less like Octave/MATLAB matrices, but using curly braces instead of brackets. Also, indices are zero-based (rather than -one-based) to be consistent with Pure's list and tuple structures. +one-based) to be consistent with Pure's list and tuple structures. Here are +some simple examples of matrices: -Here are some simple examples of matrices: - - {1,2,3} a row vector consisting of machine ints - {1.0;2.0;3.0} a column vector of double values (';' separates rows) - {1,2;3,4} a 2x2 int matrix -- {1L,y+1;foo,bar} a "symbolic" matrix (see explanation below) +- {1L,y+1;foo,bar} a symbolic matrix -Note that the {...} syntax can be used only on the right-hand side of a -definition to construct new matrices. Matrix patterns are not supported. -However, the new 'matrix' type tag can be used in patterns to match matrix -values, e.g.: - -foo a::matrix = {a!(i,j)+1 | i=0..n-1; j=0..m-1} when n,m = dim a end; - -(Additional predicates to check for the different subtypes of matrices are -available in the prelude.) - -As mentioned above, there's also a special built-in type of "symbolic" -matrices. These work like the numeric matrices, but can contain an arbitrary -mixture of Pure values, and also work if GSL support isn't available. - -GSL matrices are always homogeneous, i.e., they only contain values from one +Symbolic matrices work like the numeric matrices, but can contain an arbitrary +mixture of Pure values, and also work if GSL support isn't available. GSL +matrices are always homogeneous, i.e., they only contain values from one numeric type, which in the Pure implementation can be machine ints, double and -complex double values. (The latter are represented using Pure's infix notation -for complex values defined in math.pure; this requires math.pure to be -loaded. The same notation is also used to print complex matrices. Note that, -for performance reasons, the expression printer doesn't use the __show__ -function to print individual matrix elements. It is possible to override the -default print representation of matrix values as a whole, though.) +complex double values. If a matrix contains values of different types, or Pure +values which cannot be stored in a GSL matrix, then a symbolic matrix is +created instead (this also includes the case of bigints, which are considered +as symbolic values as far as matrix construction is concerned). If the +interpreter was built without GSL support then symbolic matrices are the only +kind of matrices supported by the interpreter. -If a matrix contains values of different types, or Pure values which cannot be -stored in a GSL matrix, then a symbolic matrix is created instead (this also -includes the case of bigints, which are considered as symbolic values as far -as matrix construction is concerned). If the interpreter was built without GSL -support then symbolic matrices are the only kind of matrices supported by the -interpreter. - Pure also provides so-called matrix comprehensions as a convenient means to create matrices from a template expression (which can denote either a scalar or a submatrix), drawing values from lists and (optionally) filtering the elements with predicates. These work pretty much like list comprehensions, but return matrices instead of lists. Generator clauses in matrix comprehensions -alternate between row and column generation so that most common mathematical -abbreviations carry over quite easily. E.g., here's a simple example which +alternate between row and column generation so that customary mathematical +notation carries over quite easily. E.g., here's a simple example which illustrates how you can define a function which returns a square identity matrix of a given dimension: @@ -70,7 +49,7 @@ and inspect Pure matrix values from external C modules. Moreover, the 'pointer' function in the prelude can be used to convert matrices to Pure pointer values, and marshalling of GSL matrices in the C interface is also -available. +provided. Here is a brief synopsis of some important operations which are implemented in the prelude (you can find the definitions of these and a bunch of other matrix @@ -84,7 +63,9 @@ - x!!is, x!!(is,js) slicing (is and js are lists of machine ints) - x==y, x!=y matrix comparisons -Adding other operations by interfacing to GSL should be a piece of cake. +Adding other operations by interfacing to GSL should be a piece of cake. In +fact, we plan to provide a comprehensive Pure interface to GSL as a separate +library in the future. Other user-visible changes prompted by the introduction of the matrix syntax are listed below: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |