HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
SiegeLord
RustAlgebloat
Rust2016–2016
SiegeLord / RustAlgebloat

RustAlgebloat

A Rust linear algebra library based on expression templates

2Distinct people
3Mentions
0Explicit recommenders
52GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A Rust linear algebra library based on expression templates

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by hour3 dated mentions

Observed mentions: 2016-12-21 22:48:17 UTC to 2016-12-22 11:37:38 UTC.

012016-12-21 22:00:00 UTC to 2016-12-21 23:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsDec 21, 22:002016-12-21 23:00:00 UTC to 2016-12-22 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-22 00:00:00 UTC to 2016-12-22 01:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-12-22 01:00:00 UTC to 2016-12-22 02:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-22 02:00:00 UTC to 2016-12-22 03:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-22 03:00:00 UTC to 2016-12-22 04:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-22 04:00:00 UTC to 2016-12-22 05:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsDec 22, 04:002016-12-22 05:00:00 UTC to 2016-12-22 06:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-22 06:00:00 UTC to 2016-12-22 07:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-22 07:00:00 UTC to 2016-12-22 08:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-22 08:00:00 UTC to 2016-12-22 09:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-22 09:00:00 UTC to 2016-12-22 10:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-22 10:00:00 UTC to 2016-12-22 11:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-12-22 11:00:00 UTC to 2016-12-22 12:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsDec 22, 11:00

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Dec 21, 22:002016-12-21 22:00:00 UTC2016-12-21 23:00:00 UTC101
Dec 21, 23:002016-12-21 23:00:00 UTC2016-12-22 00:00:00 UTC000
Dec 22, 00:002016-12-22 00:00:00 UTC2016-12-22 01:00:00 UTC101
Dec 22, 01:002016-12-22 01:00:00 UTC2016-12-22 02:00:00 UTC000
Dec 22, 02:002016-12-22 02:00:00 UTC2016-12-22 03:00:00 UTC000
Dec 22, 03:002016-12-22 03:00:00 UTC2016-12-22 04:00:00 UTC000
Dec 22, 04:002016-12-22 04:00:00 UTC2016-12-22 05:00:00 UTC000
Dec 22, 05:002016-12-22 05:00:00 UTC2016-12-22 06:00:00 UTC000
Dec 22, 06:002016-12-22 06:00:00 UTC2016-12-22 07:00:00 UTC000
Dec 22, 07:002016-12-22 07:00:00 UTC2016-12-22 08:00:00 UTC000
Dec 22, 08:002016-12-22 08:00:00 UTC2016-12-22 09:00:00 UTC000
Dec 22, 09:002016-12-22 09:00:00 UTC2016-12-22 10:00:00 UTC000
Dec 22, 10:002016-12-22 10:00:00 UTC2016-12-22 11:00:00 UTC000
Dec 22, 11:002016-12-22 11:00:00 UTC2016-12-22 12:00:00 UTC101

What Hacker News says

3 sources
LICM is very relevant: it allows hoisting various dimensions of the check up to the loop with the relevant induction variable, meaning LLVM only has to handle things of the pattern: for i in 0..X { if !(i < X) { panic!() } ... } It is capable of doing this with the various induction variable passes it has, showing that i < X is always true. There's also the IRCE (inductive range check elimination) [0] pass—which isn't listed in that document—that should help even more, if/when it is enabled. Hopefully you agree at this point that LLVM is perfectly capable of handling multidimensional arrays and matrices even if it doesn't have optimisation passes with names that obviously apply to them specifically. Most of the optimisations you keep talking about are basic consequences of other standard passes, a fact that has been pointed o
Read the rest
ut many times to you before. > Consider a matrix multiply, the most common operation in number-crunching Also an operation you won't be implementing manually if you actually care about performance (better implementation: call a BLAS library). And, any high performance implementation will be doing more than the naive triple-nested loop (blocking, SIMD, etc.). Focusing on this operation is somewhat missing the forest for the trees. > You're indexing through three 2D matrices along both axes. The indices are usually controlled by FOR statements, so the compiler knows the range the indices can take. Yes exactly, the compiler knows the range of the indices. > If the compiler knows about multidimensional arrays, it's easy to make those checks once at FOR loop entry. This is a non-sequitur: the compiler can still make/move the checks based on what the code looks like, without having to have a hardcoded concept of arrays. Ensuring optimisation passes are powerful enough to handle these sort of relatively straight-forward cases is more general than relying on a language-level concept of multidimensional arrays, as it allows them to apply to cases which can't quite be implemented with an array directly. > Although technically you could generate a special case This is exactly what compilers do, see the IRCE documentation. > The compiler can't optimize it that aggressively and fail early It certainly can: these sort of assertions shouldn't ever trigger, and with appropriate top level assertions (e.g. asserting that the dimensions of the incoming matrices work for multiplication) the compiler can easily see this. Also, the compiler can hoist assertions early if this cannot be observed externally, e.g. the loop kernel only mutates locals. > If all those optimizations really exist, why is there code like this (at https://github.com/SiegeLord/RustAlgebloat/blob/master/algeb...)? That code is almost 2 years old, and so the compiler will have improved since then. Of course, the compiler may not have improved enough (e.g. IRCE still may not be enabled). Additionally, there's a lot of uncertainity/lack of clarity (as demonstrated by your own comments) about exactly what the compiler can do, and so people may use `unsafe` unnecessarily. I've certainly been guilty of this myself, and been glad when people have pushed back in code-review, making me work a bit harder to get equal (or better) performance in safe code. [0]: http://llvm.org/docs/doxygen/html/InductiveRangeCheckElimina...
In Four years with Rust
Where does LLVM do that? LLVM does hoist of invariant code out of loops in the Loop Invariant Code Motion and Loop Strength Reduction phases.[1] But that's not enough. This isn't an invariant situation. Consider a matrix multiply, the most common operation in number-crunching. You're indexing through three 2D matrices along both axes. The indices are usually controlled by FOR statements, so the compiler knows the range the indices can take. If the compiler knows about multidimensional arrays, it's easy to make those checks once at FOR loop entry. But if those checks are in asserts, it's tougher. Is LLVM allowed to fail an assert early? If the array is 0..999, and the index is 0..1000, a subscript out of range condition will occur on iteration 1001. For best performance, you want to detect the subscript out of range condition at the poi
Read the rest
nt it becomes inevitable, rather than checking on every iteration and failing on iteration 1001. (Although technically you could generate a special case.) But that requires special treatment of "assert". In Rust, "assert!" is just a macro. The compiler can't optimize it that aggressively and fail early. Especially since you can now catch assertion failures during unwinding. If all those optimizations really exist, why is there code like this (at https://github.com/SiegeLord/RustAlgebloat/blob/master/algeb...)? MatrixMul<LHS, RHS> { unsafe fn raw_get(&self, r: usize, c: usize) -> f64 { let mut ret = 0.0; for z in 0..self.lhs.ncol() { ret += self.lhs.raw_get(r, z) * self.rhs.raw_get(z, c); } ret } } If what you say is true, all that unsafe stuff is unnecessary. [1] http://llvm.org/docs/Passes.html
In Four years with Rust
I listed two things Rust doesn't handle well without unsafe code, doubly linked lists and multidimensional arrays. Here are examples of both from popular repositories with high download numbers: - https://github.com/andelf/rust-adivon/blob/master/src/deque.... - https://github.com/andelf/rust-adivon/blob/master/src/queue.... These are all the doubly-linked list problem: struct Node<T> { item: T, next: Option<Box<Node<T>>>, prev: Rawlink<Node<T>> } Since this is templated code, it might be possible to break it by instantiating it on a type with unusual semantics. - https://github.com/BurntSushi/aho-corasick/blob/master/src/f... Looks like unsafe code for "performance reasons". But there are no comments near "unsafe", so it's hard to tell. - https://github.com/SiegeLord/RustAlgebloat/blob/master/algeb... M
Read the rest
atrix math. "Unsafe" all over the place, and unsafeness is exported, allowing the caller to do unsafe things. This is an example of why I occasionally stress the need for multidimensional array support at the language level. If the compiler knew about multidimensional arrays, it could optimize the subscript checks for them, avoiding code such as this. The unsafe version. The caller can store anywhere in memory. fn unsafe_set_idx(&self, $mat: &T, v: f64) { let $self_ = self; let (r, c) = $rc_expr; unsafe { $mat.raw_set(r, c, v) } } Safe, but inefficient version. The compiler can't hoist those checks out of loops. fn set_idx(&self, $mat: &T, v: f64) { let $self_ = self; let (r, c) = $rc_expr; assert!(r < $mat.nrow()); assert!(c < $mat.ncol()); unsafe { $mat.raw_set(r, c, v) } } This is the sort of thing that leads to exploits in code that reads things like JPEG files. Yet you can't do much better in Rust. That's why doing multidimensional arrays in macros and templates isn't good enough.
In Four years with Rust

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.