Skip to content

Commit

Permalink
0.5rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
gramian committed Jun 5, 2023
1 parent 136d1a6 commit 8d4ea6f
Show file tree
Hide file tree
Showing 23 changed files with 182 additions and 164 deletions.
8 changes: 4 additions & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ authors:
title: matrico
type: software
abstract: "A flonum matrix module for CHICKEN Scheme."
version: 0.4
date-released: 2023-06-01
version: 0.5
date-released: 2023-06-06
commit:
license: zlib-Acknowledgement
repository: https://github.com/gramian/matrico
url: https://numerical-schemer.xyz
keywords:
- "Lisp"
- "Scheme"
- "Chicken Scheme"
- "Matrix Calculations"
- "Matrix Computations"
- "Linear Algebra"

- "Numerics"
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ CHICKEN_INSTALL = chicken-install
CHICKEN_PROFILE = chicken-profile
TEST_NEW_EGG = test-new-egg # homebrew: /opt/homebrew/Cellar/chicken/5.3.0_1/bin/test-new-egg

# DEV-TEMP
TAR = gtar
SED = gsed
TEST_NEW_EGG = /opt/homebrew/Cellar/chicken/5.3.0_1/bin/test-new-egg

CLARG =
LEVEL = -O3
DEBUG = -d0
Expand Down Expand Up @@ -47,7 +52,7 @@ test_install:
CHICKEN_REPOSITORY_PATH="/tmp/matrico:`$(CHICKEN_INSTALL) -repository`" $(CSI) -e "(import matrico) (matrico 'citation)"

iprofile:
make matmul LEVEL='-O3' FLAGS='-profile' DIM=100
make linpack LEVEL='-O3' FLAGS='-profile' DIM=1000
ls -1 PROFILE.* | sort -n | head -n1 | $(CHICKEN_PROFILE)

sprofile:
Expand Down Expand Up @@ -100,4 +105,4 @@ clean:
rm -f test.csv test.mx linpack.txt matmul.txt \
matrico.so matrico.import.scm matrico.import.so matrico.static.o \
matrico.build.sh matrico.install.sh matrico.link matrico.static.so \
matrico-$(VERSION).tar.gz PROFILE.*
matrico-$(VERSION).tar.gz PROFILE.* heat.csv flame.csv
70 changes: 37 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![matrico 0.4](res/matrico-logo.svg) matrico
![matrico 0.5](res/matrico-logo.svg) matrico
========================================

