The clem Reference Manual

Table of Contents

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

The clem Reference Manual

This is the clem Reference Manual, version 0.4.8, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 03:39:06 2018 GMT+0.


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

1 Introduction


More bogus changes.

Common-Lisp Egregious Matrices (CLEM)

This is Cyrus Harmon's matrix package for common-lisp. Documentation
should one day be found in doc/index.html.

Background

This was going to be called Common-Lisp Efficient Matrices (CLEM), but
since efficiency is relative, I've decided to back off of that claim
and call it Common-Lisp Egregious Matrices. It is a goal of the
project that one day the intended meaning of egregious in this context
will evolve from the "outstandingly bad" meaning to the "remarkably
good" sense. Unfortunately, we're probably closer to outstandingly bad
at this point.

Why are the matrices egregious?

Well, the main problem is a lack of efficeincy. Through relatively
profuse use of declarations, many of the main matrix operations are
efficient in the lisp-sense in that they are non-consing. It does not,
however, mean that they are particularly fast. This package has only
been tested on SBCL and SBCL's floating point performance is at least
decent. In theory, further tuning of the lisp matrix code and perhaps
the output of the compiler may help increase the performance here. As
it stands, matrix multiplication is an order of magnitude (base 10)
slower here than in BLAS. This performance is actually reasonably good
for a high-level language, in my opinion, and can hopefully be
improved upon. As informal benchmarks for comparison, I used BLAS and
a slightly hand-tuned matrix multiply written in C. Interestingly, I
could make the C version run about three times faster than the lisp
version, while the BLAS matrix multiply was another 3x faster than
that, yielding a roughly 10x speedup for BLAS relative to the CLEM
matrix multiply. It seems as though the performance hit is largely a
memory-access penalty. (Oh, I'll undoubtedly mention this again, but
at the moment this has only been tested on SBCL on PPC. It would be
interesting to see what the results on other processor families are,
but I would imagine they would be fairly similar.) Smarter memory
access patterns through the matrices to be multiplied and to
accumulate the results may help performance here.

But clearly there is more to life than matrix multiplication. One of
the goals of building this package in lisp is to get access to the
nice features of high-level languages. It's all well and good to write
matrix-intensive code in fortran, but I really wouldn't to write code
for interacting with databases, or for processing XML documents or for
serving web-applications in fortran. I hope that CLEM can be used in
contexts such as these.

Why not just use Matlab or R?

This is a very good question. First and foremost, I like the features
of the lisp language and miss them greatly when I go into those
environments. The editing and debugging tools of a modern common lisp
(Emacs/SLIME today and perhaps CLIMACS/SLIME in the not-too-distant
future) are a major win in my eyes. Yes, there are amazing libraries
for doing just about everything under the sun in both Matlab and R,
but they strike me as less-good for general purpose computing than
common lisp. These really should be treated as the pros and cons for
each are in fact quite different.

Matlab

One major problem with Matlab is the licensing model. Ensuring that
Matlab is on every computer to run Matlab software is quite
annoying. A second problem is that the language, while very nice for
building quick and dirty scripts and prototypes, doesn't seem to be
nearly as nice for building large systems as common lisp. More on this
later.

R

R is great, but it's interpreted language leads to performance
problems. It is true that the core math routines in general are
implemented in fast fortran down "under the covers", but for
higher-level processing, one is stuck with a mediocre interpreted
language. It's true that the R language is essentially a scheme
variant, but it is a scheme variant with a C-like syntax on top that,
in my opinion, leaves much to be desired in comparison with common
lisp.

What about Matlisp?

Yes, matlisp is very nice and interfaces with fortran libraries for
fast math performance. In fact, I have started working on tying CLEM
into matlisp. This will probably be more important for floating point
and complex matrices than for integer matrices. Integer matrices are
important to me as one of the main data types I will be working with
are images, so I wanted an efficient package for dealing with integer
matrices.

Anyway, we'll see if this ever proves to be useful. In the meantime,
it has been a fun exercise in trying to build a lisp-based system for
matrix math.

What does CLEM do?

Typed methods for matrix math
* mat-add
* mat-subtr
* mat-mult
* mat-mult-block (to replace mat-mult when fully debugged)
* mat-hprod (hadamard product (C_ij = A_ij * B_ij for all i,j))
* scalar-mult
* scalar-divide
* sum
* sum-range
* max-val
* min-val

Matrix type conversions

Convolution

Morphological Operations

* gaussian-blur
* dilate
* erode

Derivatives

* x-derivative
* y-derivative
* gradmag

