mathstodon.xyz is one of the many independent Mastodon servers you can use to participate in the fediverse.
A Mastodon instance for maths people. We have LaTeX rendering in the web interface!

Server stats:

2.7K
active users

#vectors

0 posts0 participants0 posts today

#ReleaseWednesday — I just released a new version (v8.0.0) of thi.ng/vectors, an almost complete rewrite of the package with all of its ~900 vector operations. I've updated the Readme with a section of _potentially_ minor breaking changes, however I expect this to be a seamless upgrade for the vast majority of users...

I've recently written more about the reasons and implications of this update and I'll refer you to those posts instead of repeating them once more (see links below).

Just the top-level changes:

- Replaced dynamic code generation with higher-order templating to be usable with strict content security policies (when deployed online)
- New structure allows for vast majority of functions to have doc strings (and they do now)
- More consistent/less confusing naming for some operations
- Potentially improved tree-shaking and smaller project bundle sizes

Related to this update I've also refactored and fixed some bugs in other packages (e.g. color, geom, matrices). As a result both the color & matrix packages are now also free from dynamic codegen and therefore won't cause any problems with strict CSPs

Should you run into any issues regarding this update, please get in touch (also grateful for any other experience/impact reports... 🙏)

More info in these recent posts/threads:

- mastodon.thi.ng/@toxi/11429644
- mastodon.thi.ng/@toxi/11431965
- mastodon.thi.ng/@toxi/11433601

Happy coding!

thi.ng/vectorsOptimized 2d/3d/4d and arbitrary length vector operations, support for memory mapping/layouts
Continued thread

To put the "large" package size a little more into perspective: I don't know of any other feature-comparable JS vector library which provides all of the following:

- Generic n-dimensional float, int, uint, boolean vectors
- Size optimized versions for 2D/3D/4D (all types)
- Multiple-dispatch wrappers (auto-delegating to available optimized versions)
- Memory-mapped vectors and optimized versions for various memory layouts (e.g. SOA/AOS)
- Optimized versions of many vector-scalar ops
- Optimized compound operations (like multiply-add etc.)
- Vector randomizations (several approaches)
- 99% of GLSL vector operations & conversions
- Vector versions of most of JS `Math` ops
- Vector interpolations (linear, bilinear, cubic, quadratic...)
- 10 different distance functions & metrics
- Swizzling & vector coercion/extension
- Dozens of additional graphics, statistics & ML-related operations

Just a quick #ThingUmbrella update to say that I've already replaced the thi.ng/vectors package on the develop branch and after LOTS of deep experimentation have decided NOT to split up the package. There will be a few (minor) breaking changes, mainly because of enforcing more consistent naming and more granularity in some source files (therefore possibly changed imports, though only if you use direct ones for individual functions...). All in all, I've managed to keep the impact on users to a bare minimum (likely unnoticeable for most), even though it's pretty much a complete rewrite of the entire package (with all its ~900 functions)... This package is now almost 10 years old and I'm very happy how this refactor turned out!

In terms of file size impact: The FULL minified pkg bundle is now 56.4KB vs previously 48.5KB, however the code density has improved and the brotli-compressed pkg size is only 15.1KB (only 1KB larger than before), which I found absolutely incredible! 🎉 I also have to state once more that this package (and most others in #ThingUmbrella) are _designed for tree shaking_ and bundling. Hardly any project would ever use the full set of functions provided here all at once, most will only use a small/tiny subset...

Also — more importantly — many of the 185 example projects in the repo are now showing between 2-25% smaller final bundle sizes. Some also have become slightly larger, but so far I found the most by only ~2%...

Related to this change: I've also updated the thi.ng/color & thi.ng/matrices packages to be free from dynamic code generation now! The only packages still using `new Function(...)` are the following, but for those it's unavoidable and dynamic code generation is a core feature:

- thi.ng/pixel (custom pixel format definition/compilation)
- thi.ng/pixel-convolve (custom image convolution kernel compilation)
- thi.ng/shader-ast-js (Shader AST to JavaScript compilation)

I will do more testing over the coming days, then release new version(s) ASAP...

thi.ng/vectorsOptimized 2d/3d/4d and arbitrary length vector operations, support for memory mapping/layouts

In recent years every spring seems to turn into a period of _massive_ refactoring & restructuring in #ThingUmbrella — maybe it's a form of spring cleaning, even though the reasons[1] are not seasonal... Currently spending my nights reworking the thi.ng/vectors package (likely one of the most comprehensive vector packages available for TS/JS) and trying out different splits/structures, testing their impact on package sizes and usability in existing downstream packages. Currently over 3000 source files with uncommitted changes... aaaarrrgghh! 🤯

Most functions (vector operations) in this package exist in multiple versions (many code generated, but now in need to be updated): Generic n-dimensional, loop-free, optimized 2D/3D/4D versions and strided versions for manipulating vectors views of larger nD data buffers (supporting all kinds of data layouts, incl. AOS, SOA, hybrid...)

[1] mastodon.thi.ng/@toxi/11429644

thi.ng/vectorsOptimized 2d/3d/4d and arbitrary length vector operations, support for memory mapping/layouts

#TDR GBIF and @GigaScience have extended their third call data papers on #vectors of human disease for inclusion in a thematic series published in #GigaByteJournal!

The new deadline is 6 June 2025 🦟

Join the team for a #webinar to learn how to submit your work to the series, learn from previous examples of published work and get tips for submitting vector data to GBIF.

📍22 April 2025 17:00 - 18:00

Webinar:🔗 ow.ly/AEFN50VutFC

Call: 🔗ow.ly/jvHG50VutFB