This optimizes the complex dilogarithm Li2 using targeted mappings
(reflection/inversion), a real-axis fast path, and a Bernoulli-in-x
expansion (x = -log(1 - z)), inspired by this Rust implementation[1]
(and references therein). The exported API remains unchanged, and
runtime improvements are measured by an added BenchmarkLi2.
Performance improvements range from a few percent to large factors,
depending on the region of the complex plane.
[1]https://github.com/Expander/polylog.rs
This CL fixes the following compilation error while running 'go test':
```
Error: cmplxs/cmplxs_test.go:476:12: non-constant format string in call to (*testing.common).Errorf
```
Signed-off-by: Sebastien Binet <binet@cern.ch>
Despite not showing a change in ragel -v output, the new version of
ragel (6.10-4 over 6.10-1 on my local machine) has a different output.
The differences appear to be incorrect in the new version, but will not
change the behaviour except for the reported lines in a panic or other
stack trace, so let's just go with what the new version has.
This is not intended to be a completed transition since it leaves the
libraries unusable to external client code, but rather as a step towards
use of math/rand/v2. This initial step allows repair of sequence change
failures without having to worry about API difference.
Add single-pair shortest path variant of Dijkstra. This variant can terminate
early when the target is reached, potentially make a large difference in
running time for Yen's k-shortest paths algorithm, as it makes many calls to
the shortest path subroutine.
The variant is also exposed for external use.
When a matrix is very tall, calculating Q will currently allocate a
large Q at the end of the factorisation, even if it is not going to be
used, and a large Q matrix can lead to out of memory issues.
For this reason, Q is never eagerly computed unless explicitly required
to by the user, with QR.ToQ.
To keep fulfilling the Matrix interface, the QR.At method will compute
the requested element only, which only require computing a single row of
Q.