Skip to content

Commit a6ad7d1

Browse files
added PartialSquare docstrings
1 parent 7c0ae70 commit a6ad7d1

File tree

1 file changed

+57
-2
lines changed

1 file changed

+57
-2
lines changed

src/states.jl

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,61 @@ function (::NLAT3)(x_old::AbstractVector)
655655
return x_new
656656
end
657657

658+
@doc raw"""
659+
PartialSquare(eta)
660+
661+
Implement a partial squaring of the states as described in [^barbosa2021].
662+
663+
# Equations
664+
665+
```math
666+
\begin{equation}
667+
g(r_i) =
668+
\begin{cases}
669+
r_i^2, & \text{if } i \leq \eta_r N, \\
670+
r_i, & \text{if } i > \eta_r N.
671+
\end{cases}
672+
\end{equation}
673+
```
674+
675+
# Examples
676+
677+
```jldoctest
678+
julia> ps = PartialSquare(0.6)
679+
PartialSquare(0.6)
680+
681+
682+
julia> x_old = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
683+
10-element Vector{Int64}:
684+
0
685+
1
686+
2
687+
3
688+
4
689+
5
690+
6
691+
7
692+
8
693+
9
694+
695+
julia> x_new = ps(x_old)
696+
10-element Vector{Int64}:
697+
0
698+
1
699+
4
700+
9
701+
16
702+
25
703+
6
704+
7
705+
8
706+
9
707+
708+
709+
[^barbosa2021]: Barbosa, Wendson AS, et al.
710+
"Symmetry-aware reservoir computing."
711+
Physical Review E 104.4 (2021): 045307.
712+
"""
658713
struct PartialSquare <: NonLinearAlgorithm
659714
eta::Number
660715
end
@@ -668,6 +723,6 @@ function (ps::PartialSquare)(x_old::AbstractVector)
668723
x_new[idx] = x_old[idx]^2
669724
end
670725
end
671-
726+
672727
return x_new
673-
end
728+
end

0 commit comments

Comments
 (0)