Skip to content

[BUG] Some SVD truncations don't work #115

@mtfishman

Description

@mtfishman

For example:

using BlockArrays: Block, blockedrange
using BlockSparseArrays: BlockSparseArray
using MatrixAlgebraKit: svd_trunc
r = blockedrange([2, 2])
a = BlockSparseArray{Float64}(undef, r, r)
a[Block(2, 2)] = randn(2, 2)
u, s, v = svd_trunc(a; trunc=(; atol=1e-3))
s

outputs something like:

2×2-blocked 4×4 BlockSparseMatrix{Float64, Matrix{Float64}, , }:
                    
                    
 ──────────┼───────────────────
      1.64506  0.0     
      0.0      0.359026

If Block(1, 1) is set instead, the truncation appears to work (i.e. it drops the unallocated block). Also, maxrank appears to work.

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