Skip to content

[BUG] test failure for truncerr with ComplexF32 #73

@ogauthe

Description

@ogauthe

test_matrixalgebra.jl currently fails, it seems the truncation keeps a value that is well below its cut.

using LinearAlgebra: Diagonal, diag, norm
using MatrixAlgebraKit: qr_compact, svd_trunc
using StableRNGs: StableRNG
using TensorAlgebra.MatrixAlgebra: truncerr
using Test: @test, @test_broken

elt = ComplexF32
s = Diagonal(real(elt)[1.2, 0.9, 0.3, 0.2, 0.01])
n = length(diag(s))
rng = StableRNG(123)
u, _ = qr_compact(randn(rng, elt, n, n); positive=true)
v, _ = qr_compact(randn(rng, elt, n, n); positive=true)
a = u * s * v
ũ, s̃, ṽ = svd_trunc(
    a; trunc=truncerr(; atol=(norm(diag(s)) * (one(real(elt)) + eps(real(elt)))))
  )
@test_broken size(ũ) == (n, 0)
@test_broken all(s̃ .> (norm(diag(s)) * (one(real(elt)) + eps(real(elt)))))

This is specific to ComplexF32, all Complex64, Float64, Float32 are fine.

TensorAlgebra version 0.3.10, HEAD at d02ca66249eef72621aec5b24e5be09dbf96fd00
MatrixAlgebraKit v0.2.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions