Skip to contentSkip to Content
DocsAPI ReferenceSteppingspires_step

spires_step

Advance the reservoir by a single timestep, feeding in one input vector.


Signature

spires_status spires_step(spires_reservoir *r, const double *u_t);

Parameters

ParameterTypeDescription
rspires_reservoir *Handle to the reservoir. Must not be NULL.
u_tconst double *Input vector for this timestep, of length num_inputs. May be NULL, in which case all inputs are treated as zero for this step.

Returns

spires_statusSPIRES_OK on success, or SPIRES_ERR_INVALID_ARG if r is NULL.


Example

/* Step through a time series one sample at a time */ for (size_t t = 0; t < series_length; t++) { const double *u = &input_series[t * num_inputs]; spires_status s = spires_step(r, u); if (s != SPIRES_OK) { fprintf(stderr, "step failed at t=%zu\n", t); break; } /* Read out the current state or output after each step */ double y; spires_compute_output(r, &y); printf("t=%zu y=%.6f\n", t, y); }

Notes

  • State update. Each call updates the internal neuron state vector according to the reservoir’s neuron model: x(t+1) = f(W * x(t) + W_in * u(t)). The exact dynamics depend on the neuron_type selected at creation time.
  • NULL input. Passing u_t = NULL is equivalent to passing a zero vector. This is useful for “free-running” the reservoir without external drive, for example to observe the decay of transient dynamics.
  • No allocation. This function performs no heap allocation. It operates entirely on pre-allocated internal buffers.
  • Thread safety. A given reservoir must not be stepped from multiple threads simultaneously. Different reservoirs may be stepped concurrently without issue.
  • Fractional models. For FLIF_* neuron types, each call to spires_step appends to the internal history buffer used for the fractional derivative computation. The memory cost per step is O(1) for FLIF_GL and FLIF_DIFFUSIVE, but may vary for FLIF_CAPUTO.

See Also

Last updated on