Examples

Check out test for now. Hope to have more of this in the near future.



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

2 Systems

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


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

2.1 clem

Author

Cyrus Harmon <ch-lisp@bobobeach.com>

License

BSD

Version

0.4.8

Source

clem.asd (file)

Components

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

3 Modules

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


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

3.1 clem/src

Parent

clem (system)

Location

src/

Components

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

3.2 clem/src/typed-ops

Dependencies
Parent

src (module)

Location

src/typed-ops/

Components

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

4 Files

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


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

4.1 Lisp


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

4.1.1 clem.asd

Location

clem.asd

Systems

clem (system)


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

4.1.2 clem/src/defpackage.lisp

Parent

src (module)

Location

src/defpackage.lisp

Packages

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

4.1.3 clem/src/utilities.lisp

Dependency

defpackage.lisp (file)

Parent

src (module)

Location

src/utilities.lisp

Internal Definitions

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

4.1.4 clem/src/metaclasses.lisp

Dependency

defpackage.lisp (file)

Parent

src (module)

Location

src/metaclasses.lisp

Exported Definitions
Internal Definitions

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

4.1.5 clem/src/early-matrix.lisp

Dependencies
Parent

src (module)

Location

src/early-matrix.lisp

Exported Definitions

matrix (class)

Internal Definitions

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

4.1.6 clem/src/mref.lisp

Dependency

early-matrix.lisp (file)

Parent

src (module)

Location

src/mref.lisp

Exported Definitions
Internal Definitions

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

4.1.7 clem/src/macros.lisp

Dependencies
Parent

src (module)

Location

src/macros.lisp

Internal Definitions

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

4.1.8 clem/src/matrix-classes.lisp

Dependencies
Parent

src (module)

Location

src/matrix-classes.lisp

Exported Definitions
Internal Definitions

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

4.1.9 clem/src/matrix.lisp

Dependencies
Parent

src (module)

Location

src/matrix.lisp

Exported Definitions
Internal Definitions

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

4.1.10 clem/src/print.lisp

Dependency

matrix.lisp (file)

Parent

src (module)

Location

src/print.lisp

Exported Definitions
Internal Definitions

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

4.1.11 clem/src/typed-matrix.lisp

Dependencies
Parent

src (module)

Location

src/typed-matrix.lisp

Exported Definitions
Internal Definitions

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

4.1.12 clem/src/mloop.lisp

Dependencies
Parent

src (module)

Location

src/mloop.lisp

Exported Definitions

mloop (macro)

Internal Definitions

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

4.1.13 clem/src/defmatrix.lisp

Dependencies
Parent

src (module)

Location

src/defmatrix.lisp

Internal Definitions

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

4.1.14 clem/src/defmatrix-types.lisp

Dependency

defmatrix.lisp (file)

Parent

src (module)

Location

src/defmatrix-types.lisp

Exported Definitions
Internal Definitions

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

4.1.15 clem/src/scalar.lisp

Dependency

matrix.lisp (file)

Parent

src (module)

Location

src/scalar.lisp

Exported Definitions
Internal Definitions

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

4.1.16 clem/src/typed-matrix-utils.lisp

Dependency

typed-matrix.lisp (file)

Parent

src (module)

Location

src/typed-matrix-utils.lisp

Exported Definitions
Internal Definitions

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

4.1.17 clem/src/vector.lisp

Dependency

matrix.lisp (file)

Parent

src (module)

Location

src/vector.lisp

Exported Definitions
Internal Definitions

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

4.1.18 clem/src/matrixops.lisp

Dependency

typed-matrix-utils.lisp (file)

Parent

src (module)

Location

src/matrixops.lisp

Exported Definitions
Internal Definitions

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

4.1.19 clem/src/interpolation.lisp

Dependencies
Parent

src (module)

Location

src/interpolation.lisp

Internal Definitions

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

4.1.20 clem/src/transform.lisp

Dependencies
Parent

src (module)

Location

src/transform.lisp

Exported Definitions
Internal Definitions

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

4.1.21 clem/src/extrema.lisp

Dependencies
Parent

src (module)

Location

src/extrema.lisp

Exported Definitions
Internal Definitions

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

4.1.22 clem/src/add.lisp

Dependencies
Parent

src (module)

Location

src/add.lisp

Exported Definitions
Internal Definitions

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

4.1.23 clem/src/subtr.lisp

Dependencies
Parent

src (module)

Location

src/subtr.lisp

Exported Definitions
Internal Definitions

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

