fftw.dct fails silently if imported after numpy

57 views
Skip to first unread message

Brian Yanoff

unread,
Aug 31, 2020, 3:41:54 PM8/31/20
to CVXOPT
I encountered a very frustrating behavior that was very hard to track down.
When attempting to use the discrete cosine transform function cvxopt.fftw.dct() it would sometimes perform no operation at all on the matrix. no error or warning messages are emitted, it just silently does nothing. Other times it would appear to work fine.

After much experimentation I discovered that importing numpy before importing cvxopt.fftw was to the root cause.


This code demonstrates the effect:

from cvxopt import matrix
# import numpy as np # importing here causes dct to silently become no_op()
from cvxopt.fftw import dct
import numpy as np # importing after dct works fine

x = np.zeros([10, 1])
x[5] = 1.0

y = matrix(x, tc='d')
dct(y)
print(y)


I am running
python 3.7.3
cvxopt 1.2.5
numpy 1.16.4
on Redhat Enterprise Llinux


--Brian

Martin

unread,
Sep 9, 2020, 2:20:09 PM9/9/20
to CVXOPT
Thanks for reporting this. How did you install CVXOPT? Using pip, using conda (if so, which channel?), or did you build from source?

Brian Yanoff

unread,
Sep 14, 2020, 3:29:28 AM9/14/20
to CVXOPT
I installed using pip.
Reply all
Reply to author
Forward
0 new messages