Skip to content

Commit 0fea2ae

Browse files
committed
Update doc
1 parent 4e77f88 commit 0fea2ae

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

src/layers/comparison.jl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ end
3535
Compute an euclidean norm with domain size `dom_size` of a scalar.
3636
"""
3737
function co_euclidean(x; dom_size, params...)
38-
return co_euclidean_val(x; val = 0.0, dom_size)
38+
return co_euclidean_val(x; val=0.0, dom_size)
3939
end
4040

4141
"""
@@ -48,16 +48,21 @@ co_abs_diff_var_vars(x; nvars, params...) = abs(x - nvars)
4848
co_var_minus_vars(x; nvars)
4949
Return the difference `x - nvars` if positive, `0.0` otherwise, where `nvars` denotes the numbers of variables.
5050
"""
51-
co_var_minus_vars(x; nvars, params...) = co_var_minus_val(x; val = nvars)
51+
co_var_minus_vars(x; nvars, params...) = co_var_minus_val(x; val=nvars)
5252

5353
"""
5454
co_vars_minus_var(x; nvars)
5555
Return the difference `nvars - x` if positive, `0.0` otherwise, where `nvars` denotes the numbers of variables.
5656
"""
57-
co_vars_minus_var(x; nvars, params...) = co_val_minus_var(x; val = nvars)
57+
co_vars_minus_var(x; nvars, params...) = co_val_minus_var(x; val=nvars)
5858

5959

6060
# Parametric layers
61+
"""
62+
make_comparisons(param::Symbol)
63+
64+
Generate the comparison functions for the given parameter.
65+
"""
6166
make_comparisons(param::Symbol) = make_comparisons(Val(param))
6267

6368
function make_comparisons(::Val{:none})
@@ -84,7 +89,7 @@ end
8489
comparison_layer(param = false)
8590
Generate the layer of transformations functions of the ICN. Iff `param` value is set, also includes all the parametric comparison with that value. The operations are mutually exclusive, that is only one will be selected.
8691
"""
87-
function comparison_layer(parameters = Vector{Symbol}())
92+
function comparison_layer(parameters=Vector{Symbol}())
8893
comparisons = make_comparisons(:none)
8994

9095
for p in parameters
@@ -118,7 +123,7 @@ end
118123

119124
for (f, results) in funcs_param
120125
for (key, vals) in enumerate(data)
121-
@test f(vals.first; val = vals.second[1]) == results[key]
126+
@test f(vals.first; val=vals.second[1]) == results[key]
122127
end
123128
end
124129

@@ -130,15 +135,15 @@ end
130135

131136
for (f, results) in funcs_vars
132137
for (key, vals) in enumerate(data)
133-
@test f(vals.first, nvars = vals.second[2]) == results[key]
138+
@test f(vals.first, nvars=vals.second[2]) == results[key]
134139
end
135140
end
136141

137142
funcs_val_dom = [CN.co_euclidean_val => [1.4, 2.0]]
138143

139144
for (f, results) in funcs_val_dom
140145
for (key, vals) in enumerate(data)
141-
@test f(vals.first, val = vals.second[1], dom_size = vals.second[2])
146+
@test f(vals.first, val=vals.second[1], dom_size=vals.second[2])
142147
results[key]
143148
end
144149
end
@@ -147,7 +152,7 @@ end
147152

148153
for (f, results) in funcs_dom
149154
for (key, vals) in enumerate(data)
150-
@test f(vals.first, dom_size = vals.second[2]) results[key]
155+
@test f(vals.first, dom_size=vals.second[2]) results[key]
151156
end
152157
end
153158

src/utils.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ end
5757
as_bitvector(n::Int, max_n::Int = n)
5858
Convert an Int to a BitVector of minimal size (relatively to `max_n`).
5959
"""
60-
function as_bitvector(n::Int, max_n::Int = n)
60+
function as_bitvector(n::Int, max_n::Int=n)
6161
nm1 = n - 1
6262
v = falses(ceil(Int, log2(max_n)))
6363
i = 0
@@ -86,7 +86,7 @@ end
8686
reduce_symbols(symbols, sep)
8787
Produce a formatted string that separates the symbols by `sep`. Used internally for `show_composition`.
8888
"""
89-
function reduce_symbols(symbols, sep, parenthesis = true; prefix = "")
89+
function reduce_symbols(symbols, sep, parenthesis=true; prefix="")
9090
str = reduce((x, y) -> "$y$sep$x", map(s -> "$prefix$s", symbols))
9191
return parenthesis ? "[$str]" : str
9292
end
@@ -96,6 +96,8 @@ end
9696
9797
Application of an operation from the transformation layer. Used to generate more efficient code for all compositions.
9898
"""
99+
function tr_in end
100+
99101
@unroll function tr_in(tr, X, x; params...)
100102
@unroll for i = 1:length(tr)
101103
tr[i](x, @view(X[:, i]); params...)

0 commit comments

Comments
 (0)