Skip to content

Pad b with zeros in the butterfly workspace - #118

Open
ArnoStrouwen wants to merge 1 commit into
JuliaLinearAlgebra:masterfrom
ArnoStrouwen:butterfly-zero-padding
Open

ArnoStrouwen wants to merge 1 commit into
JuliaLinearAlgebra:masterfrom
ArnoStrouwen:butterfly-zero-padding

Conversation

@ArnoStrouwen

Copy link
Copy Markdown

At a size that is not a multiple of 4, 🦋workspace pads b with rand(xn). The butterfly transform mixes these entries into the right-hand side, so padding of order 1 leaves rounding error of order 1e-16 on every entry of the solution, whatever the size of b.

using RecursiveFactorization, LinearAlgebra

n = 6
A = rand(n, n) + n * I; b = 1e-8 * rand(n)
ws = RecursiveFactorization.🦋workspace(copy(A), copy(b))
x = RecursiveFactorization.🦋solve!(ws, Val(false))
norm(A * x - b) / norm(b)    # about 1e-8. About 1e-16 at n = 8

The padded system is [A 0; 0 I] [x; y] = [b; r], so x does not depend on r in exact arithmetic and any value is valid. With zeros the residual is about 1e-16 for every scale of b. A solve also becomes reproducible bit for bit, and the workspace no longer draws from the global RNG.

Bumps the version to 0.2.31.

Written with Claude Code.

At a size that is not a multiple of 4 the workspace padded `b` with `rand(xn)`.
The butterfly transform mixes the padding into the right-hand side, so padding
of order 1 left rounding error of order 1e-16 on every entry of the solution.
A `b` of order 1e-8 lost half its digits.

The padded system is `[A 0; 0 I] [x; y] = [b; r]`, so any `r` is valid, and
zero adds no error. The workspace also no longer draws from the global RNG,
which makes a solve reproducible bit for bit.
@ArnoStrouwen

Copy link
Copy Markdown
Author

Does not look like a real invalidation to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant