Overview
| Comment: | The `examples/matrices/` example is ready, and all 22 checks in its `test.tcl` script pass. During performance measurement, I identified two instances of $M(i,j)$ access that were still slow, so I optimized them; since this involved modifying Tcl source code, the version has been updated to v16i. The example `matrices.tcl` defines the following types: ```tcl type def ligne3 list(3).double type def {-compact}matrix3 list(3).ligne3 type def {-compact}lot list.matrix3 ``` It also provides `mat::init`, `mat::header` (the expected header), and equivalent calculations implemented in Tcl, as well as `mat::rotz` for generating rotations. `mat_types.h` is generated via `type {c!}export`, and `test.tcl` verifies that it remains consistent with the defined types. `mat.c` provides the following C commands: Command Function `mat::trace`, `mat::det` Read a matrix using `Tcl_AnnotatedGetCells`, or via lists if the data is not stored in cells. `mat::mul` Returns the product, constructed in cells using `Tcl_AnnotatedCreateCells`. `mat::identite` Creates an identity matrix. `mat::lot_det` Reads a batch directly as a `matrix3[n]` array. `mat::layout` Returns the sizes as perceived by the compiler. `test.tcl` verifies: the memory layout; that Tcl and C produce identical results in both directions; a batch of 1,002 matrices; values not stored in cells; error handling. `bench.tcl` compares raw Tcl, typed Tcl (with or without cell-based storage), and C. `README.md` explains how to compile on Linux and MinGW, and how to regenerate the header file. Valgrind reports no issues with this example. Measurements (µs) |Operation |Raw Tcl |Typed Tcl (in arrays) |C| |:---|---:|---:|---:| |Determinant |1.0 |1.6 |0.22| |Product |5.6 |23 |1.1| |10,000 determinants |26,000 |21,000 |350| The typed Tcl product remains about 4 times slower than the raw version, because it constructs its indices ($A($i.0)) and its result matrix with every call. The two accelerated read operations (v16i) For a matrix within a batch—obtained via `foreach` or `lindex`—$M(i.j) is now read directly from the cell. Calculating 10,000 determinants in Tcl now takes 21 ms instead of 176 ms, making it faster than raw Tcl. For a typed list without `{-compact}` (e.g., `list.list(3).double`), $M(i.j) traverses the lists directly. The time for a single determinant calculation drops from 16.7 µs to 1.8 µs. The outputs are identical to those from v16b, which lacked this shortcut. Verifications All 68 tests pass—both with and without the compact form—and every file yields the same output in both cases. Valgrind reports no issues, aside from the standard warning regarding `executable_pe.tcl`. `make test` continues to show the same 61 failures. There is no kernel patch. `mat.so` is not included in the archive; you must compile `mat.c` (or `mat.dll` on Windows) and then run `tclsh test.tcl`. The documentation and schedule have been updated; `typeparse.zip` and `REPRISE.md` are attached. |
|---|---|
| Timelines: | family | ancestors | descendants | both | tip-764_tcl90 |
| Files: | files | file ages | folders |
| SHA3-256: |
7f8d29abf6c0566abc7d53cca36ddb55 |
| User & Date: | Florentis on 2026-10-26 06:42:44.423 |
| Other Links: | branch diff | manifest | tags |
Context
|
2026-10-27
| ||
| 07:32 | The typed Tcl product remains about 4 times slower than the raw version, because it constructs its i... check-in: f0108ca9bf user: Florentis tags: tip-764_tcl90 | |
|
2026-10-26
| ||
| 06:42 | The `examples/matrices/` example is ready, and all 22 checks in its `test.tcl` script pass. During p... check-in: 7f8d29abf6 user: Florentis tags: tip-764_tcl90 | |
| 04:24 | Version 16h is ready: your declaration will now be accepted, and it works for any number of dimensio... check-in: 1972295ee9 user: Florentis tags: tip-764_tcl90 | |
Changes
Modified typeparse/REPRISE.md
from [2af6c8f7f9]
to [baf55eb79b].
[diff]
Modified typeparse/VERSION
from [c395e73149]
to [01fba29c4d].
[diff]
Modified typeparse/doc/ANNOTATIONS.fr.md
from [4919664d22]
to [34aa82c5be].
[diff]
Added typeparse/exemples/matrices/LISEZMOI.md version [1d524e86e2].
Added typeparse/exemples/matrices/bench.tcl version [e97eba7a0a].
Added typeparse/exemples/matrices/mat.c version [62ffcc8d4c].
Added typeparse/exemples/matrices/mat_types.h version [165b309a9f].
Added typeparse/exemples/matrices/matrices.tcl version [a0e8c41cab].
Added typeparse/exemples/matrices/test.tcl version [e2d1c9ce65].
Modified typeparse/noyau/LISEZMOI.md
from [dcc2a872ee]
to [0cfbda1a6b].
[diff]
Modified typeparse/tclAnnotObj.c
from [60f8c4ab47]
to [24486bbffe].
[diff]
Modified typeparse/tclTypePath.c
from [d5e097ec7c]
to [4ce7963e01].
[diff]
Modified typeparse/tclTypes.h
from [333e8f75ea]
to [dac7dc0178].
[diff]
Modified typeparse/tests_tclsh/t90_listes_fixes_en_cases.out
from [41f50ab2b4]
to [295a56a96c].
[diff]
Modified typeparse/tests_tclsh/t90_listes_fixes_en_cases.tcl
from [4d1c43c441]
to [4328be198f].
[diff]