Skip to content

Bug: nnz_niters counter doubles instead of incrementing #41

@Neplyakh

Description

@Neplyakh

Hi drelyea,

Thanks for maintaining this library. I’m using it for compressed sensing reconstruction in Scanning Tunneling Microscopy and it’s been very useful.

While skimming the source, I noticed what looks like a bug in the function spgl1 in the active-set stagnation counter. The code currently doubles nnz_niters instead of incrementing it:

if nnz_diff:
nnz_niters = 0
else:
nnz_niters += nnz_niters
if nnz_niters + 1 >= active_set_niters:
stat = EXIT_ACTIVE_SET

Since nnz_niters is initialized to 0, this update keeps it at 0 indefinitely (so EXIT_ACTIVE_SET would never trigger). I think the intended behavior is likely:

nnz_niters += 1

Is the doubling intentional or would you accept a fix/PR?

With kind regards,
G.N

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions