Skip to content

Commit

Permalink
add reference(algorithm) function
Browse files Browse the repository at this point in the history
  • Loading branch information
ranocha committed Mar 31, 2020
1 parent a286f38 commit 1494d4c
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Postprocessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ using FFTW
using OffsetArrays
using ToeplitzMatrices

"""
reference(algorithm)
Returns a citable reference for `algorithm`, e.g. a bibtex entry
for a scientific article or a book.
"""
function reference end

include("total_variation.jl")
include("fourier_pade.jl")

export reference
export total_variation, total_variation_denoising, total_variation_denoising!,
group_sparse_total_variation_denoising, group_sparse_total_variation_denoising!
export fourier_pade
Expand Down
16 changes: 16 additions & 0 deletions src/fourier_pade.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,19 @@ function fourier_pade(x, u, degree_num, degree_den)

real.(evalpoly.(x_p, Ref(num_p)) ./ evalpoly.(x_p, Ref(den_p)) .+ evalpoly.(x_m, Ref(num_m)) ./ evalpoly.(x_m, Ref(den_m)))
end

function reference(::typeof(fourier_pade))
"""
@article{driscoll2001pade,
title={A {P}ad{\'e}-based algorithm for overcoming the {G}ibbs phenomenon},
author={Driscoll, Tobin A and Fornberg, Bengt},
journal={Numerical Algorithms},
volume={26},
number={1},
pages={77--92},
year={2001},
publisher={Springer},
doi={10.1023/A:1016648530648}
}
"""
end
33 changes: 33 additions & 0 deletions src/total_variation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,23 @@ function total_variation_denoising!(dest::AbstractVector, source::AbstractVector
dest
end

function reference(::Union{typeof(total_variation_denoising),
typeof(total_variation_denoising!)})
"""
@article{condat2013direct,
title={A direct algorithm for 1-{D} total variation denoising},
author={Condat, Laurent},
journal={IEEE Signal Processing Letters},
volume={20},
number={11},
pages={1054--1057},
year={2013},
publisher={IEEE},
doi={10.1109/LSP.2013.2278339}
}
"""
end



"""
Expand Down Expand Up @@ -209,3 +226,19 @@ function group_sparse_total_variation_denoising!(dest::AbstractVector, source::A

dest
end

function reference(::Union{typeof(group_sparse_total_variation_denoising),
typeof(group_sparse_total_variation_denoising!)})
"""
@inproceedings{selesnick2013total,
title={Total variation denoising with overlapping group sparsity},
author={Selesnick, Ivan W and Chen, Po-Yu},
booktitle={2013 IEEE International Conference on Acoustics,
Speech and Signal Processing},
pages={5696--5700},
year={2013},
organization={IEEE},
doi={10.1109/ICASSP.2013.6638755}
}
"""
end
2 changes: 2 additions & 0 deletions test/fourier_pade_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ using Test
using LinearAlgebra, DelimitedFiles

@testset "Fourier Padé reconstruction" begin
println(devnull, reference(fourier_pade))

for T in (Float32, Float64)
data = readdlm(joinpath(@__DIR__, "test_u_piecewise_constant.txt"), comments=true)
x = T.(data[:, 1])
Expand Down
4 changes: 4 additions & 0 deletions test/total_variation_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ using Test
using LinearAlgebra, Random

@testset "total variation denoising" begin
println(devnull, reference(total_variation_denoising))

for T in (Float32, Float64)
x = range(zero(T), 2*one(T), length=1000)
y_true = sinpi.(x)
Expand All @@ -15,6 +17,8 @@ using LinearAlgebra, Random
end

@testset "group sparse total variation denoising" begin
println(devnull, reference(group_sparse_total_variation_denoising))

for T in (Float32, Float64)
x = range(zero(T), 2*one(T), length=1000)
y_true = sinpi.(x)
Expand Down

0 comments on commit 1494d4c

Please sign in to comment.