* **Project**: matrico ([Esperanto for "matrix"](https://translate.google.com/?sl=eo&tl=en&text=matrico&op=translate))
Expand All @@ -9,7 +9,7 @@

* **License**: [zlib-acknowledgement](https://spdx.org/licenses/zlib-acknowledgement.html)

* **Version**: 0.4 (2023-06-01)
* **Version**: 0.5 (2023-06-06)

* **Depends**: [CHICKEN Scheme](http://call-cc.org) (>= 5.1)

Expand Down Expand Up @@ -37,6 +37,12 @@

`matrico` is a _Scheme_ module for numerical matrix computations encapsulated in a _CHICKEN Scheme_ egg.

### Clone and Try `matrico` Code

```shell
./matrico.sh
```

### Install and Test `matrico` Egg

```shell
Expand All @@ -49,26 +55,18 @@ CHICKEN_INSTALL_REPOSITORY="/my/egg/directory/" chicken-install -test matrico
CHICKEN_REPOSITORY_PATH="`chicken-install -repository`:/my/egg/directory/" csi
```

### Clone and Try `matrico` Code

```scheme
(load "matrico.scm")
### Run Demo Codes

(import matrico)
```

### Run Demo Code

```scheme
(load "RUNME.scm")
```shell
csi RUNME.scm
```

```scheme
(load "demos/heat.scm")
```shell
csi demos/heat.scm
```

```scheme
(load "demos/flame.scm")
```shell
csi demos/flame.scm
```

### Minimal Explanation
Expand Down Expand Up @@ -250,8 +248,6 @@ CHICKEN_REPOSITORY_PATH="`chicken-install -repository`:/my/egg/directory/" csi

* `(mx-where pred x y)` returns **matrix** of entries of **matrix**es `x` or `y` based on predicate **procedure** `pred`.

* `(mx*+ a x y)` returns **matrix** of entry-wise generalized addition of **flonum** `a` times **matrix** `x` plus **matrix** `y`, aka axpy.

#### Matrix Mappers

##### Elementary Functions
Expand Down Expand Up @@ -422,6 +418,8 @@ CHICKEN_REPOSITORY_PATH="`chicken-install -repository`:/my/egg/directory/" csi

* `(mx-transpose mat)` returns **matrix** of entries of **matrix** `mat` with swapped row and column indices.

* `(mx-axpy a x y)` returns **matrix** of entry-wise generalized addition of **flonum** `a` times **matrix** `x` plus **matrix** `y`, aka "a times x plus y".

* `(mx-sympart mat)` returns **matrix** being symmetric part of square **matrix** `mat`.

* `(mx-skewpart mat)` returns **matrix** being skey-symmetric part of square **matrix** `mat`, aka anti-symmetric part.
Expand Down Expand Up @@ -611,6 +609,8 @@ Defines the matrix type (record) as column-major list-of-columns and provides ge

* `(matrix-transpose mat)` returns **matrix** of entries of **matrix** `mat` with swapped row and column indices.

* `(matrix-axpy a x y)` returns **matrix** resulting from scaling **matrix** `x` by **any** `a` and add **matrix** `y`.

* `(matrix-scalar xt y)` returns **any** resulting from the scalar product of column-**matrix**es `xt` and `y`.

* `(matrix-dot* xt y)` returns **matrix** resulting from matrix multiplication of transposed of **matrix** `xt` and **matrix** `y`.
Expand Down Expand Up @@ -655,6 +655,8 @@ Provides homogeneous vector transformations analogous to vectors.

* `(f64vector-foreach-index fun . vecs)` returns **void**, applies **procedure** `fun` to index and all corresponding **f64vector**(s) `vecs` elements.

* `(f64vector-axpy a x y)` returns **f64vector** resulting from applying fused-multiply-add to the **flonum** `a` and to all **f64vector**s `x`, `y` elements.

* `(f64vector-fold fun ini . vecs)` returns **any** resulting from applying **procedure** `fun` to `ini` initialized accumulator and sequentially to all **f64vector**(s) `vecs` elements from left to right.

* `(f64vector-fold* fun ini . vecs)` returns **any** resulting from applying **procedure** `fun` to `ini` initialized accumulator and sequentially to all **f64vector**(s) `vecs` elements from right to left.
Expand All @@ -678,7 +680,7 @@ Provides additional mathematical functions, extending CHICKEN's `flonum` module.

* `(fprec x)` returns **flonum** reciprocal of **flonum** `x`.

* `(fp*+ z x y)` returns **flonum** sum with product: `x * y + z` of **flonum**s `x`, `y`, `z`.
* `(fp*+ x y z)` returns **flonum** sum with product: `x * y + z` of **flonum**s `x`, `y`, `z`.

* `(fptau)` returns **flonum** circle constant Tau via fraction.

Expand Down Expand Up @@ -844,8 +846,8 @@ make mips
* `SYS:` MacOS Monterey (12.6)
* `SCM:` CHICKEN Scheme (5.3)

* MATMUL: `1230` Megaflops
* LINPACK: `185` Megaflops
* MATMUL: `267` Megaflops
* LINPACK: `319` Megaflops
* BOGOMIPS: `275` Mips

## Development
Expand All @@ -858,13 +860,21 @@ make mips

* [`mx`] Add rank-revealing QR and pseudo-inverse via QR

* [`mx`] Add Eigenvalue decomposition and singular value decomposition
* [`mx`] Add Eigenvalue decomposition and singular value decomposition via QR

* [`mx`] Add [`asciichart`](https://github.com/kroitor/asciichart) interface or functionality
* [`mx`] Add [`UnicodePlot`](https://github.com/JuliaPlots/UnicodePlots.jl)-like lineplot functionality

### Changelog

<b>0.4</b> (2023-06-01)
<b>0.5</b> (2023-06-06)

* **ADDED** `f64vector-axpy`
* **ADDED** `matrix-axpy`
* **CHANGED** `mx*+` to `mx-axpy`
* **IMPROVED** `mx-qr`
* **IMPROVED** `mx-solver`

<details><summary markdown="span"><b>0.4</b> (2023-06-01)</summary>

* **ADDED** `mx-angle`
* **ADDED** `mx-var`
Expand All @@ -875,6 +885,8 @@ make mips
* **REMOVED** `mx-logb`
* ... and many minor updates and fixes.

</details>

<details><summary markdown="span"><b>0.3</b> (2022-09-16)</summary>

* **ADDED** `matrico` function
Expand Down Expand Up @@ -937,12 +949,4 @@ make mips

* `matrico` can be build with `-O5` if `matrico.scm` is included into the source.

### Ideas

* Alias for `.bashrc`:
```
alias matrico='CHICKEN_REPOSITORY_PATH="`chicken-install -repository`:/my/egg/directory/" csi -R matrico'
```

## [`matrico`](https://git.io/matrico) — a (:chicken: λ) :egg: for numerical schemers!

2 changes: 1 addition & 1 deletion RUNME.scm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;;;; RUNME.scm

;;@project: matrico (numerical-schemer.xyz)
;;@version: 0.4 (2023-06-01)
;;@version: 0.5 (2023-06-06)
;;@authors: Christian Himpe (0000-0003-2194-6754)
;;@license: zlib-acknowledgement (spdx.org/licenses/zlib-acknowledgement.html)
;;@summary: demo code
Expand Down
3 changes: 2 additions & 1 deletion demos/flame.scm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;;;; demo-flame.scm

;;@project: matrico (numerical-schemer.xyz)
;;@version: 0.4 (2023-06-01)
;;@version: 0.5 (2023-06-06)
;;@authors: Christian Himpe (0000-0003-2194-6754)
;;@license: zlib-acknowledgement (spdx.org/licenses/zlib-acknowledgement.html)
;;@summary: flame demo code
Expand All @@ -19,6 +19,7 @@
(define 2/h (/ 0.5 h))

(define A^T (mx-tridiag N (* 1.0 2/h) (* -4.0 2/h) (* 3.0 2/h)))
(mx-set! A^T (sub1 N) N (* 4.0 2/h))
(define B (mx-set (mx N 1 0.0) 1 1 (* 1.0 2/h)))
(define C^T (mx-set (mx N 1 0.0) N 1 1.0))

Expand Down
2 changes: 1 addition & 1 deletion demos/heat.scm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;;;; demo-heat.scm

;;@project: matrico (numerical-schemer.xyz)
;;@version: 0.4 (2023-06-01)
;;@version: 0.5 (2023-06-06)
;;@authors: Christian Himpe (0000-0003-2194-6754)
;;@license: zlib-acknowledgement (spdx.org/licenses/zlib-acknowledgement.html)
;;@summary: cooling demo code
Expand Down
14 changes: 8 additions & 6 deletions doc/matrico.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,6 @@ returns ''matrix'' of entry-wise exponentiation of ''matrix''es {{x}} to the {{y
<procedure>(mx-where pred x y)</procedure>
returns ''matrix'' of entries of ''matrix''es {{x}} or {{y}} based on predicate ''procedure'' {{pred}}.

<procedure>(mx*+ a x y)</procedure>
returns ''matrix'' of entry-wise generalized addition of ''flonum'' {{a}} times ''matrix'' {{x}} plus ''matrix'' {{y}}.

== Matrix Mappers

=== Entry-Wise Elementary Functions
Expand Down Expand Up @@ -400,6 +397,9 @@ returns ''matrix'' of vertically concatenated columns of ''matrix'' {{mat}}, aka
<procedure>(mx-transpose mat)</procedure>
returns ''matrix'' of entries of ''matrix'' {{mat}} with swapped row and column indices.

<procedure>(mx-axpy a x y)</procedure>
returns ''matrix'' of entry-wise generalized addition of ''flonum'' {{a}} times ''matrix'' {{x}} plus ''matrix'' {{y}}.

<procedure>(mx-sympart mat)</procedure>
returns ''matrix'' being symmetric part of square ''matrix'' {{mat}}.

Expand Down Expand Up @@ -536,8 +536,10 @@ Copyright (c) 2022 Christian Himpe. [[https://spdx.org/licenses/zlib-acknowledge

; 0.1 : Initial Release
; 0.2 : Major Update ([[https://github.com/gramian/matrico#changelog|details]])
; 0.2 : Major Update
; 0.3 : Major Update
; 0.3 : Major Update ([[https://github.com/gramian/matrico#changelog|details]])
; 0.4 : Minor Update
; 0.4 : Minor Update ([[https://github.com/gramian/matrico#changelog|details]])
; 0.5 : Minor Update ([[https://github.com/gramian/matrico#changelog|details]])
2 changes: 1 addition & 1 deletion matrico.egg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;;; matrico.egg

((version "0.4")
((version "0.5")
(synopsis "A flonum matrix module for CHICKEN Scheme.")
(author "Christian Himpe")
(category math)
Expand Down
2 changes: 2 additions & 0 deletions matrico.release-info
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@

(release "0.4rc1")
(release "0.4rel")

(release "0.5rc1")
7 changes: 4 additions & 3 deletions matrico.scm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;;;; matrico.scm

;;@project: matrico (numerical-schemer.xyz)
;;@version: 0.4 (2023-06-01)
;;@version: 0.5 (2023-06-06)
;;@authors: Christian Himpe (0000-0003-2194-6754)
;;@license: zlib-acknowledgement (spdx.org/licenses/zlib-acknowledgement.html)
;;@summary: A CHICKEN Scheme flonum matrix module.
Expand All @@ -21,7 +21,7 @@
mx-samecols? mx-samerows? mx-samedims?
mx-any? mx-all? mx=?
mx-ref11 mx-ref mx-set mx-set! mx-col mx-row mx-diag mx-submatrix
mx+ mx* mx- mx/ mx*2 mx^2 mx^ mx-where mx*+
mx+ mx* mx- mx/ mx*2 mx^2 mx^ mx-where
mx-round mx-floor mx-ceil
mx-abs mx-sign mx-delta mx-heaviside
mx-sin mx-cos mx-tan
Expand All @@ -43,6 +43,7 @@
mx-rownorm mx-colnorm mx-norm
mx-horcat mx-vercat
mx-vec mx-transpose
mx-axpy
mx-sympart mx-skewpart
mx-diagonal
mx-qr mx-solver mx-solve mx-orth mx-absdet mx-logdet
Expand All @@ -67,7 +68,7 @@
[else])

;;@assigns: matrico version number as pair.
(define-constant version '(0 . 4))
(define-constant version '(0 . 5))

;;@returns
(define (matrico . s)
Expand Down
3 changes: 2 additions & 1 deletion src/dense.scm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;;;; dense.scm

;;@project: matrico (numerical-schemer.xyz)
;;@version: 0.4 (2023-06-01)
;;@version: 0.5 (2023-06-06)
;;@authors: Christian Himpe (0000-0003-2194-6754)
;;@license: zlib-acknowledgement (spdx.org/licenses/zlib-acknowledgement.html)
;;@summary: dense column function aliases
Expand All @@ -28,6 +28,7 @@
(f64vector-map-index column-map-index)
(f64vector-foreach column-foreach)
(f64vector-foreach-index column-foreach-index)
(f64vector-axpy column-axpy)
(f64vector-fold column-fold)
(f64vector-fold* column-fold*)
(f64vector-dot column-dot)
Expand Down
Loading

0 comments on commit 8d4ea6f

Please sign in to comment.