Skip to content

Commit

Permalink
Implement scalar division
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Sep 29, 2020
1 parent b5956a8 commit d46837f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/definitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ Broadcast.broadcasted(::Base.Broadcast.DefaultArrayStyle{1}, ::typeof(*), f::Fre
Frequencies(f.n_nonnegative, f.n, f.multiplier * x)
Broadcast.broadcasted(s::Base.Broadcast.DefaultArrayStyle{1}, ::typeof(*), x::Number, f::Frequencies) =
Broadcast.broadcasted(s, *, f, x)
Broadcast.broadcasted(::Base.Broadcast.DefaultArrayStyle{1}, ::typeof(/), f::Frequencies, x::Number) =
Frequencies(f.n_nonnegative, f.n, f.multiplier / x)

"""
fftfreq(n, fs=1)
Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ end
@test fftfreq(4, 1) .* 2 === fftfreq(4, 2)
@test 2 * fftfreq(4, 1) === fftfreq(4, 2)
@test 2 .* fftfreq(4, 1) === fftfreq(4, 2)

@test fftfreq(4, 1) / 2 === fftfreq(4, 1/2)
@test fftfreq(4, 1) ./ 2 === fftfreq(4, 1/2)
end
end

Expand Down

0 comments on commit d46837f

Please sign in to comment.