JuliaArrays / JuliaArrays/StaticArrays.jl

Discriminant calculation using fma

Open
#628 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature linear-algebra numerical-robustness
Dominant language
Julia
Stars
844
Forks
159
Avg merge
3d 21h
Merged PRs (30d)
3

Description

I was reading an interesting article about posits (thanks @simonbyrne!) and came across Kahan's algorithm for calculating discriminant which avoids catastrophic cancellation and looks cheap-ish on hardware with FMA. At some stage we should probably see whether it's a reasonable performance tradeoff for 2x2 _det and related computations:

// computes: ad-bc within +/- 3/2 ulp of exact
double discriminant(double a, double b, double c, double d)
{
  double w = b*c;
  double e = fma(-b,c,w);
  double f = fma(a,d,-w);
  return f+e;
}

Further analysis: http://www.ams.org/journals/mcom/2013-82-284/S0025-5718-2013-02679-8/home.html

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the 2x2 _det implementation and related computations in StaticArrays.jl. Compare the existing calculation with the supplied FMA-based discriminant, then benchmark accuracy and performance to determine whether the tradeoff is worthwhile.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.