Skip to content

Commit 27a1755

Browse files
remove extra allocation in kernel function
1 parent 048f892 commit 27a1755

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

src/denoising_data.jl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export generate_uniform_blur, generate_gaussian_blur
33
"""
44
Implementation of the denoising problem described in
55
6-
<<<<<<< HEAD
76
Stella, L., Themelis, A. & Patrinos, P.
87
Forward–backward quasi-Newton methods for nonsmooth optimization problems.
98
Comput Optim Appl 67, 443–487 (2017). https://doi.org/10.1007/s10589-017-9912-y
@@ -14,16 +13,6 @@ Chouzenoux, E., Martin, S. & Pesquet, JC.
1413
A Local MM Subspace Method for Solving Constrained Variational Problems in Image Recovery.
1514
J Math Imaging Vis 65, 253–276 (2023). https://doi.org/10.1007/s10851-022-01112-z
1615
"""
17-
# non-allocating reshape
18-
# see https://github.com/JuliaLang/julia/issues/36313
19-
reshape_array(a, dims) = invoke(Base._reshape, Tuple{AbstractArray, typeof(dims)}, a, dims)
20-
=======
21-
Chouzenoux, E., Martin, S. & Pesquet, JC.
22-
A Local MM Subspace Method for Solving Constrained Variational Problems in Image Recovery.
23-
J Math Imaging Vis 65, 253276 (2023). https://doi.org/10.1007/s10851-022-01112-z
24-
25-
"""
26-
>>>>>>> 11df75c (Update project.toml and reduce allocations)
2716

2817
# Function to unpad an array
2918
function unpad(x, n_p, m_p, n)
@@ -61,20 +50,9 @@ end
6150
# Function to generate a Gaussian kernel
6251
function my_gaussian_kernel(kernel_size, kernel_sigma)
6352
x, y = meshgrid((-kernel_size):kernel_size, (-kernel_size):kernel_size)
64-
<<<<<<< HEAD
65-
normal = 1 / (2 * pi * kernel_sigma^2)
66-
kernel = exp(-((x ^ 2 + y ^ 2) / (2 * kernel_sigma^2))) * normal
67-
kernel ./= sum(kernel)
68-
=======
6953
normal = 1 / (2.0 * pi * kernel_sigma^2)
70-
<<<<<<< HEAD
71-
kernel = exp.(-((x .^ 2 + y .^ 2) / (2.0 * kernel_sigma^2))) * normal
72-
kernel .= kernel / sum(kernel)
73-
>>>>>>> 11df75c (Update project.toml and reduce allocations)
74-
=======
7554
kernel = exp.(-((x .^ 2 .+ y .^ 2) / (2.0 * kernel_sigma^2))) * normal
7655
kernel ./= sum(kernel)
77-
>>>>>>> a8c1f29 (denoising data remove extra allocation)
7856
return kernel
7957
end
8058

0 commit comments

Comments
 (0)