From db4de549338ac2e5b2184bceadbf850aa3895aae Mon Sep 17 00:00:00 2001 From: Viral Shah Date: Sat, 25 Jun 2011 07:35:35 +0530 Subject: [PATCH] Fix norm of complex vectors --- j/linalg_blas.j | 12 ++++++------ test/tests.j | 5 +++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/j/linalg_blas.j b/j/linalg_blas.j index dea2db4433b92..e7531540294f2 100644 --- a/j/linalg_blas.j +++ b/j/linalg_blas.j @@ -45,21 +45,21 @@ end # DOUBLE PRECISION FUNCTION DNRM2(N,X,INCX) -macro blas_norm(fname, eltype) +macro blas_norm(fname, eltype, ret_type) quote function norm(x::DenseVector{$eltype}) ccall(dlsym(libBLAS, $fname), - $eltype, + $ret_type, (Ptr{Int32}, Ptr{$eltype}, Ptr{Int32}), length(x), x, 1) end end end -@blas_norm :dnrm2_ Float64 -@blas_norm :snrm2_ Float32 -@blas_norm :znrm2_ Complex128 -@blas_norm :cnrm2_ Complex64 +@blas_norm :dnrm2_ Float64 Float64 +@blas_norm :snrm2_ Float32 Float32 +@blas_norm :dznrm2_ Complex128 Float64 +@blas_norm :scnrm2_ Complex64 Float32 # SUBROUTINE DGEMM(TRANSA,TRANSB,M,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC) # * .. Scalar Arguments .. diff --git a/test/tests.j b/test/tests.j index 65d24974312f6..97b37fb7b0490 100644 --- a/test/tests.j +++ b/test/tests.j @@ -799,3 +799,8 @@ end for i=10000:20000 @assert h[i]==i+1 end + +# fft + +#a = rand(8) + im*rand(8) +#@assert nom (ifft(fft(a)) - a) < 1e-8