Giter Site home page Giter Site logo

xarray's Introduction

This package implements a generalized interface for array-like
objects.  The idea is that we should be able to index an object as

(xref object 1 2 3)

to retrieve or set an element.  This would be easy to do it aref was a
generic function, but it is not.  I describe a simple interface with a
few generic functions (xdims queries dimensions, xtype element type,
etc), any objects that has these methods is called "xrefable".

The nice part is that views on an array can also be xrefable.  For an
two-dimensional array *a*, 

(slice *a* :all 4)

selects the 4th column of an array.[1] This view is also xrefable, so
you can use

(setf (xref (slice *a* :all 4) 2) 9)

to set element 2 to 9.  Changes will be made in the original array
*a*, since this is a view.  But for functions that just expect an
array, they can use the interface (xref, xdims, etc) and not care
where it is coming from.

[1] The slice interface is similar to my affi package, but now
arbitrary index vectors are allowed, much like R.

I have also implemented permutations (generalized transpose), and
row-major projections.  If you want to collect the elements of a view
in an array, use (take object), which delivers a CL array.

There are convenience functions that for easy array/vector creation,
inspired by R:

(carray* '(2 3) 1 2 3 4d0 5 6)
  ;; => #2A((1.0d0 2.0d0 3.0d0) (4.0d0 5.0d0 6.0d0))

guess the type so that all of the elements would fit in.  See also
cvector and carray (manually specified type) and cvector*.


Roadmap:

1. unit testing.  supremely important.

2. integrate linear algebra routines, probably from GSLL.  It should
be easy to rig an xrefable interface to GSLL arrays.

3. upper- and lower-triangular matrices, etc.  xrefable elements can
be read-only, xref-writeable-p is an interface to test if an element
is writeable, it was included specifically for this.

4. decent printing for xrefable objects, I currently convert them to array.

5. integrate sparse matrices from cl-sparsematrix.

6. specialized subclasses for certain cases.  eg views on matrices, a
transpose-view would be much simpler (and faster, maybe?) than the
generalized permute.

7. certain views can be directly accommodated by LAPACK/GSLL (eg a
matrix with a stride).  Minor possibility for speedup/memory savings.


Tamas K Papp
[email protected]

xarray's People

Contributors

tpapp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.