self_loop!
ReservoirComputing.self_loop! — Function
self_loop!([rng], reservoir_matrix, weight; signs = nothing)Adds jumps to a given reservoir_matrix with chosen weight and determined jump_size. weight can be either a number or an array.
Arguments
rng: Random number generator. Default isUtils.default_rng()from WeightInitializers.reservoir_matrix: matrix to be changed.weight: weight to add as a self loop. Can be either a single number or an array.
Keyword arguments
signs: Controls sign flips. UseRandomSigns,RegularSigns, orIrrationalDigitSigns. Passnothingto leave signs unchanged. Default isnothing.
Examples
julia> matrix = zeros(Float32, 5, 5)
5×5 Matrix{Float32}:
0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0
julia> self_loop!(matrix, 1.0);
julia> diag(matrix) == fill(1.0f0, 5)
true