delay_line!

ReservoirComputing.delay_line! — Function
delay_line!([rng], reservoir_matrix, weight, shift; signs = nothing)

Adds a delay line in the reservoir_matrix, with given shift and weight. The weight can be a single number or an array.

Arguments

  • rng: Random number generator. Default is Utils.default_rng() from WeightInitializers.
  • reservoir_matrix: matrix to be changed.
  • weight: weight to add as a delay line. Can be either a single number or an array.
  • shift: How far the delay line will be from the diagonal.

Keyword arguments

Examples

julia> matrix = zeros(Float32, 5, 5);

julia> delay_line!(matrix, 5.0, 2);

julia> matrix[3, 1] == matrix[4, 2] == matrix[5, 3] == 5.0f0
true

julia> sampled_matrix = zeros(Float32, 5, 5);

julia> delay_line!(MersenneTwister(123), sampled_matrix, 5.0, 2;
           signs = RandomSigns());

julia> all(abs.(sampled_matrix[3:5, 1:3][diagind(sampled_matrix[3:5, 1:3])]) .== 5.0f0)
true
source