This is the dense-arrays Reference Manual, version 0.3.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Nov 06 13:10:44 2023 GMT+0.
dense-arrays/dense-arrays.asd
dense-arrays/src/package.lisp
dense-arrays/src/protocol.lisp
dense-arrays/src/types.lisp
dense-arrays/src/dense-arrays.lisp
dense-arrays/src/broadcast.lisp
dense-arrays/src/do-arrays.lisp
dense-arrays/src/argwhere.lisp
dense-arrays/src/aref.lisp
dense-arrays/src/copy.lisp
dense-arrays/src/unupgraded.lisp
dense-arrays/optim/misc.lisp
dense-arrays/optim/aref.lisp
dense-arrays/optim/unupgraded.lisp
The main system appears first, followed by any subsystem dependency.
dense-arrays
Numpy like array objects for Common Lisp
Shubhamkar B. Ayare
MIT
0.3.0
asdf-system-connections
(system).
abstract-arrays
(system).
polymorphic-functions
(system).
alexandria
(system).
compiler-macro-notes
(system).
closer-mop
(system).
extensible-compound-types
(system).
extensible-compound-types-cl
(system)., for feature :extensible-compound-types
fiveam
(system).
iterate
(system).
trivial-garbage
(system).
cl-form-types
(system).
trivial-types
(system).
uiop
(system).
Modules are listed depth-first from the system components tree.
dense-arrays/src
dense-arrays
(system).
package.lisp
(file).
protocol.lisp
(file).
types.lisp
(file).
dense-arrays.lisp
(file).
broadcast.lisp
(file).
do-arrays.lisp
(file).
argwhere.lisp
(file).
aref.lisp
(file).
copy.lisp
(file).
unupgraded.lisp
(file).
dense-arrays/optim
src
(module).
dense-arrays
(system).
misc.lisp
(file).
aref.lisp
(file).
unupgraded.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
dense-arrays/dense-arrays.asd
dense-arrays/src/package.lisp
dense-arrays/src/protocol.lisp
dense-arrays/src/types.lisp
dense-arrays/src/dense-arrays.lisp
dense-arrays/src/broadcast.lisp
dense-arrays/src/do-arrays.lisp
dense-arrays/src/argwhere.lisp
dense-arrays/src/aref.lisp
dense-arrays/src/copy.lisp
dense-arrays/src/unupgraded.lisp
dense-arrays/optim/misc.lisp
dense-arrays/optim/aref.lisp
dense-arrays/optim/unupgraded.lisp
dense-arrays/src/package.lisp
src
(module).
*array-element-type*
(special variable).
*array-element-type-alist*
(special variable).
*array-layout*
(special variable).
default-element-type
(symbol macro).
int-index
(type).
int32
(type).
int64
(type).
package-local-element-type
(symbol macro).
size
(type).
the-int-index
(macro).
the-size
(macro).
uint32
(type).
uint64
(type).
dense-arrays/src/protocol.lisp
package.lisp
(file).
src
(module).
*dense-array-class*
(special variable).
standard-dense-array
(class).
standard-dense-array-class
(class).
storage-accessor
(generic function).
storage-allocator
(generic function).
storage-deallocator
(generic function).
storage-element-type-upgrader
(generic function).
storage-type-inferrer-from-array-type
(generic function).
cl-aref
(compiler macro).
(setf cl-aref)
(compiler macro).
cl-aref
(function).
(setf cl-aref)
(function).
dense-array
(class).
dense-array-class
(class).
dense-array-layout
(function).
dense-array-offsets
(function).
dense-array-root-array
(function).
dense-array-strides
(function).
dense-arrays/src/types.lisp
protocol.lisp
(file).
src
(module).
array
(type).
simple-array
(type).
%dense-array
(type).
define-dense-array-types
(macro).
dense-array-type-element-type
(function).
simple-dense-array
(type).
simple-dense-array-p
(function).
dense-arrays/src/dense-arrays.lisp
types.lisp
(file).
src
(module).
*array-element-print-format*
(special variable).
array-displaced-to
(function).
array-displacement
(function).
array-layout
(function).
array-offset
(function).
array-offsets
(function).
array-stride
(function).
array-strides
(function).
make-array
(function).
print-array
(function).
print-object
(method).
1d-storage-array
(function).
array-displaced-index-offset
(function).
array-view-p
(function).
assert-type
(compiler macro).
assert-type
(function).
axis-number
(reader method).
(setf axis-number)
(writer method).
collect-reduce-from-end
(function).
dimensions->strides
(function).
ensure-single
(macro).
pretty-print-number
(function).
print-lines-exhausted
(condition).
dense-arrays/src/broadcast.lisp
dense-arrays.lisp
(file).
src
(module).
broadcast-array
(function).
broadcast-arrays
(function).
broadcast-compatible-p
(function).
%broadcast-compatible-p
(function).
dense-arrays/src/do-arrays.lisp
broadcast.lisp
(file).
src
(module).
do-arrays
(macro).
define-macro-helper
(macro).
destructuring-lists
(macro).
do-arrays/element-type-failure
(condition).
expand-do-arrays-with-rank
(function).
expand-do-arrays-without-rank
(function).
lm
(macro).
map-collect
(macro).
dense-arrays/src/argwhere.lisp
do-arrays.lisp
(file).
src
(module).
dense-arrays/src/aref.lisp
argwhere.lisp
(file).
src
(module).
aref*
(function).
(setf aref*)
(function).
array=
(function).
%aref
(function).
(setf %aref)
(function).
%aref-view
(function).
(setf %aref-view)
(function).
da-ref
(function).
index
(reader method).
(setf index)
(writer method).
invalid-array-index-for-axis
(condition).
invalid-index
(condition).
normalize-index
(function).
dense-arrays/src/copy.lisp
aref.lisp
(file).
src
(module).
copy-array
(function).
dense-arrays/src/unupgraded.lisp
copy.lisp
(file).
src
(module).
simple-unupgraded-array
(type).
storage-element-type-upgrader
(method).
unupgraded-array
(type).
unupgraded-dense-array
(class).
unupgraded-dense-array-class
(class).
dense-arrays/optim/misc.lisp
optim
(module).
dense-array-type-class
(function).
backend-failure
(condition).
element-type-failure
(condition).
form
(reader method).
form-type
(reader method).
primary-form-type
(function).
rank-failure
(condition).
slot
(reader method).
slot-type-failure
(condition).
dense-arrays/optim/aref.lisp
misc.lisp
(file).
optim
(module).
array=
(compiler macro).
Packages are listed by definition order.
dense-arrays
alexandria
.
common-lisp
.
it.bese.fiveam
.
iterate
.
polymorphic-functions
.
*array-element-print-format*
(special variable).
*array-element-type*
(special variable).
*array-element-type-alist*
(special variable).
*array-layout*
(special variable).
*dense-array-class*
(special variable).
aref*
(function).
(setf aref*)
(function).
array
(type).
array-displaced-to
(function).
array-displacement
(function).
array-layout
(function).
array-offset
(function).
array-offsets
(function).
array-stride
(function).
array-strides
(function).
array=
(compiler macro).
array=
(function).
broadcast-array
(function).
broadcast-arrays
(function).
broadcast-compatible-p
(function).
copy-array
(function).
dense-array-type-class
(function).
do-arrays
(macro).
make-array
(function).
print-array
(function).
simple-array
(type).
simple-unupgraded-array
(type).
standard-dense-array
(class).
standard-dense-array-class
(class).
storage-accessor
(generic function).
storage-allocator
(generic function).
storage-deallocator
(generic function).
storage-element-type-upgrader
(generic function).
storage-type-inferrer-from-array-type
(generic function).
unupgraded-array
(type).
unupgraded-dense-array
(class).
%aref
(function).
(setf %aref)
(function).
%aref-view
(function).
(setf %aref-view)
(function).
%broadcast-compatible-p
(function).
%dense-array
(type).
1d-storage-array
(function).
argwhere
(function).
array-displaced-index-offset
(function).
array-view-p
(function).
assert-type
(compiler macro).
assert-type
(function).
axis-number
(generic reader).
(setf axis-number)
(generic writer).
backend-failure
(condition).
cl-aref
(compiler macro).
(setf cl-aref)
(compiler macro).
cl-aref
(function).
(setf cl-aref)
(function).
collect-reduce-from-end
(function).
da-ref
(function).
default-element-type
(symbol macro).
define-dense-array-types
(macro).
define-macro-helper
(macro).
dense-array
(class).
dense-array-class
(class).
dense-array-layout
(function).
dense-array-offsets
(function).
dense-array-root-array
(function).
dense-array-strides
(function).
dense-array-type-element-type
(function).
destructuring-lists
(macro).
dimensions->strides
(function).
do-arrays/element-type-failure
(condition).
element-type-failure
(condition).
ensure-single
(macro).
expand-do-arrays-with-rank
(function).
expand-do-arrays-without-rank
(function).
form
(generic reader).
form-type
(generic reader).
index
(generic reader).
(setf index)
(generic writer).
int-index
(type).
int32
(type).
int64
(type).
invalid-array-index-for-axis
(condition).
invalid-index
(condition).
lm
(macro).
map-collect
(macro).
nonzero
(function).
normalize-index
(function).
package-local-element-type
(symbol macro).
pretty-print-number
(function).
primary-form-type
(function).
print-lines-exhausted
(condition).
rank-failure
(condition).
simple-dense-array
(type).
simple-dense-array-p
(function).
size
(type).
slot
(generic reader).
slot-type-failure
(condition).
the-int-index
(macro).
the-size
(macro).
uint32
(type).
uint64
(type).
unupgraded-dense-array-class
(class).
Definitions are sorted by export status, category, package, and then by lexicographic order.
The format control string used to print the elements of DENSE-ARRAYS:ARRAY.
It is possible to set this value to "~/USER-DEFINED-FUNCTION/" where
USER-DEFINED-FUNCTION should accept at least four arguments.
Also see:
- https://en.wikipedia.org/wiki/Format_(Common_Lisp)
- http://www.gigamonkeys.com/book/a-few-format-recipes.html
If BOUND, this is the default value of the ELEMENT-TYPE or TYPE argument.
Overrides *ARRAY-ELEMENT-TYPE-ALIST*.
Is overriden by explicitly passing an ELEMENT-TYPE or TYPE argument.
An ALIST mapping package to the default element-type used in that package.
(Inspired from SWANK:*READTABLE-ALIST*)
Overrides none.
Is overriden by *ARRAY-ELEMENT-TYPE* when bound, or by explicitly passing an
ELEMENT-TYPE or TYPE argument.
Specifies the default layout constructed by DENSE-ARRAYS:MAKE-ARRAY and constructor functions like ASARRAY, ZEROS, ONES, etc in the DENSE-ARRAYS-PLUS-LITE package.
Specifies the default value of CLASS in DENSE-ARRAYS:MAKE-ARRAY and other functions. (TODO: Specify these other functions.)
Traverses the arrays in row-major order.
If the first argument RANK/BINDINGS is of type SIZE, it’d be treated as the rank of the arrays. Then, the BINDINGS are assumed to be the first element of the BODY.
Otherwise, the first argument is treated as if they are BINDINGS.
Each BINDING is of the form
(ELT-VAR ARRAY &OPTIONAL (ELEMENT-TYPE *) &KEY (CLASS-NAME *DENSE-ARRAY-CLASS*))
Here, only ARRAY is evaluated.
Examples
(let ((a (make-array ’(2 3)))
(b (make-array ’(2 3))))
(do-arrays ((c a t)
(d b t))
(print (list c d))))
(let ((a (make-array ’(2 3)))
(b (make-array ’(2 3))))
(do-arrays 2 ((c a t) ; The 2 indicates the rank of the arrays
(d b t))
(print (list c d))))
Either of the two cases might be faster depending on the number of dimensions.
Accessor function for DENSE-ARRAYS::DENSE-ARRAY with semantics
intended to be similar to numpy’s indexing semantics.
See https://numpy.org/doc/stable/user/basics.indexing.html
Each element of SUBSCRIPTS can be
- either an integer denoting the position within the axis which is to be indexed
- or a list of the form (&OPTIONAL START &KEY END STEP) with each of START END
STEP being integers if supplied. START denotes the start position within the
axis, END denotes the ending position within the axis, STEP denotes at what
distance within the axis the next element should come after the previous,
starting from START
Each of the SUBSCRIPTS, START, END, STEP can also be negative integers, in which
case the last element along the axis is given the index -1, the second last is
given the index -2 and so on. Thus, ‘(aref ... ’(-1 :step -1))‘ can reverse a one
dimensional array.
Like, CL:AREF or ABSTRACT-ARRAYS:AREF, returns the element corresponding to SUBSCRIPTS
if all the subscripts are integers and there as many subscripts
as the rank of the array.
If the number (aka length) of SUBSCRIPTS were less than the array’s rank, or
if some of the SUBSCRIPTS were lists described above, then returns a VIEW
of the arrays. A VIEW is a window into the original array and thus
avoids copying the elements of the original array.
Examples illustrating the numpy-equivalent indexes:
a[::] (aref a nil)
a[::2] (aref a ’(0 :step 2))
a[3, ::-1] (aref a 3 ’(-1 :step -1))
a[3::, -1] (aref a ’(3) -1)
The SUBSCRIPTS can also be integer or boolean arrays, denoting which elements
to select from each of the axes. But in this case the corresponding elements
of the array are copied over into a new array.
Returns two values:
- ARRAY-STORAGE
- and OFFSET along first axis
Consequences are undefined if ARRAY is displaced along multiple axis.
Return the length of offset corresponding to AXIS-NUMBER of ARRAY.
Return the length of stride corresponding to AXIS-NUMBER of ARRAY.
Returns non-NIL if each element of ARRAY1 is equal to each corresponding element of ARRAY2 using TEST, which should be a two-argument function that takes the one element of the first array and the corresponding element of the second and tests for their equality.
Returns two values. The first value is the list of broadcasted arrays if the second value is non-NIL.
Returns two values:
- The first value is a generalized boolean indicating whether the arrays can be broadcasted.
- The second value is the dimension of the array resulting from the broadcast.
The broadcasting semantics are equivalent to numpy semantics. Two arrays are broadcast
compatible, if
- they have the same dimensions, or
- if, for the dimensions they differ, one of the dimension is of length 1, or
- the dimensions of the lower-ranked array matches the rightmost dimensions
of the higher-ranked array
Thus, arrays with the following dimensions are broadcast-compatible:
- (3) (3)
- (3 1) (3 3)
- (3 3) (1 3)
- (3 3) (3)
Arrays with the following dimensions are not compatible:
- (3 1) (3)
See https://numpy.org/doc/stable/user/basics.broadcasting.html for an elaborate discussion.
Returns a copy of ARRAY. Creates a completely new array even if ARRAY is a VIEW (see ARRAY-VIEW-P).
Like CL:MAKE-ARRAY but returns a DENSE-ARRAYS::DENSE-ARRAY instead of CL:ARRAY.
Additionally takes
- LAYOUT argument which can be one of (:ROW-MAJOR :COLUMN-MAJOR NIL)
- CLASS argument which should be a class designator denoting the class to which the
constructed dense array will belong to
- CONSTRUCTOR if supplied should be a function that takes as many arguments
as the number of dimensions aka rank of the array, and return the element that
should correspond to the position indicated by the arguments of the function.
For example:
(make-array ’(2 3) :constructor (lambda (&rest indexes) (cons ’indexes indexes)))
;=> #<STANDARD-DENSE-ARRAY :ROW-MAJOR 2x3 T
((INDEXES 0 0) (INDEXES 0 1) (INDEXES 0 2))
((INDEXES 1 0) (INDEXES 1 1) (INDEXES 1 2))
{10194A2FE3}>
Prints ARRAY as if by CL:PRINT.
Format recipes: http://www.gigamonkeys.com/book/a-few-format-recipes.html.
Returns a SYMBOL that is fbound to an accessor function that takes
(STORAGE INDEX) as arguments and returns the element at INDEX in STORAGE.
The function is an accessor function in the sense that SYMBOL should also be
associated with (SETF SYMBOL) function that takes (NEW-VALUE STORAGE INDEX) as
arguments and sets the STORAGE element at INDEX to NEW-VALUE.
This function is primarily used inside AREF, ROW-MAJOR-AREF and DO-ARRAYS,
and their SETF counterparts.
See src/protocol.lisp and plus/cl-cuda.lisp for reference.
standard-dense-array-class
)) ¶Returns a symbol fbound to a function with signature
(SIZE &KEY ELEMENT-TYPE INITIAL-ELEMENT)
that allocates a VECTOR of length SIZE of ELEMENT-TYPE with each element as
INITIAL-ELEMENT for use as a STORAGE-VECTOR for the ABSTRACT-ARRAY.
standard-dense-array-class
)) ¶Returns either NIL or a symbol fbound to a function to be called
to delete the STORAGE when the ABSTRACT-ARRAY goes out of scope. This function should
take only the STORAGE object as its argument.
Internally, this function plays a role in the finalizer of the garbage collection
using TRIVIAL-GARBAGE.
See plus/static-vectors.lisp and the DENSE-ARRAYS:MAKE-ARRAY function for reference.
standard-dense-array-class
)) ¶Equivalent to the CL:UPGRADED-ARRAY-ELEMENT-TYPE, this returns a function
that takes a single argument element-type as input and returns the upgraded
array element type for the array class given by CLASS used for STORAGE.
The upgraded array element type is then stored in the dense-array object and
used for other tasks downstream.
See plus/cl-cuda.lisp and the DENSE-ARRAYS:MAKE-ARRAY function for reference.
unupgraded-dense-array-class
)) ¶standard-dense-array-class
)) ¶This should return a function that takes as input the ARRAY-TYPE and returns
the possibly specialized type of storage that the corresponding array object
will have. This is primarily used for optimization purposes inside DENSE-ARRAYS:DO-ARRAYS
and the compiler macros of DENSE-ARRAYS:AREF DENSE-ARRAYS:ROW-MAJOR-AREF and SETF
counterparts.
See src/protocol.lisp, plus/cl-cuda.lisp, src/do-arrays.lisp and optim/aref.lisp
for reference.
standard-dense-array-class
)) ¶(map-collect ‘(c ,%1) ’(1 2 3)) ;=> ((C 1) (C 2) (C 3))
Returns a copy of the subscripted array.
Returns a VIEW of the subscripted ARRAY (without copying the contents)
Returns two values:
The first value is a generalized boolean indicating whether the two dimensions are broadcast compatible.
The second value is the dimensions of the array resulting from the broadcast.
Returns the storage-vector underlying the ARRAY. This is equivalent to ARRAY-DISPLACED-TO.
Returns T if the ARRAY is a VIEW, otherwise returns NIL. A VIEW does not
have a known layout, and is useful as a window into certain elements of the larger array.
A VIEW provides a way to obtain sub-arrays or reshapes or transposes out of ARRAY
without copying.
print-lines-exhausted
)) ¶print-lines-exhausted
)) ¶slot-type-failure
)) ¶slot-type-failure
)) ¶invalid-index
)) ¶invalid-index
)) ¶slot-type-failure
)) ¶:class
(quote (quote dense-arrays::backend))
:slot
optimization-failure-note
.
:binding-form
:class
(quote (quote abstract-arrays::element-type))
:slot
error
.
:index
condition
.
:axis-number
:class
(quote (quote abstract-arrays::rank))
:slot
optimization-failure-note
.
- DIMENSIONS is a list of dimensions.
- STRIDES is a list of strides along each dimension.
- OFFSETS is a list of offsets along each dimension.
abstract-array
.
list
(error "strides must be supplied during dense-array initialization")
:strides
(error "offsets must be supplied during dense-array initialization")
:offsets
(member nil :row-major :column-major)
(error "layout must be supplied during dense-array initialization")
:layout
(error "root-array must be supplied during dense-array initialization")
:root-array
abstract-array-class
.
Jump to: | %
(
1
A B C D E F G I L M N P S T |
---|
Jump to: | %
(
1
A B C D E F G I L M N P S T |
---|
Jump to: | *
A B D F I L O P R S V |
---|
Jump to: | *
A B D F I L O P R S V |
---|
Jump to: | %
A B C D E F I M O P R S T U |
---|
Jump to: | %
A B C D E F I M O P R S T U |
---|