Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gsll
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antonio Juan
gsll
Commits
fdb7a09f
Commit
fdb7a09f
authored
14 years ago
by
Liam Healy
Browse files
Options
Downloads
Patches
Plain Diff
Moved array documentation to GSD
parent
da5b6d2a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
documentation/index.html
+5
-92
5 additions, 92 deletions
documentation/index.html
with
5 additions
and
92 deletions
documentation/index.html
+
5
−
92
View file @
fdb7a09f
...
@@ -277,98 +277,11 @@ GSLL has many functions that work on vectors (one-dimensional arrays)
...
@@ -277,98 +277,11 @@ GSLL has many functions that work on vectors (one-dimensional arrays)
and matrices (two-dimensional arrays). GSLL supports all array
and matrices (two-dimensional arrays). GSLL supports all array
element types that are supported by CFFI, the CL implementation,
element types that are supported by CFFI, the CL implementation,
GSL, and the platform. This list is available in the
GSL, and the platform. This list is available in the
variable
<code>
grid:*array-element-types*
</code>
. On implementations that
variable
<code>
grid:*array-element-types*
</code>
.
support it (currently only SBCL), the contents are directly available
to the GSL functions without copying between the Lisp area and the C
area of memory.
</p>
<p>
<p>
The
<a
href=
"http://repo.or.cz/w/gsd.git"
>
GSD
</a>
suite provides
See the documentation for GSD for more information.
many functions for construction, transformation, and composition of
GSL grid:foreign-arrays. When using grid functions for this purpose,
<h3>
Passing functions
</h3>
the
<code>
grid:specification
</code>
will
contain
<code>
grid:foreign-array
</code>
as the type; for example,
</p>
<pre>
(grid:make-grid '((grid:foreign-array 3 3) double-float) :initial-element 0)
</pre>
<p>
will make a 3x3
<code>
matrix-double-float
</code>
.
The functions that the
<code>
grid
</code>
system provides such
as
<code>
transpose
</code>
as
<code>
subgrid
</code>
, are documented
in that collection.
</p>
<p>
Common Lisp arrays should be created with
<code>
grid:make-foreign-array
</code>
or
<code>
#m
</code>
:
The #m reader macro in the default form creates a vector or matrix of
element type double-float, which is the most common type needed for
GSL functions. It optionally takes a numeric argument prefix as in
the example above to make an array with a different element type; a
guide to the numeric argument is given below. It should be
followed by a list; this list will be evaluated. If the list
contains
<code>
^
</code>
, the object created will be a matrix
and each row is ended with that symbol.
<p>
Classes of vectors and matrices are named by appending the element
type as hypenated words to "vector" or "matrix". The following table
shows the classes available on a 64-bit platform:
<center>
<table
border=
5
frame=
all
cellpadding=
4
cellspacing=
4
cols=
6
>
<caption
align=
top
>
Element types, vector and matrix
classes
</caption>
<thead>
<tr><th><b>
Element type
</b><td><b>
Vector class name
</b>
<td><b>
Matrix class name
</b><td><b>
#m prefix
</b></thead>
<tbody>
<tr><td>
double-float
<td>
vector-double-float
<td>
matrix-double-float
<td>
1 or empty
<tr><td>
(complex double-float)
<td>
vector-complex-double-float
<td>
matrix-complex-double-float
<td>
2
<tr><td>
single-float
<td>
vector-single-float
<td>
matrix-single-float
<td>
3
<tr><td>
(complex single-float)
<td>
vector-complex-single-float
<td>
matrix-complex-single-float
<td>
4
<tr><td>
(signed-byte 8)
<td>
vector-signed-byte-8
<td>
matrix-signed-byte-8
<td>
7
<tr><td>
(unsigned-byte 8)
<td>
vector-unsigned-byte-8
<td>
matrix-unsigned-byte-8
<td>
8
<tr><td>
(signed-byte 16)
<td>
vector-signed-byte-16
<td>
matrix-signed-byte-16
<td>
15
<tr><td>
(unsigned-byte 16)
<td>
vector-unsigned-byte-16
<td>
matrix-unsigned-byte-16
<td>
16
<tr><td>
(signed-byte 32)
<td>
vector-signed-byte-32
<td>
matrix-signed-byte-32
<td>
31
<tr><td>
(unsigned-byte 32)
<td>
vector-unsigned-byte-32
<td>
matrix-unsigned-byte-32
<td>
32
<tr><td>
(signed-byte 64)
<td>
vector-signed-byte-64
<td>
matrix-signed-byte-64
<td>
63
<tr><td>
(unsigned-byte 64)
<td>
vector-unsigned-byte-64
<td>
matrix-unsigned-byte-64
<td>
64
</tbody>
</table>
</center>
<p>
Individual elements are obtained using
<code>
grid:gref
</code>
(analogous
to Lisp's
<code>
aref
</code>
), and are set
with
<code>
setf grid:gref
</code>
. A complete CL array may
be extracted with the function
<code>
#'cl-array
</code>
.
</p>
<p>
Copying grid:foreign-arrays is performed with the function
<code>
copy
</code>
.
This works between grid:foreign-arrays, pointers, and CL arrays. It is useful
for functions intended to be passed to GSL functions (for
e.g. solving, minimizing or fitting) that need to set a GSL vector
or matrix, because one can simply copy into the passed-in pointer.
</p>
<p>
There are two functions provided to extract the dimensions of a
vector or array:
<code>
dim0
</code>
and
<code>
dim1
</code>
; the latter
is applicable only for matrices.
</p>
<p>
If you
use
<a
href=
"http://common-lisp.net/project/iterate/"
>
iterate
</a>
,
there are extensions defined that make it easier to iterate over
grid:foreign-arrays. These are:
<ul>
<li><code>
matrix-row
</code>
,
<code>
matrix-row-index
</code></li>
<li><code>
matrix-column
</code>
,
<code>
matrix-column-index
</code></li>
<li><code>
vector-element
</code>
,
<code>
vector-element-index
</code></li>
<li><code>
matrix-element
</code>
,
<code>
matrix-element-index
</code></li>
</ul>
<p>
For example,
<pre>
(defparameter m1 #m(1 2 3 ^ 0 6 8))
(iter:iter (iter:for e :matrix-element m1) (princ e) (princ " "))
1.0 2.0 3.0 0.0 0.0 6.0 8.0
</pre>
<h3>
Passing functions
</h3>
<p>
<p>
Functions that are passed to GSL functions (known as
<i>
callbacks
</i>
Functions that are passed to GSL functions (known as
<i>
callbacks
</i>
in C) are specified with a
in C) are specified with a
...
@@ -466,7 +379,7 @@ and arrays used internally or for function return.
...
@@ -466,7 +379,7 @@ and arrays used internally or for function return.
<!-- Created: Feb 25 2005 -->
<!-- Created: Feb 25 2005 -->
<!-- hhmts start -->
<!-- hhmts start -->
<small>
<small>
Time-stamp:
<
2010
-0
6-30
2
1
:1
8:34
EDT
index.html
>
Time-stamp:
<
2010
-0
7-18
2
2
:1
3:28
EDT
index.html
>
</small>
</small>
<!-- hhmts end -->
<!-- hhmts end -->
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment