JLHub documentation vs official, why are they different and which is source of truth?

I noticed that the documentation of inv is richer on Juliahub JLHub doc than the official one.

In particular, it specifies that matrix inversion does throw on singular matrices, while the official doesn’t. In practice:

inv( 0. )    # Inf, no exception
inv( [0;;] ) # SingularException

So is this throw considered part of invs api or is it an undefined behavior (and an implementation dependent detail) ?

I ask because StaticArrays doesn’t throw, and I wonder if this is type piracy or not.

The Juliahub jlHub reference is for a pre-v1 version of Julia, the specific ones not immediately clear to me. For example, broadcast and broadcast_function make no mention of the loop-fusing dot syntax. In v1, broadcast and Base.BroadcastFunction exist for the same usage, but has largely been supplanted by dots.

It should for Matrix at least, I don’t know if there’s any requirement that inv throw SingularException for generic singular matrices, though SingularException’s docstring sure sounds that way. The jlHub reference actually has a typo in the duplicated section, [1 2; 2 4] is singular (det-erminant of zero) but [1 2; 3 4] is not. inv( 0. ) is a multiplicative inverse of scalar numbers, not matrices, so SingularException is irrelevant.

The inv(::SMatrix) method defined in StaticArrays dispatches on SMatrix, so it’s by definition not type piracy. It’s arguably violating inv or SingularException’s API.

1 Like

This is not JuliaHub. I have no idea why this exists—maybe the point is to generate traffic and/or SEO for the SQL analytics platform linked on the front page, which doesn’t appear to have anything to do with Julia—but it certainly isn’t a place to look for valid, up-to-date Julia documentation. As @Benny points out, the list of functions matches pre-1.0 Julia, including names like A_mul_B!.

Stick to the official documentation at https://docs.julialang.org.

3 Likes

Oh yeah this is not Juliahub sorry. I very often end up in there (when clicking first google results) because this site is very well referenced :confused:.

So regarding inv, I’ll open an issue to understand if the throw is part of the API and deserves to be documented…