Skip to content

Commit b49009a

Browse files
committed
0.6rc1
1 parent 04ca69c commit b49009a

24 files changed

Lines changed: 392 additions & 379 deletions

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ authors:
77
title: matrico
88
type: software
99
abstract: "A flonum matrix module for CHICKEN Scheme."
10-
version: 0.5
11-
date-released: 2023-06-06
10+
version: 0.6
11+
date-released: 2024-07-18
1212
commit:
1313
license: zlib-Acknowledgement
1414
repository: https://github.com/gramian/matrico

Makefile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CSC = csc
66
CSI = csi
77
CHICKEN_INSTALL = chicken-install
88
CHICKEN_PROFILE = chicken-profile
9-
TEST_NEW_EGG = test-new-egg # homebrew: /opt/homebrew/Cellar/chicken/5.3.0_1/bin/test-new-egg
9+
TEST_NEW_EGG = test-new-egg # homebrew: /opt/homebrew/Cellar/chicken/5.4.0/bin/test-new-egg
1010

1111
CLARG =
1212
LEVEL = -O3
@@ -29,7 +29,7 @@ test_egg_local:
2929
$(TAR) cvzf matrico-$(VERSION).tar.gz --transform 's,^,matrico/,' \
3030
AUTHORS CITATION.cff LICENSE README.md \
3131
matrico.egg matrico.release-info res/matrico-logo.svg \
32-
matrico.scm RUNME.scm version.scm \
32+
matrico.scm RUNME.sh version.scm \
3333
src/dense.scm src/f64vector.scm src/fpmath.scm src/matrix.scm src/mx.scm src/utils.scm \
3434
tests/check.scm tests/run.scm tests/test-f64vector.scm tests/test-fpmath.scm tests/test-matrico.scm tests/test-utils.scm
3535
python3 -m http.server --bind 127.0.0.1 &
@@ -60,8 +60,8 @@ mips:
6060
(import matrico) \
6161
(print "BogoMips:" #\space (matrico 'benchmark)) \
6262
(newline) \
63-
(exit)" | $(CSC) $(LEVEL) $(FLAGS) - -o /tmp/miads
64-
@/tmp/miads
63+
(exit)" | $(CSC) $(LEVEL) $(FLAGS) - -o /tmp/mips
64+
@/tmp/mips
6565

6666
matmul:LEVEL=-O5
6767
matmul:
@@ -96,8 +96,14 @@ linpack:
9696
@/tmp/linpack $(CLARG) 2> linpack.txt
9797
@cat linpack.txt
9898

99+
heat:
100+
csi -b demos/heat.scm
101+
102+
flame:
103+
csi -b demos/flame.scm
104+
99105
clean:
100106
rm -f test.csv test.mx linpack.txt matmul.txt \
101-
matrico.so matrico.import.scm matrico.import.so matrico.static.o \
107+
matrico.so *.import.scm *.import.so matrico.static.o \
102108
matrico.build.sh matrico.install.sh matrico.link matrico.static.so \
103109
matrico-$(VERSION).tar.gz PROFILE.* heat.csv flame.csv

README.md

Lines changed: 103 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
![matrico 0.5](res/matrico-logo.svg) matrico
2-
========================================
1+
![matrico 0.6](res/matrico-logo.svg) matrico
2+
============================================
33

44
* **Project**: matrico ([Esperanto for "matrix"](https://translate.google.com/?sl=eo&tl=en&text=matrico&op=translate))
55

@@ -9,7 +9,7 @@
99

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

12-
* **Version**: 0.5 (2023-06-06)
12+
* **Version**: 0.6 (2024-07-18)
1313

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

@@ -25,6 +25,8 @@
2525

2626
* **Wikidata**: https://www.wikidata.org/wiki/Q113997718
2727

28+
* **Container**: https://hub.docker.com/r/gramian/matrico
29+
2830
## Table of Contents
2931

3032
* [Getting Started](#getting-started)
@@ -37,6 +39,12 @@
3739

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

42+
### Try `matrico` Container
43+
44+
```shell
45+
docker run -it gramian/matrico
46+
```
47+
4048
### Clone and Try `matrico` Code
4149

4250
```shell
@@ -58,7 +66,7 @@ CHICKEN_REPOSITORY_PATH="`chicken-install -repository`:/my/egg/directory/" csi
5866
### Run Demo Codes
5967

6068
```shell
61-
csi RUNME.scm
69+
./RUNME.sh
6270
```
6371

6472
```shell
@@ -117,6 +125,8 @@ csi demos/flame.scm
117125

118126
* Common Lisp [CLEM](https://github.com/slyrus/clem)
119127

128+
* Chez Scheme [chez-matrices](https://github.com/LiamPack/chez-matrices)
129+
120130
* Racket [math/matrix](https://docs.racket-lang.org/math/matrices.html)
121131

122132
* Racket [flomat](https://docs.racket-lang.org/manual-flomat/)
@@ -130,7 +140,7 @@ csi demos/flame.scm
130140
* `dense` Module (Column Interface Specialization)
131141
* `matrix` Functor (Functional Matrix Backend)
132142
* `f64vector` Module (Homogeneous Flonum Vector Functions)
133-
* `fpmath` Module (Additional Flonum Functions)
143+
* `fpmath` Module (User-Facing Additional Flonum Functions)
134144
* `utils` Module (Additional Foundational Functions)
135145
* Extra Tools
136146
* `check` Library (Testing Helper Functions)
@@ -212,7 +222,7 @@ csi demos/flame.scm
212222

213223
* `(mx-any? pred mat)` returns **boolean** answering if any entry of **matrix** `mat` fulfills predicate **procedure** `pred`.
214224

215-
* `(mx-all? pred mat)` returns **boolean** answering if all entries of **matrix** `mat` fulfills predicate **procedure** `pred`.
225+
* `(mx-all? pred mat)` returns **boolean** answering if all entries of **matrix** `mat` fulfill predicate **procedure** `pred`.
216226

217227
* `(mx=? x y tol)` returns **boolean** answering if all entry-wise distances between **matrix**es `x` and `y` are below tolerance **flonum** `tol`.
218228

@@ -490,20 +500,76 @@ csi demos/flame.scm
490500

491501
* `(mx-trapz mat)` returns column-**matrix** trapezoid approximate integral of **matrix** `mat` being columns data-points of rows-dimensional function.
492502

493-
* `(mx-ode2-hyp num fun x0 dt tf)` returns states-times-steps **matrix** trajectory solving an ordinary differential equation, by a 2nd order hyperbolic Runge-Kutta method of **fixnum** `num` stages, with vector field **procedure** `fun`, initial state column-**matrix** `x0`, time step **flonum** `dt`, and time horizon **flonum** `tf`.
503+
* `(mx-ode2-hyp num sys tim x0)` states-times-steps **matrix** trajectory solving an ordinary differential equation, by a 2nd order hyperbolic Runge-Kutta method of **fixnum** `num` stages, with vector field **procedure** or **pair** of vector field and output **procedure**s `sys`, time step **flonum** and time horizon **flonum** in **pair** `tim`, initial state column-**matrix** `x0`.
494504

495-
* `(mx-ode2-ssp num fun x0 dt tf)` returns states-times-steps **matrix** trajectory solving an ordinary differential equation, by a 2nd order strong stability preserving Runge-Kutta method of **fixnum** `num` stages, with vector field **procedure** `fun`, initial state column-**matrix** `x0`, time step **flonum** `dt`, and time horizon **flonum** `tf`.
505+
* `(mx-ode2-ssp num sys tim x0)` states-times-steps **matrix** trajectory solving an ordinary differential equation, by a 2nd order strong stability preserving Runge-Kutta method of **fixnum** `num` stages, with vector field **procedure** or **pair** of vector field and output **procedure**s `sys`, time step **flonum** and time horizon **flonum** in **pair** `tim`, initial state column-**matrix** `x0`.
496506

497507
#### Matrix Utilities
498508

509+
* `(mx->list mat)` returns **list** of entries of one-dimensional **matrix** `mat`.
510+
499511
* `(mx-print mat)` returns **void**, prints **matrix** `mat` to terminal.
500512

501-
* `(mx-export str mat)` returns **void**, writes **matrix** `mat` to new comma-separated-value (CSV) file in relative path **string** `str`.
513+
* `(mx-export str mat . sep)` **void**, writes **matrix** `mat` to new **character** `sep`-separated-value file in relative path **string** `str`, by default `sep` is `,` resulting in CSV.
502514

503515
* `(mx-save str mat)` returns **void**, writes **matrix** `mat` to new Scheme (SCM) file in relative path **string** `str`.
504516

505517
* `(mx-load str)` returns **matrix** loaded from SCM file in relative path **string** `str`.
506518

519+
#### Extra Flonum Functions
520+
521+
The **matrico** module implicitly exports the [(chicken flonum)](http://wiki.call-cc.org/man/5/Module%20(chicken%20flonum)) module, as well as the following additional `flonum` operations:
522+
523+
* `fp` is **alias** for `exact->inexact`.
524+
525+
* `(fp% n d)` returns **flonum** fraction with numerator **fixnum** `n` and denominator **fixnum** `d`.
526+
527+
* `(fpzero?? x)` returns **boolean** answering if **flonum** `x` is exactly zero.
528+
529+
* `(fpzero? x tol)` returns **boolean** answering if absolute value of **flonum** `x` is less than **flonum** `tol`.
530+
531+
* `(fp*2 x)` returns **flonum** double of **flonum** `x`.
532+
533+
* `(fp^2 x)` returns **flonum** square of **flonum** `x`.
534+
535+
* `(fprec x)` returns **flonum** reciprocal of **flonum** `x`.
536+
537+
* `(fptau)` returns **flonum** circle constant Tau via fraction.
538+
539+
* `(fpeul)` returns **flonum** Euler's number via fraction.
540+
541+
* `(fpphi)` returns **flonum** golden ratio via fraction of consecutive Fibonacci numbers.
542+
543+
* `(fpdelta x)` returns **flonum** Kronecker delta of **flonum** `x`.
544+
545+
* `(fpheaviside x)` returns **flonum** Heaviside step function of **flonum** `x`.
546+
547+
* `(fpsign x)` returns **flonum** sign of **flonum** `x`.
548+
549+
* `(fpln x)` returns **flonum** natural logarithm of **flonum** `x`.
550+
551+
* `(fplb x)` returns **flonum** base-2 logarithm of **flonum** `x`.
552+
553+
* `(fplg x)` returns **flonum** base-10 logarithm of **flonum** `x`.
554+
555+
* `(fphsin x)` returns **flonum** haversed sine of **flonum** `x`.
556+
557+
* `(fphcos x)` returns **flonum** haversed cosine of **flonum** `x`.
558+
559+
* `(fplnsinh x)` returns **flonum** log-sinh of **flonum** `x`.
560+
561+
* `(fplncosh x)` returns **flonum** log-cosh of **flonum** `x`.
562+
563+
* `(fpsignsqrt x)` returns **flonum** sign times square root of absolute value of **flonum** `x`.
564+
565+
* `(fpsinc x)` returns **flonum** cardinal sine function with removed singularity of **flonum** `x`.
566+
567+
* `(fpsigm x)` returns **flonum** standard logistic function of **flonum** `x`, aka sigmoid.
568+
569+
* `(fpgauss x)` returns **flonum** Gauss bell curve function evaluation of **flonum** `x`.
570+
571+
* `(fpstirling x)` returns **flonum** Stirling approximation of factorial of **flonum** `x`.
572+
507573
</details>
508574

509575
### Internal Libraries and Modules
@@ -528,7 +594,7 @@ csi demos/flame.scm
528594

529595
* `(translate-rows idx)` returns **fixnum** for **matrix** `mat` translated row index **fixnum** `idx` (from 1-based to 0-based and from end).
530596

531-
* `(time-stepper typ fun x0 dt tf)` states-times-steps **matrix** trajectory solving an ordinary differential equation, by method **procedure** `typ`, with vector field **procedure** `fun`, initial state column-**matrix** `x0`, time step **flonum** `dt`, and time horizon **flonum** `tf`.
597+
* `(time-stepper typ sys tim x0)` states-times-steps **matrix** trajectory solving an ordinary differential equation, by method **procedure** `typ`, with vector field **procedure** or vector field and output function **pair**-of-**procedure**s `sys`, time step and time horizon **pair**-of-**flonum**s `tim`, initial state column-**matrix** `x0`.
532598

533599
#### Matrix Backend Library
534600
Defines the matrix type (record) as column-major list-of-columns and provides generic basic and functional methods wrapped in a functor
@@ -595,11 +661,11 @@ Defines the matrix type (record) as column-major list-of-columns and provides ge
595661

596662
* `(matrix-all? pred mat)` returns **boolean** answering if all entries of **matrix** `mat` fulfill predicate **procedure** `pred`.
597663

598-
* `(matrix-colfold fun ini mat)` returns row **matrix** resulting from folding by two-argument **procedure** `fun each column of **matrix** `mat`.
664+
* `(matrix-colfold fun ini mat)` returns row **matrix** resulting from folding by two-argument **procedure** `fun` each column of **matrix** `mat`.
599665

600-
* `(matrix-rowfold fun ini mat)` returns column **matrix** resulting from folding by two-argument **procedure** `fun each row of **matrix** `mat`.
666+
* `(matrix-rowfold fun ini mat)` returns column **matrix** resulting from folding by two-argument **procedure** `fun` each row of **matrix** `mat`.
601667

602-
* `(matrix-allfold fun ini mat)` returns **any** resulting from folding by two-argument **procedure** `fun all **matrix** `mat` entries.
668+
* `(matrix-allfold fun ini mat)` returns **any** resulting from folding by two-argument **procedure** `fun` all **matrix** `mat` entries.
603669

604670
* `(matrix-map fun mat)` returns **matrix** resulting from applying **procedure** `fun` to each entry of **matrix** `mat`.
605671

@@ -619,9 +685,11 @@ Defines the matrix type (record) as column-major list-of-columns and provides ge
619685

620686
* `(matrix-implode lst)` returns **matrix** of horizontally concatenated **list**-of-column-**matrix**es `lst`.
621687

688+
* `(matrix->list mat)` returns: **list** of entries of one-dimensional **matrix** `mat`.
689+
622690
* `(matrix-print mat)` returns **void**, prints **matrix** `mat` to terminal.
623691

624-
* `(matrix-export str mat)` returns **void**, writes **matrix** `mat` to new comma-seperated-value (CSV) file in relative path (**string**) `str`.
692+
* `(matrix-export str mat sep)` returns **void**, writes **matrix** `mat` to new **character** `sep`-separated-value file in relative path (**string**) `str`.
625693

626694
* `(matrix-save str mat)` returns **void**, writes **matrix** `mat` to new Scheme (SCM) file in relative path (**string**) `str`.
627695

@@ -663,72 +731,10 @@ Provides homogeneous vector transformations analogous to vectors.
663731

664732
* `(f64vector-dot x y)` returns **flonum** resulting from applying fused-multiply-add to zero initialized accumulator and sequentially to all **f64vector**s `x`, `y` elements from left to right.
665733

666-
#### Floating-Point Module
667-
Provides additional mathematical functions, extending CHICKEN's `flonum` module.
668-
669-
* `fp` is **alias** for `exact->inexact`.
670-
671-
* `(fp% n d)` returns **flonum** fraction with numerator **fixnum** `n` and denominator **fixnum** `d`.
672-
673-
* `(fpzero? x tol)` returns **boolean** answering if absolute value of **flonum** `x` is less than **flonum** `tol`.
674-
675-
* `(fpzero?? x)` returns **boolean** answering if **flonum** `x` is exactly zero.
676-
677-
* `(fp*2 x)` returns **flonum** double of **flonum** `x`.
678-
679-
* `(fp^2 x)` returns **flonum** square of **flonum** `x`.
680-
681-
* `(fprec x)` returns **flonum** reciprocal of **flonum** `x`.
682-
683-
* `(fp*+ x y z)` returns **flonum** sum with product: `x * y + z` of **flonum**s `x`, `y`, `z`.
684-
685-
* `(fptau)` returns **flonum** circle constant Tau via fraction.
686-
687-
* `(fpeul)` returns **flonum** Euler number via fraction.
688-
689-
* `(fpphi)` returns **flonum** golden ratio via fraction of consecutive Fibonacci numbers.
690-
691-
* `(fpdelta x)` returns **flonum** Kronecker delta of **flonum** `x`.
692-
693-
* `(fpheaviside x)` returns **flonum** Heaviside step function of **flonum** `x`.
694-
695-
* `(fpsign x)` returns **flonum** sign of **flonum** `x`.
696-
697-
* `(fpln x)` returns **flonum** natural logarithm of **flonum** `x`.
698-
699-
* `(fplb x)` returns **flonum** base-2 logarithm of **flonum** `x`.
700-
701-
* `(fplg x)` returns **flonum** base-10 logarithm of **flonum** `x`.
702-
703-
* `(fpsinh x)` returns **flonum** hyperbolic sine of **flonum** `x`.
704-
705-
* `(fpcosh x)` returns **flonum** hyperbolic cosine of **flonum** `x`.
706-
707-
* `(fptanh x)` returns **flonum** hyperbolic tangent of **flonum** `x`.
708-
709-
* `(fpasinh x)` returns **flonum** area hyperbolic sine of **flonum** `x`.
710-
711-
* `(fpacosh x)` returns **flonum** area hyperbolic cosine of **flonum** `x`.
712-
713-
* `(fpatanh x)` returns **flonum** area hyperbolic tangent of **flonum** `x`.
714-
715-
* `(fphsin x)` returns **flonum** haversed sine of **flonum** `x`.
716-
717-
* `(fphcos x)` returns **flonum** haversed cosine of **flonum** `x`.
718-
719-
* `(fplnsinh x)` returns **flonum** log-sinh of **flonum** `x`.
720-
721-
* `(fplncosh x)` returns **flonum** log-cosh of **flonum** `x`.
734+
#### Flonum Module
735+
Provides extra flonum procedures.
722736

723-
* `(fpsignsqrt x)` returns **flonum** sign times square root of absolute value of **flonum** `x`.
724-
725-
* `(fpsinc x)` returns **flonum** cardinal sine function with removed singularity of **flonum** `x`.
726-
727-
* `(fpsigm x)` returns **flonum** standard logistic function of **flonum** `x`, aka sigmoid.
728-
729-
* `(fpgauss x)` returns **flonum** Gauss bell curve function evaluation of **flonum** `x`.
730-
731-
* `(fpstirling x)` returns **flonum** Stirling approximation of factorial of **flonum** `x`.
737+
* `(fp*+ x y z)` returns **flonum** sum with product: `x * y + z` of **flonum**s `x`, `y`, `z`. (Fallback)
732738

733739
* `(fptaper x)` returns **string** representation of **flonum** `x` formatted to 8 character fixed width.
734740

@@ -737,9 +743,7 @@ Provides a few base functions, macros and aliases for convenience.
737743

738744
* `(define-syntax-rule (name args) (body ...))` returns **macro** generating single-rule macro.
739745

740-
* `(alias aka name)` returns **macro** replacing `aka` with `name`.
741-
742-
* `(must-be args)` **macro** wrapping `assert` of `and` with variable number of arguments.
746+
* `(must-be . args)` **macro** wrapping `assert` of `and` with variable number of arguments.
743747

744748
* `(comment . any)` returns **void**.
745749

@@ -843,12 +847,12 @@ make mips
843847

844848
* `CPU:` M2 (4+4 Cores @ 3.5Ghz)
845849
* `RAM:` 16GB (LPDDR5 @ 6400MT/s)
846-
* `SYS:` MacOS Monterey (12.6)
847-
* `SCM:` CHICKEN Scheme (5.3)
850+
* `SYS:` MacOS Monterey (12.7)
851+
* `SCM:` CHICKEN Scheme (5.4)
848852

849853
* MATMUL: `267` Megaflops
850-
* LINPACK: `319` Megaflops
851-
* BOGOMIPS: `275` Mips
854+
* LINPACK: `313` Megaflops
855+
* BOGOMIPS: `273` Mips
852856

853857
## Development
854858

@@ -866,7 +870,16 @@ make mips
866870

867871
### Changelog
868872

869-
<b>0.5</b> (2023-06-06)
873+
<b>0.6</b> (2024-07-18)
874+
875+
* **ADDED** `mx->list`
876+
* **IMPROVED** `mx-export`
877+
* **CHANGED** `mx-diag`
878+
* **CHANGED** `mx-qr`
879+
* **CHANGED** `mx-orth`
880+
* ... and many minor updates and fixes.
881+
882+
<details><summary markdown="span"><b>0.5</b> (2023-06-06)</summary>
870883

871884
* **ADDED** `f64vector-axpy`
872885
* **ADDED** `matrix-axpy`
@@ -875,6 +888,8 @@ make mips
875888
* **IMPROVED** `mx-solver`
876889
* ... and many minor updates and fixes.
877890

891+
</details>
892+
878893
<details><summary markdown="span"><b>0.4</b> (2023-06-01)</summary>
879894

880895
* **ADDED** `mx-angle`
@@ -950,4 +965,4 @@ make mips
950965

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

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

RUNME.scm renamed to RUNME.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
#! csi
2+
13
;;;; RUNME.scm
24

35
;;@project: matrico (numerical-schemer.xyz)
4-
;;@version: 0.5 (2023-06-06)
6+
;;@version: 0.6 (2024-07-18)
57
;;@authors: Christian Himpe (0000-0003-2194-6754)
68
;;@license: zlib-acknowledgement (spdx.org/licenses/zlib-acknowledgement.html)
7-
;;@summary: demo code
9+
;;@summary: demo codes
810

911
(import matrico)
1012

0 commit comments

Comments
 (0)