Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f72df61f authored by hhakim's avatar hhakim
Browse files

Patch the PALM4MSA 2020 C++ implementation to correct the float 2-norm...

Patch the PALM4MSA 2020 C++ implementation to correct the float 2-norm resulting in NaN by recomputing them exceptionally using double precision.

This is another workaround to the 512-size Hadamard matrix factorization showed in the 5-th FAQ entry (the code is also copied below).

The root problem is an error on the 2-norm computation when using float precision (issue #236).

============
    from pyfaust import wht
    from pyfaust.fact import hierarchical
    from time import time
    import numpy as np
    dim = 512
    H = wht(dim, dtype='float')
    M = H.toarray()
    F = hierarchical(M, 'hadamard', on_gpu=False, backend=2020)
    print(error:, (F-H).norm()/H.norm())

    Output:
    Faust::hierarchical: 1/8
    Faust::hierarchical: 2/8
    Faust::hierarchical: 3/8
    Faust::hierarchical: 4/8
    Faust::hierarchical: 5/8
    Faust::hierarchical: 6/8
    Faust::hierarchical: 7/8
    Faust::hierarchical: 8/8
    terminate called after throwing an instance of 'std::runtime_error'
      what():  Error in update_lambda: S (the Faust) contains nan elements in at least one of its matrices, can't compute lambda.
    Aborted
=================
parent 3c7f798d
No related branches found
No related tags found
Loading
Pipeline #834025 skipped
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment