Skip to content

Commit

Permalink
make sure dimensions match in complex(). fixes #3090
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed May 13, 2013
1 parent ef61047 commit c8cd71d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,7 @@ end
## promotion to complex ##

function complex{S<:Real,T<:Real}(A::Array{S}, B::Array{T})
if size(A) != size(B); error("argument dimensions must match"); end
F = similar(A, typeof(complex(zero(S),zero(T))))
for i=1:length(A)
F[i] = complex(A[i], B[i])
Expand Down
2 changes: 1 addition & 1 deletion test/dsp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
a = [1., 2., 1., 2.]
b = [1., 2., 3.]
@test_approx_eq conv(a, b) [1., 4., 8., 10., 7., 6.]
@test_approx_eq conv(complex(a, ones(4)), complex(b)) complex([1., 4., 8., 10., 7., 6.], [1. 3. 6. 6. 5. 3.])
@test_approx_eq conv(complex(a, ones(4)), complex(b)) complex([1., 4., 8., 10., 7., 6.], [1., 3., 6., 6., 5., 3.])

# Discrete cosine transform (DCT) tests

Expand Down

0 comments on commit c8cd71d

Please sign in to comment.