The dense-arrays Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The dense-arrays Reference Manual

This is the dense-arrays Reference Manual, version 0.2.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Tue Nov 15 05:35:51 2022 GMT+0.

Table of Contents


1 Introduction

dense-arrays

[Last README update: 5th June 2022. To skip rant, click here.]

Table of Contents

Rant

Quick! Tell me the dimensions of

#2A((0 4 2 1 9 1 5 9 8 8 6 8 2 0 4 0 2 3 6 8 2 6 7 2 6 7 2 7 8 9 6 8 5 6 3 1 5
     5 3 5 0 4 1 4 5 4 3 2 6 1 0 5 2 5 1 6 2 2 3 3 7 9 5 8 2 5 0 5 5 3 8 6 3 7
     9 4 7 3 3 1 3 0 0 0 8 8 4 8 2 5 7 2 5 6 6 1 5 1 5 4 3 1 3 9 7 0 9 8)
    (2 0 0 7 0 5 8 7 2 0 3 1 9 3 3 2 8 5 0 3 1 3 5 6 9 2 9 8 5 2 0 6 4 7 7 2 5
     6 7 8 3 3 6 3 1 7 3 2 8 0 6 5 9 8 7 7 4 5 8 5 4 8 8 1 6 8 0 7 8 7 4 6 3 9
     3 3 0 9 4 9 7 1 0 0 9 6 3 7 4 4 7 7 5 9 5 0 9 2 2 5 1 6 6 6 5 9 8 2)
    (6 5 0 3 7 2 4 0 3 4 9 3 1 9 8 2 4 4 7 2 3 8 3 9 4 4 8 8 7 0 6 2 0 1 9 9 2
     4 7 4 1 4 2 1 4 1 9 7 7 2 9 0 0 6 0 5 1 5 5 2 8 5 8 9 0 1 7 0 8 9 5 0 2 3
     8 5 8 5 2 4 0 9 3 9 4 8 4 8 7 1 8 5 5 4 3 4 0 3 5 7 9 4 2 5 4 7 0 0)
    (8 8 9 6 9 3 6 4 4 2 3 9 4 8 4 1 2 1 0 5 3 0 5 9 4 3 9 7 9 8 8 4 5 3 6 9 9
     0 9 1 8 1 7 5 7 1 8 1 7 2 4 2 4 9 0 9 9 3 8 5 8 8 1 4 9 0 5 8 9 7 5 4 3 4
     1 4 2 9 1 9 8 2 4 5 6 2 0 2 0 0 5 8 5 9 9 4 2 7 7 1 7 5 7 6 2 9 6 2)
    (2 4 9 8 2 7 1 6 0 8 4 2 9 4 6 9 9 4 1 5 1 4 0 1 9 9 0 1 3 8 0 9 7 9 2 3 9
     5 8 0 8 8 1 2 4 9 1 0 5 4 5 4 8 5 7 2 8 1 6 5 5 3 0 9 0 8 8 8 5 0 7 6 7 1
     6 3 8 8 6 9 7 9 9 5 2 1 6 7 5 3 3 9 7 2 4 0 3 8 4 9 7 8 1 5 1 9 1 6)
    (7 7 0 7 9 6 1 5 8 4 2 9 4 9 9 6 6 9 3 3 7 6 1 6 6 6 3 5 5 1 6 7 3 7 6 2 8
     7 3 4 2 4 8 1 3 0 8 3 5 4 7 6 5 6 0 9 5 0 0 7 6 0 9 1 0 0 5 3 1 2 1 0 5 5
     6 2 4 7 5 5 7 7 6 5 1 6 6 1 4 0 9 9 0 2 9 5 4 0 7 1 2 1 3 9 9 7 7 9))

and also the element-type!

CL-USER> (progn
           (print (array-dimensions *))
           (print (array-element-type *)))
(6 108)
T
T

Why do I need to do this every f*cking time? This can't be so annoying. I mean, why do I need to do all that to get something as basic as dimensions and element-type? Like magicl you mean?

#<MAGICL:MATRIX/SINGLE-FLOAT (6x108):
  .
  .
  .
  . >

See how pretty? Well not sarcastically. It is prettier than cl:array indeed, in that I can at least tell the element-type and dimensions at a glance, what more can you need?

(setq *print-length* 10)
#<STANDARD-DENSE-ARRAY :ROW-MAJOR 6x108 T
   (7 6 1 3 7 1 6 5 2 5 ...)
   (8 7 6 9 7 5 5 1 0 0 ...)
   (8 1 7 8 9 0 2 9 5 5 ...)
   (0 5 8 6 2 6 9 2 5 3 ...)
   (4 8 3 4 2 3 2 2 2 5 ...)
   (7 8 2 5 5 3 2 8 6 1 ...)
 {103F4CE453}>

Oh wait!

#<STANDARD-DENSE-ARRAY :ROW-MAJOR 6x108 SINGLE-FLOAT
   (  0.054       7.363       8.527       8.561       7.399       1.875
      0.513       6.690       0.398       0.745     ...)
   (  6.766       7.421       2.419       7.857       8.914       6.637
      8.464       1.052       1.400       3.602     ...)
   (  7.384       6.489       9.426       9.044       6.571       9.431
      6.177       9.389       3.526       4.850     ...)
   (  7.873       6.541       2.272       7.863       7.271       8.398
      7.759       3.428       3.482       7.050     ...)
   (  4.954       9.796       7.450       9.431       2.254       7.741
      5.725       1.729       4.947       4.176     ...)
   (  6.553       4.481       0.159       5.915       4.391       5.940
      1.160       2.071       4.158       8.746     ...)
 {103F81F7B3}>

No, wait!

So that first one is a 6x108 array with element-type T while the second has element-type single-float. And both have row-major layouts. Oh, and we even have their identity in case we want to check whether two objects are the same or just their elements are same!

We could have simply written a nice print-array function, couldn't we? Well, perhaps yes, but perhaps not! What do you mean?

(describe *)
#<STANDARD-DENSE-ARRAY :ROW-MAJOR 6x108 SINGLE-FLOAT {103F81F7B3}>
  [standard-object]

Slots with :INSTANCE allocation:
  STORAGE                        = #(0.05400777 7.363088 8.526753 8.5613365 7.398881 1.8748772 0.5133271..
  DIMENSIONS                     = (6 108)
  ELEMENT-TYPE                   = SINGLE-FLOAT
  RANK                           = 2
  TOTAL-SIZE                     = 648
  STRIDES                        = (108 1)
  OFFSETS                        = (0 0)
  LAYOUT                         = :ROW-MAJOR
  ROOT-ARRAY                     = NIL

Storage, dimensions, element-type, rank, total-size, pretty obvious stuff.

Hmm, strides, offsets, layout, and root array: what... are these? Offsets, I think I know, it sounds like displaced-index-offset of cl:array, but wait, why is it a list and not a single number? Welcome to dense-arrays :)

But does that mean all the effort spent on magicl all these years will go to waste? Thankfully not! Turns out both magicl and dense-arrays - specifically standard-dense-array - are using cl:vector under the hood for storage:

(describe (magicl:rand '(6 108) :type 'single-float))
#<MAGICL:MATRIX/DOUBLE-FLOAT (6x108):..
  [structure-object]

