chickadee » linear-algebra

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

This page is maintained in the package's github repository.

linear-algebra

This implements various linear algebra and other math operations. Much of this code is originally from Jeff Siskind's QobiScheme.

Line segments

define-structure line-segment p qrecord
p lprocedure
q lprocedure
collinear? l1 l2procedure
point-on-line-segment? r lprocedure
intersection-point l1 l2procedure
cross? l1 l2procedure
intersect? l1 l2procedure
line-tangent lprocedure
normal-2d lprocedure
line-segment-length lprocedure
read-line-segments-from-file pathnameprocedure
write-line-segments-to-file line-segments pathnameprocedure

Vectors

x vprocedure
y vprocedure
z vprocedure
dot u vprocedure
cross-2d u vprocedure
cross u vprocedure
v+ u vprocedure
v- u vprocedure
k*v k vprocedure
v*k v kprocedure
k+v k vprocedure
v+k v kprocedure
v/k v kprocedure
v* u vprocedure
v/ u vprocedure
v= u vprocedure
rotate-90 uprocedure
rotate-180 uprocedure
rotate-270 uprocedure
perpendicular? u vprocedure
parallel? u vprocedure
magnitude-squared vprocedure
magnitude vprocedure
unit vprocedure
distance-squared u vprocedure
distance u vprocedure
clockwise-angle? u v wprocedure
clockwise-or-same-angle? u v wprocedure
append-vector vec1 vec2procedure

Matrices

matrix? vprocedure
list->matrix lprocedure
make-matrix m n #!rest &restprocedure
make-3-by-3-matrix a11 a12 a13 a21 a22 a23 a31 a32 a33procedure
matrix-copy mprocedure
matrix-rows aprocedure
matrix-columns aprocedure
matrix-ref a i jprocedure
matrix-set! a i j xprocedure
matrix-row-ref a iprocedure
matrix-column-ref a jprocedure
matrix-row-set! a i vprocedure
vector->row-matrix vprocedure
vector->column-matrix vprocedure
m+ a bprocedure
m- a bprocedure
m+k m kprocedure
m+k-diagonal m kprocedure
k+m k mprocedure
m*v a vprocedure
matrix-transpose aprocedure
outer-product f u vprocedure
self-outer-product f vprocedure
m* a bprocedure
m*. a bprocedure
m/. a bprocedure
v*m v aprocedure
k*m k mprocedure
m*k m kprocedure
m/k m kprocedure
v*m*v v mprocedure
determinant aprocedure
invert-matrix aprocedure
simplex a m1 m2 m3procedure
jacobi aprocedure
eigenvalues aprocedure
eigenvectors aprocedure
vector->diagonal-matrix vprocedure
identity-matrix nprocedure
clip-eigenvalues a vprocedure
eigenvector-angle1 mprocedure
eigenvector-angle2 mprocedure
left-pseudo-inverse mprocedure
right-pseudo-inverse mprocedure
ref-1d m aprocedure
ref-2d m a bprocedure
ref-3d m a b cprocedure
ref-4d m a b c dprocedure
ref-5d m a b c d eprocedure
map-n-vector-2d f m nprocedure
map-n-vector-3d f m n pprocedure
map-n-vector-4d f m n p qprocedure
map-n-vector-5d f m n p q rprocedure
matrix-sum f n iprocedure
matrix-sum-2d f m n iprocedure
shape-matrix v cprocedure
unshape-matrix mprocedure
crop m x y w hprocedure
submatrix m x-offset y-offset x-size y-sizeprocedure
matrix-ref-nd m #!rest isprocedure
matrix-3d-ref a s i jprocedure
matrix-set-nd! m v #!rest isprocedure
matrix-3d-set! a v s i jprocedure
map-matrix-nd f m nprocedure
for-each-matrix-nd f m nprocedure
map-matrix f mprocedure
for-each-matrix f mprocedure
map-matrix-3d f mprocedure
for-each-matrix-3d f mprocedure
map-n-matrix f i jprocedure
for-each-n-matrix f i jprocedure
map-indexed-matrix f mprocedure
for-each-indexed-matrix f mprocedure
map-indexed-matrix-3d f pprocedure
for-each-indexed-matrix-3d f pprocedure

Sparse matrices

define-structure sparse-matrix row column blankrecord
define-structure sparse-matrix-row element i up downrecord
define-structure sparse-matrix-column element j left rightrecord
define-structure sparse-matrix-element value i up down j left rightrecord
create-sparse-matrix blankprocedure
sparse-matrix-ref sparse-matrix i jprocedure

Traversal

every-n-2d p v wprocedure
every-n-3d p v w xprocedure
every-n-4d p v w x yprocedure
every-n-5d p v w x y zprocedure
product-2d f m nprocedure
sum-2d f m nprocedure
sum-3d f m n pprocedure
sum-4d f m n p qprocedure
sum-pairs f mprocedure
vector-sum f n iprocedure
vector-sum-2d f m n iprocedure
sum-f f lprocedure
sum-vector vprocedure
sum-vector-f f vprocedure

Statistics

list-mean pprocedure
list-covariance lprocedure
list-variance sprocedure
list-skewness lprocedure
list-kurtosis lprocedure
list-correlation l1 l2procedure
vector-mean vprocedure
vector-variance vprocedure
vector-skewness vprocedure
vector-kurtosis vprocedure
vector-correlation v1 v2procedure
coefficient-of-bimodality vprocedure
vectors-mean valuesprocedure
vectors-variance mu valuesprocedure
mahalanobis-distance val mu isigmaprocedure
frequencies lprocedure

Misc

*linear-algebra:epsilon*parameter
piconstant
half-piconstant
two-piconstant
minus-piconstant
two-pi/360constant
three-sixty/two-piconstant
sqr xprocedure
quadratic1 a b cprocedure
quadratic2 a b cprocedure

License

  Copyright 2010-2012 Purdue University. All rights reserved.
  Contact Andrei Barbu, andrei@0xab.com.
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Lesser General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Lesser General Public License for more details.
  You should have received a copy of the GNU Lesser General Public License
  along with this program.  If not, see http://www.gnu.org/licenses.

Contents »