Skip to content

Commit

Permalink
Fix norm of complex vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
ViralBShah committed Jun 25, 2011
1 parent 2c4082c commit db4de54
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 6 additions & 6 deletions j/linalg_blas.j
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand Down
5 changes: 5 additions & 0 deletions test/tests.j
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit db4de54

Please sign in to comment.