public void EncodeToArray(double[] encoded)
{
_structure.RequireFlat();
double[] weights = _structure.Flat.Weights;
if (weights.Length != encoded.Length)
{
throw new NeuralNetworkError(
"Size mismatch, encoded array should be of length "
+ weights.Length);
}
EngineArray.ArrayCopy(weights, encoded);
}