Slots with :INSTANCE allocation:
  NROWS                          = 6
  NCOLS                          = 108
  SIZE                           = 648
  LAYOUT                         = :COLUMN-MAJOR
  STORAGE                        = #(0.23684204 0.7401872 0.8467122 0.17149377 0.5106092 0.10455426..

What that means is:

(ql:quickload "dense-arrays+magicl")
(rand 5 5 :type 'single-float)
#<STANDARD-DENSE-ARRAY :ROW-MAJOR 5x5 SINGLE-FLOAT
   (  0.058       0.553       0.918       0.653       0.080    )
   (  0.283       0.289       0.843       0.236       0.333    )
   (  0.434       0.701       0.826       0.339       0.306    )
   (  0.275       0.021       0.774       0.248       0.841    )
   (  0.426       0.913       0.662       0.058       0.395    )
 {10438D6D13}>
(magicl-funcall #'magicl:svd *)
#<STANDARD-DENSE-ARRAY :ROW-MAJOR 5x5 SINGLE-FLOAT
   ( -0.460      -0.292       0.740       0.354       0.174    )
   ( -0.401       0.179       0.112      -0.801       0.391    )
   ( -0.497      -0.221      -0.107      -0.209      -0.806    )
   ( -0.401       0.842      -0.068       0.348      -0.065    )
   ( -0.469      -0.352      -0.651       0.262       0.404    )
 {10476B6C93}>
#<STANDARD-DENSE-ARRAY :ROW-MAJOR 5x5 SINGLE-FLOAT
   (  2.486       0.000e+00   0.000e+00   0.000e+00   0.000e+00)
   (  0.000e+00   0.793       0.000e+00   0.000e+00   0.000e+00)
   (  0.000e+00   0.000e+00   0.635       0.000e+00   0.000e+00)
   (  0.000e+00   0.000e+00   0.000e+00   0.181       0.000e+00)
   (  0.000e+00   0.000e+00   0.000e+00   0.000e+00   0.105    )
 {10476B87F3}>
#<STANDARD-DENSE-ARRAY :ROW-MAJOR 5x5 SINGLE-FLOAT
   ( -0.268      -0.465      -0.721      -0.278      -0.340    )
   (  0.025      -0.717       0.150      -0.044       0.678    )
   ( -0.421      -0.360       0.320       0.660      -0.393    )
   ( -0.496       0.356      -0.444       0.402       0.519    )
   ( -0.710       0.115       0.398      -0.569       0.023    )
 {10476B8D03}>

Welcome again to dense-arrays :D!

Introduction

This system provides

The multidimensional strides and offsets enable copy-free slicing and broadcasting.

CL-USER> (let ((a (make-array '(1000 1000))))
           (time (loop for i below 1000 do (select:select a t i))))
Evaluation took:
  0.159 seconds of real time
  0.159541 seconds of total run time (0.159541 user, 0.000000 system)
  100.63% CPU
  42 lambdas converted
  352,387,000 processor cycles
  10,863,248 bytes consed

NIL
CL-USER> (let ((a (dense-arrays:make-array '(1000 1000))))
           (time (loop for i below 1000 do (dense-arrays:aref a nil i))))
Evaluation took:
  0.000 seconds of real time
  0.000910 seconds of total run time (0.000878 user, 0.000032 system)
  100.00% CPU
  2,001,298 processor cycles
  261,904 bytes consed

NIL

Limitations:

Included Systems

Minimalists would want to stick to the first four. The last one also introduces

Basic Demonstration

CL-USER> (uiop:define-package :dense-arrays-demo
           (:mix :dense-arrays :cl))
#<PACKAGE "DENSE-ARRAYS-DEMO">
CL-USER> (in-package :dense-arrays-demo)
#<PACKAGE "DENSE-ARRAYS-DEMO">
CL-USER> (setq *print-length* 10) ; also intends to respect (*print-level* *print-lines* *print-array*)
10

A cleaner look

DENSE-ARRAYS-DEMO> (make-array '(2 3 4) :constructor #'+)
#<STANDARD-DENSE-ARRAY :ROW-MAJOR 2x3x4 T
   ((0 1 2 3)
    (1 2 3 4)
    (2 3 4 5))
   ((1 2 3 4)
    (2 3 4 5)
    (3 4 5 6))
 {100980B593}>
DENSE-ARRAYS-DEMO> (aref * 1 '(0 :step 2))
#<STANDARD-DENSE-ARRAY NIL 2x4 T
   (1 2 3 4)
   (3 4 5 6)
 {1009810073}>
DENSE-ARRAYS-DEMO> (aref ** 1 '(-1 :step -2))
#<STANDARD-DENSE-ARRAY NIL 2x4 T
   (3 4 5 6)
   (1 2 3 4)
 {1009811E73}>
DENSE-ARRAYS-DEMO> (make-array '(2 10))
#<STANDARD-DENSE-ARRAY :ROW-MAJOR 2x10 T
   (0 0 0 0 0 0 0 0 0 0)
   (0 0 0 0 0 0 0 0 0 0)
 {1009813D63}>
DENSE-ARRAYS-DEMO> (make-array '(2 100))
#<STANDARD-DENSE-ARRAY :ROW-MAJOR 2x100 T
   (0 0 0 0 0 0 0 0 0 0 ...)
   (0 0 0 0 0 0 0 0 0 0 ...)
 {10098286B3}>
DENSE-ARRAYS-DEMO> (describe (make-array '(2 10)))
#<STANDARD-DENSE-ARRAY :ROW-MAJOR 2x10 T {100982C243}>
  [standard-object]

Slots with :INSTANCE allocation:
  STORAGE                        = #(0 0 0 0 0 0 0 0 0 0 ...)
  DIMENSIONS                     = (2 10)
  ELEMENT-TYPE                   = T
  RANK                           = 2
  TOTAL-SIZE                     = 20
  STRIDES                        = (10 1)
  OFFSETS                        = (0 0)
  LAYOUT                         = :ROW-MAJOR
  ROOT-ARRAY                     = NIL
; No value
DENSE-ARRAYS-DEMO> (defparameter a (make-array '(4 10) :constructor #'+))
A
DENSE-ARRAYS-DEMO> (print-array a "~2d")

#<STANDARD-DENSE-ARRAY :ROW-MAJOR 4x10 T
   ( 0  1  2  3  4  5  6  7  8  9)
   ( 1  2  3  4  5  6  7  8  9 10)
   ( 2  3  4  5  6  7  8  9 10 11)
   ( 3  4  5  6  7  8  9 10 11 12)
 {1009837073}>
NIL

Slicing facilities

DENSE-ARRAYS-DEMO> (aref a nil 1)
#<STANDARD-DENSE-ARRAY NIL 4 T
   1
   2
   3
   4
 {100984D933}>
DENSE-ARRAYS-DEMO> (aref a nil -1)
#<STANDARD-DENSE-ARRAY NIL 4 T
   9
   10
   11
   12
 {100984ECC3}>
DENSE-ARRAYS-DEMO> (aref a 1)
#<STANDARD-DENSE-ARRAY NIL 10 T
   1
   2
   3
   4
   5
   6
   7
   8
   9
   10
 {100984FFA3}>
DENSE-ARRAYS-DEMO> (aref a '(1 :end 3) '(1 :end 3))
#<STANDARD-DENSE-ARRAY NIL 2x2 T
   (2 3)
   (3 4)
 {10098622A3}>
DENSE-ARRAYS-DEMO> (defparameter b (aref a '(1 :end 3) '(1 :end 8 :step 2)))
B
DENSE-ARRAYS-DEMO> b
#<STANDARD-DENSE-ARRAY NIL 2x4 T
   (2 4 6 8)
   (3 5 7 9)
 {1009863FF3}>
DENSE-ARRAYS-DEMO> (aref b (make-array '(2 4) :initial-contents '((0 1 0 0) (1 1 0 0))
                                       :element-type 'bit))
#<STANDARD-DENSE-ARRAY :ROW-MAJOR 3 T
   4
   3
   5
 {1009867F13}>
DENSE-ARRAYS-DEMO> (setf (aref b (make-array '(2 4)
                                             :initial-contents '((0 1 0 0) (1 1 0 0))
                                             :element-type 'bit))
                         0)
0
DENSE-ARRAYS-DEMO> b
#<STANDARD-DENSE-ARRAY NIL 2x4 T
   (2 0 6 8)
   (0 0 7 9)
 {1009863FF3}>
DENSE-ARRAYS-DEMO> a
#<STANDARD-DENSE-ARRAY :ROW-MAJOR 4x10 T
   (0 1 2 3 4 5 6 7 8 9)
   (1 2 3 0 5 6 7 8 9 10)
   (2 0 4 0 6 7 8 9 10 11)
   (3 4 5 6 7 8 9 10 11 12)
 {1009837073}>

Tests are also littered throughout out the system and may serve as examples, for instance plus/py4cl2.lisp.

Usage

Using Ultralisp

Without using Ultralisp

  1. Obtain
  2. Clone into $QUICKLISP_HOME/local-projects. (See ql:*local-project-directories*.)
  3. (ql:quickload "dense-arrays") - or dense-arrays-plus or dense-arrays-plus-lite
  4. Optionally: (asdf:test-system "dense-arrays")- or dense-arrays-plus or dense-arrays-plus-lite

Feel free to raise an issue!

API Reference: dense-arrays-plus-lite

*array-element-print-format*

Variable
Default Value: "~/DENSE-ARRAYS::PRETTY-PRINT-NUMBER/"

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:

*array-element-type*

Variable
Default Unbound

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.

*array-element-type-alist*

Variable
Default Value: NIL

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.

*array-layout*

Variable
Default Value: :ROW-MAJOR

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.

*dense-array-class*

Variable
Default Value: #<DENSE-ARRAYS:STANDARD-DENSE-ARRAY-CLASS DENSE-ARRAYS:STANDARD-DENSE-ARRAY>

Specifies the default value of CLASS in dense-arrays:make-array and other functions. (TODO: Specify these other functions.)

aref

Polymorphic Function: (aref array &rest subscripts)

This is SETF-able.

Polymorph: ((common-lisp:array common-lisp:array) &rest abstract-arrays::subscripts)

A wrapper around CL:AREF.

Return the element of the array specified by the subscripts.

Polymorph: ((array dense-array) &rest dense-arrays::subscripts)

No documentation found.

aref*

Function: (aref* dense-array &rest subscripts)

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

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.

array

Type

A wrapper around STANDARD-DENSE-ARRAY with support for specifying ELEMENT-TYPE and DIMENSIONS or RANK. These specializers are the same like the CL:ARRAY compound type.

array-dimension

Function: (array-dimension array axis-number)

Return the length of dimension axis-number of array.

array-dimensions

Polymorphic Function: (array-dimensions array)

Polymorph: ((common-lisp:array common-lisp:array))

No documentation found.

Polymorph: ((common-lisp:array abstract-arrays:abstract-array))

Returns a COPY of the dimensions of array. The copy may then be modified.

See narray-dimensions or equivalent of a copy is to be avoided, and destructive use is not intended.

array-displaced-to

Function: (array-displaced-to array)

array-displacement

Function: (array-displacement array)

Returns two values:

array-element-type

Polymorphic Function: (array-element-type array)

Polymorph: ((common-lisp:array common-lisp:array))

No documentation found.

Polymorph: ((abstract-arrays:abstract-array abstract-arrays:abstract-array))

No documentation found.

array-layout

Function: (array-layout array)

array-offset

Function: (array-offset array axis-number)

Return the length of offset corresponding to axis-number of array.

array-offsets

Function: (array-offsets array)

array-rank

Polymorphic Function: (array-rank array)

Polymorph: ((common-lisp:array common-lisp:array))

No documentation found.

Polymorph: ((abstract-arrays:abstract-array abstract-arrays:abstract-array))

No documentation found.

array-storage

Polymorphic Function: (array-storage array)

Polymorph: ((abstract-arrays:abstract-array abstract-arrays:abstract-array))

No documentation found.

Polymorph: ((common-lisp:array common-lisp:array))

No documentation found.

array-storage-allocator

No documentation found for array-storage-allocator

array-storage-deallocator

No documentation found for array-storage-deallocator

array-stride

Function: (array-stride array axis-number)

Return the length of stride corresponding to axis-number of array.

array-strides

Function: (array-strides array)

array-total-size

Polymorphic Function: (array-total-size array)

Polymorph: ((common-lisp:array common-lisp:array))

No documentation found.

Polymorph: ((abstract-arrays:abstract-array abstract-arrays:abstract-array))

No documentation found.

array=

Function: (array= array1 array2 &key (test (function equalp)))

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.

arrayp

Function: (arrayp object)

as-cl-array

Function: (as-cl-array array)

asarray

Function: (asarray array-like &key (out NIL outp) (type default-element-type)
           (layout *array-layout*))

type can also be :AUTO

broadcast-array

Function: (broadcast-array array broadcast-dimensions)

broadcast-arrays

Function: (broadcast-arrays &rest arrays)

Returns two values. The first value is the list of broadcasted arrays if the second value is non-NIL.

broadcast-compatible-p

Function: (broadcast-compatible-p &rest arrays)

Returns two values:

The broadcasting semantics are equivalent to numpy semantics. Two arrays are broadcast compatible, if

Thus, arrays with the following dimensions are broadcast-compatible:

Arrays with the following dimensions are not compatible:

See https://numpy.org/doc/stable/user/basics.broadcasting.html for an elaborate discussion.

copy-array

Function: (copy-array array &key (layout (array-layout array)))

Returns a copy of array. Creates a completely new array even if array is a VIEW (see ARRAY-VIEW-P).

copy-dense-array

No documentation found for copy-dense-array

define-array-class

Macro: (define-array-class name &body (direct-slots &rest slot-options))

Defines name as a CLASS with DIRECT-SUPERCLASS ABSTRACT-ARRAY and metaclass as ABSTRACT-ARRAY-CLASS. Also defines the appropriate order using direct-slots.

dense-array-type-class

Function: (dense-array-type-class array-type &optional env)

do-arrays

Macro: (do-arrays rank/bindings &body body)

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.

eye

Function: (eye per-axis-size &key (rank 2) (type default-element-type))

full

Function: (full &rest args)

LAMBDA-LIST: (SHAPE &KEY (TYPE DEFAULT-ELEMENT-TYPE) (LAYOUT *array-layout*) VALUE)

full-like

Function: (full-like array-like value)

macro-map-array

Macro: (macro-map-array result-array function &rest arrays)

make-array

Function: (make-array dimensions &rest args &key
           (element-type default-element-type)
           (initial-element NIL initial-element-p)
           (initial-contents NIL initial-contents-p)
           (constructor NIL constructor-p) (strides NIL strides-p)
           (adjustable NIL adjustable-p) (fill-pointer NIL fill-pointer-p)
           (class *dense-array-class*) (layout *array-layout*)
           (displaced-to NIL displaced-to-p) (offsets NIL offsets-p)
           (displaced-index-offset 0 displaced-index-offset-p))

Like CL:MAKE-ARRAY but returns a DENSE-ARRAYS::DENSE-ARRAY instead of cl:array. Additionally takes

narray-dimensions

Polymorphic Function: (narray-dimensions array)

Polymorph: ((common-lisp:array abstract-arrays:abstract-array))

Returns the dimensions of the array. The consequences are undefined if the returned dimensions are modified. Use array-dimensions if destructive usage of the returned list is intended.

ones

Function: (ones &rest args)

LAMBDA-LIST: (SHAPE &KEY (TYPE DEFAULT-ELEMENT-TYPE) (LAYOUT *array-layout*))

ones-like

Function: (ones-like array-like)

print-array

Function: (print-array array &optional array-element-print-format &key level
           length (stream NIL streamp))

Prints array as if by CL:PRINT. Format recipes: http://www.gigamonkeys.com/book/a-few-format-recipes.html.

rand

Function: (rand &rest args)

LAMBDA-LIST: (SHAPE &KEY (TYPE DEFAULT-ELEMENT-TYPE) (LAYOUT *array-layout*) (MIN (COERCE 0 TYPE)) (MAX (COERCE 1 TYPE)))

rand-like

Function: (rand-like array-like)

reshape

Function: (reshape array-like new-shape &key (view NIL viewp)
           (layout NIL layoutp))

view argument is considered only if array-like is a SIMPLE-DENSE-ARRAY. If array-like is a SIMPLE-DENSE-ARRAY, it is guaranteed that when view is supplied,

row-major-aref

Polymorphic Function: (row-major-aref array index)

Return the element of array corresponding to the row-major index. This is SETFable.

Polymorph: ((common-lisp:array common-lisp:array) (abstract-arrays::index t))

No documentation found.

Polymorph: ((array dense-array) (dense-arrays::index t))

No documentation found.

simple-array

Type: (SIMPLE-ARRAY &OPTIONAL (ABSTRACT-ARRAYS::ELEMENT-TYPE '*)
       (ABSTRACT-ARRAYS::DIM/RANK '*))

A wrapper around (AND STANDARD-DENSE-ARRAY SIMPLE-DENSE-ARRAY) with support for specifying ELEMENT-TYPE and DIMENSIONS or RANK. These specializers are the same like the CL:ARRAY compound type.

simple-unupgraded-array

Type: (SIMPLE-UNUPGRADED-ARRAY &OPTIONAL (ABSTRACT-ARRAYS::ELEMENT-TYPE '*)
       (ABSTRACT-ARRAYS::DIM/RANK '*))

A wrapper around (AND UNUPGRADED-DENSE-ARRAY SIMPLE-DENSE-ARRAY) with support for specifying ELEMENT-TYPE and DIMENSIONS or RANK. These specializers are the same like the CL:ARRAY compound type.

standard-dense-array

Class

standard-dense-array-class

Class

storage-accessor

Generic Function: (storage-accessor class)

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.

storage-allocator

Generic Function: (storage-allocator 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.

storage-deallocator

Generic Function: (storage-deallocator 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.

storage-element-type-upgrader

Generic Function: (storage-element-type-upgrader 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.

storage-type-inferrer-from-array-type

Generic Function: (storage-type-inferrer-from-array-type 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.

transpose

Function: (transpose array-like &key axes)

unupgraded-array

Type: (UNUPGRADED-ARRAY &OPTIONAL (ABSTRACT-ARRAYS::ELEMENT-TYPE '*)
       (ABSTRACT-ARRAYS::DIM/RANK '*))

A wrapper around UNUPGRADED-DENSE-ARRAY with support for specifying ELEMENT-TYPE and DIMENSIONS or RANK. These specializers are the same like the CL:ARRAY compound type.

unupgraded-dense-array

Class

zeros

Function: (zeros &rest args)

LAMBDA-LIST: (SHAPE &KEY (TYPE DEFAULT-ELEMENT-TYPE) (LAYOUT *array-layout*))

zeros-like

Function: (zeros-like array-like)

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 dense-arrays

Numpy like array objects for Common Lisp

Author

Shubhamkar B. Ayare

License

MIT

Version

0.2.0

Dependencies
  • abstract-arrays (system).
  • polymorphic-functions (system).
  • alexandria (system).
  • compiler-macro-notes (system).
  • closer-mop (system).
  • fiveam (system).
  • iterate (system).
  • trivial-garbage (system).
  • cl-form-types (system).
  • trivial-types (system).
  • uiop (system).
Source

dense-arrays.asd.

Child Components

3 Modules

Modules are listed depth-first from the system components tree.


Next: , Previous: , Up: Modules   [Contents][Index]

3.1 dense-arrays/src

Source

dense-arrays.asd.

Parent Component

dense-arrays (system).

Child Components

Previous: , Up: Modules   [Contents][Index]

3.2 dense-arrays/optim

Dependency

src (module).

Source

dense-arrays.asd.

Parent Component

dense-arrays (system).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

4.1.1 dense-arrays/dense-arrays.asd

Source

dense-arrays.asd.

Parent Component

dense-arrays (system).

ASDF Systems

dense-arrays.


4.1.2 dense-arrays/src/package.lisp

Source

dense-arrays.asd.

Parent Component

src (module).

Packages

dense-arrays.

Public Interface
Internals

4.1.3 dense-arrays/src/protocol.lisp

Dependency

package.lisp (file).

Source

dense-arrays.asd.

Parent Component

src (module).

Public Interface
Internals

4.1.4 dense-arrays/src/types.lisp

Dependency

protocol.lisp (file).

Source

dense-arrays.asd.

Parent Component

src (module).

Public Interface
Internals

4.1.5 dense-arrays/src/dense-arrays.lisp

Dependency

types.lisp (file).

Source

dense-arrays.asd.

Parent Component

src (module).

Public Interface
Internals

4.1.6 dense-arrays/src/broadcast.lisp

Dependency

dense-arrays.lisp (file).

Source

dense-arrays.asd.

Parent Component

src (module).

Public Interface
Internals

%broadcast-compatible-p (function).


4.1.7 dense-arrays/src/do-arrays.lisp

Dependency

broadcast.lisp (file).

Source

dense-arrays.asd.

Parent Component

src (module).

Public Interface

do-arrays (macro).

Internals

4.1.8 dense-arrays/src/argwhere.lisp

Dependency

do-arrays.lisp (file).

Source

dense-arrays.asd.

Parent Component

src (module).

Internals

4.1.9 dense-arrays/src/aref.lisp

Dependency

argwhere.lisp (file).

Source

dense-arrays.asd.

Parent Component

src (module).

Public Interface
Internals

4.1.10 dense-arrays/src/copy.lisp

Dependency

aref.lisp (file).

Source

dense-arrays.asd.

Parent Component

src (module).

Public Interface

copy-array (function).


4.1.11 dense-arrays/src/unupgraded.lisp

Dependency

copy.lisp (file).

Source

dense-arrays.asd.

Parent Component

src (module).

Public Interface
Internals

unupgraded-dense-array-class (class).


4.1.12 dense-arrays/optim/misc.lisp

Source

dense-arrays.asd.

Parent Component

optim (module).

Public Interface

dense-array-type-class (function).

Internals

4.1.13 dense-arrays/optim/aref.lisp

Dependency

misc.lisp (file).

Source

dense-arrays.asd.

Parent Component

optim (module).

Public Interface

array= (compiler macro).


4.1.14 dense-arrays/optim/unupgraded.lisp

Dependency

aref.lisp (file).

Source

dense-arrays.asd.

Parent Component

optim (module).


5 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

5.1 dense-arrays

Source

package.lisp.

Use List
  • alexandria.
  • common-lisp.
  • it.bese.fiveam.
  • iterate.
  • polymorphic-functions.
Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Public Interface


Next: , Previous: , Up: Public Interface   [Contents][Index]

6.1.1 Special variables

Special Variable: *array-element-print-format*

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

Package

dense-arrays.

Source

dense-arrays.lisp.

Special Variable: *array-element-type*

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.

Package

dense-arrays.

Source

package.lisp.

Special Variable: *array-element-type-alist*

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.

Package

dense-arrays.

Source

package.lisp.

Special Variable: *array-layout*

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.

Package

dense-arrays.

Source

package.lisp.

Special Variable: *dense-array-class*

Specifies the default value of CLASS in DENSE-ARRAYS:MAKE-ARRAY and other functions. (TODO: Specify these other functions.)

Package

dense-arrays.

Source

protocol.lisp.


6.1.2 Macros

Macro: do-arrays (rank/bindings &body body)

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.

Package

dense-arrays.

Source

do-arrays.lisp.


6.1.3 Compiler macros

Compiler Macro: array= (array1 array2 &key test)
Package

dense-arrays.

Source

aref.lisp.


6.1.4 Ordinary functions

Function: aref* (dense-array &rest subscripts)

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.

Package

dense-arrays.

Source

aref.lisp.

Function: (setf aref*) (dense-array &rest subscripts)
Package

dense-arrays.

Source

aref.lisp.

Function: array-displaced-to (array)
Package

dense-arrays.

Source

dense-arrays.lisp.

Function: array-displacement (array)

Returns two values:
- ARRAY-STORAGE
- and OFFSET along first axis
Consequences are undefined if ARRAY is displaced along multiple axis.

Package

dense-arrays.

Source

dense-arrays.lisp.

Function: array-layout (array)
Package

dense-arrays.

Source

dense-arrays.lisp.

Function: array-offset (array axis-number)

Return the length of offset corresponding to AXIS-NUMBER of ARRAY.

Package

dense-arrays.

Source

dense-arrays.lisp.

Function: array-offsets (array)
Package

dense-arrays.

Source

dense-arrays.lisp.

Function: array-stride (array axis-number)

Return the length of stride corresponding to AXIS-NUMBER of ARRAY.

Package

dense-arrays.

Source

dense-arrays.lisp.

Function: array-strides (array)
Package

dense-arrays.

Source

dense-arrays.lisp.

Function: array= (array1 array2 &key test)

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.

Package

dense-arrays.

Source

aref.lisp.

Function: broadcast-array (array broadcast-dimensions)
Package

dense-arrays.

Source

broadcast.lisp.

Function: broadcast-arrays (&rest arrays)

Returns two values. The first value is the list of broadcasted arrays if the second value is non-NIL.

Package

dense-arrays.

Source

broadcast.lisp.

Function: broadcast-compatible-p (&rest arrays)

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.

Package

dense-arrays.

Source

broadcast.lisp.

Function: copy-array (array &key layout)

Returns a copy of ARRAY. Creates a completely new array even if ARRAY is a VIEW (see ARRAY-VIEW-P).

Package

dense-arrays.

Source

copy.lisp.

Function: dense-array-type-class (array-type &optional env)
Package

dense-arrays.

Source

misc.lisp.

Function: make-array (dimensions &rest args &key element-type initial-element initial-contents constructor strides adjustable fill-pointer class layout displaced-to offsets displaced-index-offset)

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}>

Package

dense-arrays.

Source

dense-arrays.lisp.

Function: print-array (array &optional array-element-print-format &key level length stream)

Prints ARRAY as if by CL:PRINT.
Format recipes: http://www.gigamonkeys.com/book/a-few-format-recipes.html.

Package

dense-arrays.

Source

dense-arrays.lisp.


6.1.5 Generic functions

Generic Function: storage-accessor (class)

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.

Package

dense-arrays.

Source

protocol.lisp.

Methods
Method: storage-accessor ((class standard-dense-array-class))
Method: storage-accessor (class)
Generic Function: storage-allocator (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.

Package

dense-arrays.

Source

protocol.lisp.

Methods
Method: storage-allocator ((class standard-dense-array-class))
Method: storage-allocator (class)
Generic Function: storage-deallocator (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.

Package

dense-arrays.

Source

protocol.lisp.

Methods
Method: storage-deallocator ((class standard-dense-array-class))
Method: storage-deallocator (class)
Generic Function: storage-element-type-upgrader (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.

Package

dense-arrays.

Source

protocol.lisp.

Methods
Method: storage-element-type-upgrader ((class unupgraded-dense-array-class))
Source

unupgraded.lisp.

Method: storage-element-type-upgrader ((class standard-dense-array-class))
Method: storage-element-type-upgrader (class)
Generic Function: storage-type-inferrer-from-array-type (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.

Package

dense-arrays.

Source

protocol.lisp.

Methods
Method: storage-type-inferrer-from-array-type ((class standard-dense-array-class))
Method: storage-type-inferrer-from-array-type (class)

6.1.6 Standalone methods

Method: print-object ((array dense-array) stream)
Source

dense-arrays.lisp.


6.1.7 Classes

Class: standard-dense-array
Package

dense-arrays.

Source

protocol.lisp.

Direct superclasses

dense-array.

Class: standard-dense-array-class
Package

dense-arrays.

Source

protocol.lisp.

Direct superclasses

dense-array-class.

Direct subclasses

unupgraded-dense-array-class.

Direct methods
Class: unupgraded-dense-array
Package

dense-arrays.

Source

unupgraded.lisp.

Direct superclasses

dense-array.


Previous: , Up: Public Interface   [Contents][Index]

6.1.8 Types

Type: array (&optional element-type rank)
Package

dense-arrays.

Source

types.lisp.

Type: simple-array (&optional element-type rank)
Package

dense-arrays.

Source

types.lisp.

Type: simple-unupgraded-array (&optional element-type rank)
Package

dense-arrays.

Source

unupgraded.lisp.

Type: unupgraded-array (&optional element-type rank)
Package

dense-arrays.

Source

unupgraded.lisp.


6.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.1 Symbol macros

Symbol Macro: default-element-type
Package

dense-arrays.

Source

package.lisp.

Symbol Macro: package-local-element-type
Package

dense-arrays.

Source

package.lisp.


6.2.2 Macros

Macro: define-macro-helper (name lambda-list &body body)
Package

dense-arrays.

Source

do-arrays.lisp.

Macro: destructuring-lists (bindings &body body)
Package

dense-arrays.

Source

do-arrays.lisp.

Macro: ensure-single (&rest symbols)
Package

dense-arrays.

Source

dense-arrays.lisp.

Macro: lm (&rest body-vars)
Package

dense-arrays.

Source

do-arrays.lisp.

Macro: map-collect (format &rest list-vars)

(map-collect ‘(c ,%1) ’(1 2 3)) ;=> ((C 1) (C 2) (C 3))

Package

dense-arrays.

Source

do-arrays.lisp.

Macro: the-int-index (form)
Package

dense-arrays.

Source

package.lisp.

Macro: the-size (form)
Package

dense-arrays.

Source

package.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.3 Ordinary functions

Function: %aref (array &rest subscripts)

Returns a copy of the subscripted array.

Package

dense-arrays.

Source

aref.lisp.

Function: (setf %aref) (array &rest subscripts)
Package

dense-arrays.

Source

aref.lisp.

Function: %aref-view (array &rest subscripts)

Returns a VIEW of the subscripted ARRAY (without copying the contents)

Package

dense-arrays.

Source

aref.lisp.

Function: (setf %aref-view) (array &rest subscripts)
Package

dense-arrays.

Source

aref.lisp.

Function: %broadcast-compatible-p (dimensions-a dimensions-b)

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.

Package

dense-arrays.

Source

broadcast.lisp.

Function: 1d-storage-array (array)

Returns the storage-vector underlying the ARRAY. This is equivalent to ARRAY-DISPLACED-TO.

Package

dense-arrays.

Source

dense-arrays.lisp.

Function: argwhere (bit-array)
Package

dense-arrays.

Source

argwhere.lisp.

Function: array-displaced-index-offset (array)
Package

dense-arrays.

Source

dense-arrays.lisp.

Function: array-view-p (array)

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.

Package

dense-arrays.

Source

dense-arrays.lisp.

Function: assert-type (value type &optional datum &rest datum-args)
Package

dense-arrays.

Source

dense-arrays.lisp.

Function: cl-aref (array index)
Package

dense-arrays.

Source

protocol.lisp.

Function: (setf cl-aref) (array index)
Package

dense-arrays.

Source

protocol.lisp.

Function: collect-reduce-from-end (function list initial-element)
Package

dense-arrays.

Source

dense-arrays.lisp.

Function: dense-array-layout (dense-array)
Package

dense-arrays.

Source

protocol.lisp.

Function: dense-array-offsets (dense-array)
Package

dense-arrays.

Source

protocol.lisp.

Function: dense-array-root-array (dense-array)
Package

dense-arrays.

Source

protocol.lisp.

Function: dense-array-strides (dense-array)
Package

dense-arrays.

Source

protocol.lisp.

Function: dimensions->strides (dimensions layout)
Package

dense-arrays.

Source

dense-arrays.lisp.

Function: expand-do-arrays-with-rank (elt-vars array-vars storage-types storage-accessors rank body)
Package

dense-arrays.

Source

do-arrays.lisp.

Function: expand-do-arrays-without-rank (elt-vars array-vars storage-types storage-accessors body)
Package

dense-arrays.

Source

do-arrays.lisp.

Function: nonzero (bit-array)
Package

dense-arrays.

Source

argwhere.lisp.

Function: normalize-index (index dimension)
Package

dense-arrays.

Source

aref.lisp.

Function: pretty-print-number (stream arg colon-modifier-p at-modifier-p)
Package

dense-arrays.

Source

dense-arrays.lisp.

Function: primary-form-type (form env)
Package

dense-arrays.

Source

misc.lisp.

Function: simple-dense-array-p (object)
Package

dense-arrays.

Source

types.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.4 Generic functions

Generic Reader: axis-number (condition)
Generic Writer: (setf axis-number) (condition)
Package

dense-arrays.

Methods
Reader Method: axis-number ((condition print-lines-exhausted))
Writer Method: (setf axis-number) ((condition print-lines-exhausted))
Source

dense-arrays.lisp.

Target Slot

axis-number.

Generic Reader: form (condition)
Package

dense-arrays.

Methods
Reader Method: form ((condition slot-type-failure))
Source

misc.lisp.

Target Slot

form.

Generic Reader: form-type (condition)
Package

dense-arrays.

Methods
Reader Method: form-type ((condition slot-type-failure))
Source

misc.lisp.

Target Slot

form-type.

Generic Reader: index (condition)
Generic Writer: (setf index) (condition)
Package

dense-arrays.

Methods
Reader Method: index ((condition invalid-index))
Writer Method: (setf index) ((condition invalid-index))
Source

aref.lisp.

Target Slot

index.

Generic Reader: slot (condition)
Package

dense-arrays.

Methods
Reader Method: slot ((condition slot-type-failure))
Source

misc.lisp.

Target Slot

slot.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.5 Conditions

Condition: backend-failure
Package

dense-arrays.

Source

misc.lisp.

Direct superclasses

slot-type-failure.

Direct slots
Slot: slot
Allocation

:class

Initform

(quote (quote dense-arrays::backend))

Initargs

:slot

Condition: do-arrays/element-type-failure
Package

dense-arrays.

Source

do-arrays.lisp.

Direct superclasses

optimization-failure-note.

Direct slots
Slot: binding-form
Initargs

:binding-form

Condition: element-type-failure
Package

dense-arrays.

Source

misc.lisp.

Direct superclasses

slot-type-failure.

Direct slots
Slot: slot
Allocation

:class

Initform

(quote (quote abstract-arrays::element-type))

Initargs

:slot

Condition: invalid-index
Package

dense-arrays.

Source

aref.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: index
Initargs

:index

Readers

index.

Writers

(setf index).

Condition: print-lines-exhausted
Package

dense-arrays.

Source

dense-arrays.lisp.

Direct superclasses

condition.

Direct methods
Direct slots
Slot: axis-number
Initargs

:axis-number

Readers

axis-number.

Writers

(setf axis-number).

Condition: rank-failure
Package

dense-arrays.

Source

misc.lisp.

Direct superclasses

slot-type-failure.

Direct slots
Slot: slot
Allocation

:class

Initform

(quote (quote abstract-arrays::rank))

Initargs

:slot

Condition: slot-type-failure
Package

dense-arrays.

Source

misc.lisp.

Direct superclasses

optimization-failure-note.

Direct subclasses
Direct methods
Direct slots
Slot: form
Initargs

:form

Readers

form.

Writers

This slot is read-only.

Slot: form-type
Initargs

:form-type

Readers

form-type.

Writers

This slot is read-only.

Slot: slot
Initargs

:slot

Readers

slot.

Writers

This slot is read-only.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.6 Classes

Class: dense-array

- DIMENSIONS is a list of dimensions.
- STRIDES is a list of strides along each dimension. - OFFSETS is a list of offsets along each dimension.

Package

dense-arrays.

Source

protocol.lisp.

Direct superclasses

abstract-array.

Direct subclasses
Direct methods

print-object.

Direct slots
Slot: strides
Initform

(error "strides must be supplied during dense-array initialization")

Initargs

:strides

Slot: offsets
Initform

(error "offsets must be supplied during dense-array initialization")

Initargs

:offsets

Slot: layout
Type

(member nil :row-major :column-major)

Initform

(error "layout must be supplied during dense-array initialization")

Initargs

:layout

Slot: root-array
Initform

(error "root-array must be supplied during dense-array initialization")

Initargs

:root-array

Class: dense-array-class
Package

dense-arrays.

Source

protocol.lisp.

Direct superclasses

abstract-array-class.

Direct subclasses

standard-dense-array-class.

Class: unupgraded-dense-array-class
Package

dense-arrays.

Source

unupgraded.lisp.

Direct superclasses

standard-dense-array-class.

Direct methods

storage-element-type-upgrader.


Previous: , Up: Internals   [Contents][Index]

6.2.7 Types

Type: %dense-array (&optional element-type rank)
Package

dense-arrays.

Source

types.lisp.

Type: int-index ()
Package

dense-arrays.

Source

package.lisp.

Type: int32 ()
Package

dense-arrays.

Source

package.lisp.

Type: int64 ()
Package

dense-arrays.

Source

package.lisp.

Type: simple-dense-array ()
Package

dense-arrays.

Source

types.lisp.

Type: size ()
Package

dense-arrays.

Source

package.lisp.

Type: uint32 ()
Package

dense-arrays.

Source

package.lisp.

Type: uint64 ()
Package

dense-arrays.

Source

package.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   %   (   1  
A   B   C   D   E   F   G   I   L   M   N   P   S   T  
Index Entry  Section

%
%aref: Private ordinary functions
%aref-view: Private ordinary functions
%broadcast-compatible-p: Private ordinary functions

(
(setf %aref): Private ordinary functions
(setf %aref-view): Private ordinary functions
(setf aref*): Public ordinary functions
(setf axis-number): Private generic functions
(setf axis-number): Private generic functions
(setf cl-aref): Private ordinary functions
(setf index): Private generic functions
(setf index): Private generic functions

1
1d-storage-array: Private ordinary functions

A
aref*: Public ordinary functions
argwhere: Private ordinary functions
array-displaced-index-offset: Private ordinary functions
array-displaced-to: Public ordinary functions
array-displacement: Public ordinary functions
array-layout: Public ordinary functions
array-offset: Public ordinary functions
array-offsets: Public ordinary functions
array-stride: Public ordinary functions
array-strides: Public ordinary functions
array-view-p: Private ordinary functions
array=: Public compiler macros
array=: Public ordinary functions
assert-type: Private ordinary functions
axis-number: Private generic functions
axis-number: Private generic functions

B
broadcast-array: Public ordinary functions
broadcast-arrays: Public ordinary functions
broadcast-compatible-p: Public ordinary functions

C
cl-aref: Private ordinary functions
collect-reduce-from-end: Private ordinary functions
Compiler Macro, array=: Public compiler macros
copy-array: Public ordinary functions

D
define-macro-helper: Private macros
dense-array-layout: Private ordinary functions
dense-array-offsets: Private ordinary functions
dense-array-root-array: Private ordinary functions
dense-array-strides: Private ordinary functions
dense-array-type-class: Public ordinary functions
destructuring-lists: Private macros
dimensions->strides: Private ordinary functions
do-arrays: Public macros

E
ensure-single: Private macros
expand-do-arrays-with-rank: Private ordinary functions
expand-do-arrays-without-rank: Private ordinary functions

F
form: Private generic functions
form: Private generic functions
form-type: Private generic functions
form-type: Private generic functions
Function, %aref: Private ordinary functions
Function, %aref-view: Private ordinary functions
Function, %broadcast-compatible-p: Private ordinary functions
Function, (setf %aref): Private ordinary functions
Function, (setf %aref-view): Private ordinary functions
Function, (setf aref*): Public ordinary functions
Function, (setf cl-aref): Private ordinary functions
Function, 1d-storage-array: Private ordinary functions
Function, aref*: Public ordinary functions
Function, argwhere: Private ordinary functions
Function, array-displaced-index-offset: Private ordinary functions
Function, array-displaced-to: Public ordinary functions
Function, array-displacement: Public ordinary functions
Function, array-layout: Public ordinary functions
Function, array-offset: Public ordinary functions
Function, array-offsets: Public ordinary functions
Function, array-stride: Public ordinary functions
Function, array-strides: Public ordinary functions
Function, array-view-p: Private ordinary functions
Function, array=: Public ordinary functions
Function, assert-type: Private ordinary functions
Function, broadcast-array: Public ordinary functions
Function, broadcast-arrays: Public ordinary functions
Function, broadcast-compatible-p: Public ordinary functions
Function, cl-aref: Private ordinary functions
Function, collect-reduce-from-end: Private ordinary functions
Function, copy-array: Public ordinary functions
Function, dense-array-layout: Private ordinary functions
Function, dense-array-offsets: Private ordinary functions
Function, dense-array-root-array: Private ordinary functions
Function, dense-array-strides: Private ordinary functions
Function, dense-array-type-class: Public ordinary functions
Function, dimensions->strides: Private ordinary functions
Function, expand-do-arrays-with-rank: Private ordinary functions
Function, expand-do-arrays-without-rank: Private ordinary functions
Function, make-array: Public ordinary functions
Function, nonzero: Private ordinary functions
Function, normalize-index: Private ordinary functions
Function, pretty-print-number: Private ordinary functions
Function, primary-form-type: Private ordinary functions
Function, print-array: Public ordinary functions
Function, simple-dense-array-p: Private ordinary functions

G
Generic Function, (setf axis-number): Private generic functions
Generic Function, (setf index): Private generic functions
Generic Function, axis-number: Private generic functions
Generic Function, form: Private generic functions
Generic Function, form-type: Private generic functions
Generic Function, index: Private generic functions
Generic Function, slot: Private generic functions
Generic Function, storage-accessor: Public generic functions
Generic Function, storage-allocator: Public generic functions
Generic Function, storage-deallocator: Public generic functions
Generic Function, storage-element-type-upgrader: Public generic functions
Generic Function, storage-type-inferrer-from-array-type: Public generic functions

I
index: Private generic functions
index: Private generic functions

L
lm: Private macros

M
Macro, define-macro-helper: Private macros
Macro, destructuring-lists: Private macros
Macro, do-arrays: Public macros
Macro, ensure-single: Private macros
Macro, lm: Private macros
Macro, map-collect: Private macros
Macro, the-int-index: Private macros
Macro, the-size: Private macros
make-array: Public ordinary functions
map-collect: Private macros
Method, (setf axis-number): Private generic functions
Method, (setf index): Private generic functions
Method, axis-number: Private generic functions
Method, form: Private generic functions
Method, form-type: Private generic functions
Method, index: Private generic functions
Method, print-object: Public standalone methods
Method, slot: Private generic functions
Method, storage-accessor: Public generic functions
Method, storage-accessor: Public generic functions
Method, storage-allocator: Public generic functions
Method, storage-allocator: Public generic functions
Method, storage-deallocator: Public generic functions
Method, storage-deallocator: Public generic functions
Method, storage-element-type-upgrader: Public generic functions
Method, storage-element-type-upgrader: Public generic functions
Method, storage-element-type-upgrader: Public generic functions
Method, storage-type-inferrer-from-array-type: Public generic functions
Method, storage-type-inferrer-from-array-type: Public generic functions

N
nonzero: Private ordinary functions
normalize-index: Private ordinary functions

P
pretty-print-number: Private ordinary functions
primary-form-type: Private ordinary functions
print-array: Public ordinary functions
print-object: Public standalone methods

S
simple-dense-array-p: Private ordinary functions
slot: Private generic functions
slot: Private generic functions
storage-accessor: Public generic functions
storage-accessor: Public generic functions
storage-accessor: Public generic functions
storage-allocator: Public generic functions
storage-allocator: Public generic functions
storage-allocator: Public generic functions
storage-deallocator: Public generic functions
storage-deallocator: Public generic functions
storage-deallocator: Public generic functions
storage-element-type-upgrader: Public generic functions
storage-element-type-upgrader: Public generic functions
storage-element-type-upgrader: Public generic functions
storage-element-type-upgrader: Public generic functions
storage-type-inferrer-from-array-type: Public generic functions
storage-type-inferrer-from-array-type: Public generic functions
storage-type-inferrer-from-array-type: Public generic functions

T
the-int-index: Private macros
the-size: Private macros

Jump to:   %   (   1  
A   B   C   D   E   F   G   I   L   M   N   P   S   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
A   B   D   F   I   L   O   P   R   S  
Index Entry  Section

*
*array-element-print-format*: Public special variables
*array-element-type*: Public special variables
*array-element-type-alist*: Public special variables
*array-layout*: Public special variables
*dense-array-class*: Public special variables

A
axis-number: Private conditions

B
binding-form: Private conditions

D
default-element-type: Private symbol macros

F
form: Private conditions
form-type: Private conditions

I
index: Private conditions

L
layout: Private classes

O
offsets: Private classes

P
package-local-element-type: Private symbol macros

R
root-array: Private classes

S
slot: Private conditions
slot: Private conditions
slot: Private conditions
slot: Private conditions
Slot, axis-number: Private conditions
Slot, binding-form: Private conditions
Slot, form: Private conditions
Slot, form-type: Private conditions
Slot, index: Private conditions
Slot, layout: Private classes
Slot, offsets: Private classes
Slot, root-array: Private classes
Slot, slot: Private conditions
Slot, slot: Private conditions
Slot, slot: Private conditions
Slot, slot: Private conditions
Slot, strides: Private classes
Special Variable, *array-element-print-format*: Public special variables
Special Variable, *array-element-type*: Public special variables
Special Variable, *array-element-type-alist*: Public special variables
Special Variable, *array-layout*: Public special variables
Special Variable, *dense-array-class*: Public special variables
strides: Private classes
Symbol Macro, default-element-type: Private symbol macros
Symbol Macro, package-local-element-type: Private symbol macros

Jump to:   *  
A   B   D   F   I   L   O   P   R   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   %  
A   B   C   D   E   F   I   M   O   P   R   S   T   U  
Index Entry  Section

%
%dense-array: Private types

A
aref.lisp: The dense-arrays/src/aref․lisp file
aref.lisp: The dense-arrays/optim/aref․lisp file
argwhere.lisp: The dense-arrays/src/argwhere․lisp file
array: Public types

B
backend-failure: Private conditions
broadcast.lisp: The dense-arrays/src/broadcast․lisp file

C
Class, dense-array: Private classes
Class, dense-array-class: Private classes
Class, standard-dense-array: Public classes
Class, standard-dense-array-class: Public classes
Class, unupgraded-dense-array: Public classes
Class, unupgraded-dense-array-class: Private classes
Condition, backend-failure: Private conditions
Condition, do-arrays/element-type-failure: Private conditions
Condition, element-type-failure: Private conditions
Condition, invalid-index: Private conditions
Condition, print-lines-exhausted: Private conditions
Condition, rank-failure: Private conditions
Condition, slot-type-failure: Private conditions
copy.lisp: The dense-arrays/src/copy․lisp file

D
dense-array: Private classes
dense-array-class: Private classes
dense-arrays: The dense-arrays system
dense-arrays: The dense-arrays package
dense-arrays.asd: The dense-arrays/dense-arrays․asd file
dense-arrays.lisp: The dense-arrays/src/dense-arrays․lisp file
do-arrays.lisp: The dense-arrays/src/do-arrays․lisp file
do-arrays/element-type-failure: Private conditions

E
element-type-failure: Private conditions

F
File, aref.lisp: The dense-arrays/src/aref․lisp file
File, aref.lisp: The dense-arrays/optim/aref․lisp file
File, argwhere.lisp: The dense-arrays/src/argwhere․lisp file
File, broadcast.lisp: The dense-arrays/src/broadcast․lisp file
File, copy.lisp: The dense-arrays/src/copy․lisp file
File, dense-arrays.asd: The dense-arrays/dense-arrays․asd file
File, dense-arrays.lisp: The dense-arrays/src/dense-arrays․lisp file
File, do-arrays.lisp: The dense-arrays/src/do-arrays․lisp file
File, misc.lisp: The dense-arrays/optim/misc․lisp file
File, package.lisp: The dense-arrays/src/package․lisp file
File, protocol.lisp: The dense-arrays/src/protocol․lisp file
File, types.lisp: The dense-arrays/src/types․lisp file
File, unupgraded.lisp: The dense-arrays/src/unupgraded․lisp file
File, unupgraded.lisp: The dense-arrays/optim/unupgraded․lisp file

I
int-index: Private types
int32: Private types
int64: Private types
invalid-index: Private conditions

M
misc.lisp: The dense-arrays/optim/misc․lisp file
Module, optim: The dense-arrays/optim module
Module, src: The dense-arrays/src module

O
optim: The dense-arrays/optim module

P
Package, dense-arrays: The dense-arrays package
package.lisp: The dense-arrays/src/package․lisp file
print-lines-exhausted: Private conditions
protocol.lisp: The dense-arrays/src/protocol․lisp file

R
rank-failure: Private conditions

S
simple-array: Public types
simple-dense-array: Private types
simple-unupgraded-array: Public types
size: Private types
slot-type-failure: Private conditions
src: The dense-arrays/src module
standard-dense-array: Public classes
standard-dense-array-class: Public classes
System, dense-arrays: The dense-arrays system

T
Type, %dense-array: Private types
Type, array: Public types
Type, int-index: Private types
Type, int32: Private types
Type, int64: Private types
Type, simple-array: Public types
Type, simple-dense-array: Private types
Type, simple-unupgraded-array: Public types
Type, size: Private types
Type, uint32: Private types
Type, uint64: Private types
Type, unupgraded-array: Public types
types.lisp: The dense-arrays/src/types․lisp file

U
uint32: Private types
uint64: Private types
unupgraded-array: Public types
unupgraded-dense-array: Public classes
unupgraded-dense-array-class: Private classes
unupgraded.lisp: The dense-arrays/src/unupgraded․lisp file
unupgraded.lisp: The dense-arrays/optim/unupgraded․lisp file

Jump to:   %  
A   B   C   D   E   F   I   M   O   P   R   S   T   U