Closed jiahao closed 11 years ago
Not having looked at this, it would be great if you can make the testsuite better - all such patches are welcome. For now, I guess it at least makes sure that the complex wrappers work.
I also realized that the suite uses rand
instead of randn
and so only tests positive entries on top of this.
Unfortunately this does not appear to be a simple matter of adding imaginary components to the test matrices. Some of these tests appear to work only for real matrices and it would be quite a task to hunt down the ones that break for matrices with complex non-zero imaginary entries.
For example, if you add the lines marked ### to the beginning of test/linalg.jl:
for elty in (Float32, Float64, Complex64, Complex128)
a = convert(Matrix{elty}, a)
if elty <: Complex a += im*randn(n, n) end ###
asym = a' + a # symmetric indefinite
apd = a'*a # symmetric positive-definite
b = convert(Vector{elty}, b)
if elty <: Complex b += im*randn(n) end ###
The test @test_approx_eq apd * inv(capd) eye(elty, n)
fails and apd * inv(capd)
produces a matrix that is nowhere close to the identity.
It's fine to check that these real-valued operations work when the data type is complex, and to test the complex case properly we can just add new tests.
It appears that test/linalg.jl samples small random matrices and vectors for the tests, but it uses the same test data for the real and complex versions of the test. Thus it seems that no operations on imaginary components of the complex data ever get tested.