4.1.24 clem/src/scale.lisp

Dependencies
Parent

src (module)

Location

src/scale.lisp

Exported Definitions

mat-scale (method)

Internal Definitions

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

4.1.25 clem/src/move.lisp

Dependencies
Parent

src (module)

Location

src/move.lisp

Exported Definitions
Internal Definitions

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

4.1.26 clem/src/sum.lisp

Dependencies
Parent

src (module)

Location

src/sum.lisp

Exported Definitions
Internal Definitions

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

4.1.27 clem/src/arithmetic.lisp

Dependencies
Parent

src (module)

Location

src/arithmetic.lisp

Exported Definitions

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

4.1.28 clem/src/log.lisp

Dependencies
Parent

src (module)

Location

src/log.lisp

Exported Definitions
Internal Definitions

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

4.1.29 clem/src/logical-operations.lisp

Dependencies
Parent

src (module)

Location

src/logical-operations.lisp

Exported Definitions
Internal Definitions

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

4.1.30 clem/src/abs.lisp

Dependencies
Parent

src (module)

Location

src/abs.lisp

Exported Definitions
Internal Definitions

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

4.1.31 clem/src/normalize.lisp

Dependencies
Parent

src (module)

Location

src/normalize.lisp

Exported Definitions

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

4.1.32 clem/src/statistics.lisp

Dependencies
Parent

src (module)

Location

src/statistics.lisp

Internal Definitions

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

4.1.33 clem/src/exponential.lisp

Dependencies
Parent

src (module)

Location

src/exponential.lisp

Exported Definitions
Internal Definitions

def-matrix-square (macro)


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

4.1.34 clem/src/typed-ops/defmatrix-equal.lisp

Parent

typed-ops (module)

Location

src/typed-ops/defmatrix-equal.lisp

Exported Definitions
Internal Definitions

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

4.1.35 clem/src/typed-ops/defmatrix-hprod.lisp

Parent

typed-ops (module)

Location

src/typed-ops/defmatrix-hprod.lisp

Exported Definitions
Internal Definitions

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

4.1.36 clem/src/typed-ops/defmatrix-mult.lisp

Parent

typed-ops (module)

Location

src/typed-ops/defmatrix-mult.lisp

Exported Definitions
Internal Definitions

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

4.1.37 clem/src/typed-ops/defmatrix-mult-block.lisp

Parent

typed-ops (module)

Location

src/typed-ops/defmatrix-mult-block.lisp

Internal Definitions

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

4.1.38 clem/src/typed-ops/defmatrix-transform.lisp

Parent

typed-ops (module)

Location

src/typed-ops/defmatrix-transform.lisp

Internal Definitions

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

4.1.39 clem/src/typed-ops/defmatrix-scale.lisp

Parent

typed-ops (module)

Location

src/typed-ops/defmatrix-scale.lisp

Internal Definitions

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

4.1.40 clem/src/typed-ops/defmatrix-subset-matrix.lisp

Parent

typed-ops (module)

Location

src/typed-ops/defmatrix-subset-matrix.lisp

Exported Definitions

subset-matrix (method)

Internal Definitions

def-matrix-subset-matrix (macro)


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

4.1.41 clem/src/typed-ops/defmatrix-convolve.lisp

Parent

typed-ops (module)

Location

src/typed-ops/defmatrix-convolve.lisp

Exported Definitions
Internal Definitions

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

4.2 Other


Next: , Previous: , Up: Other files   [Contents][Index]

4.2.1 clem/bootstrap

Parent

clem (system)

Location

bootstrap.lisp


Next: , Previous: , Up: Other files   [Contents][Index]

4.2.2 clem/COPYRIGHT

Parent

clem (system)

Location

COPYRIGHT


Next: , Previous: , Up: Other files   [Contents][Index]

4.2.3 clem/NEWS

Parent

clem (system)

Location

NEWS


Next: , Previous: , Up: Other files   [Contents][Index]

4.2.4 clem/ChangeLog

Parent

clem (system)

Location

ChangeLog


Next: , Previous: , Up: Other files   [Contents][Index]

4.2.5 clem/README

Parent

clem (system)

Location

README


Previous: , Up: Other files   [Contents][Index]

4.2.6 clem/make-dist

Parent

clem (system)

Location

make-dist.sh


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

5 Packages

Packages are listed by definition order.


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

5.1 clem-user

Source

defpackage.lisp (file)

Use List

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

5.2 clem

Source

defpackage.lisp (file)

Use List
Used By List

clem-user

Exported Definitions
Internal Definitions