/*
    Appellation: impl_neural <module>
    Contrib: @FL03
*/
use super::NeuralNode;

use crate::engine::{ComputationalEngine, NeuralEngine};
use eryon::Tail;

use ndarray::ScalarOperand;
use num_traits::{Float, FromPrimitive, NumAssign};

impl<T> NeuralNode<T>
where
    T: Float + FromPrimitive + ScalarOperand,
    NeuralEngine<T>: ComputationalEngine<usize, [usize; 3], Store = Vec<usize>>,
{
    pub fn adapt_weights_to_target(&mut self, pattern: Tail<usize, usize>) -> crate::Result<()>
    where
        T: core::iter::Sum + NumAssign,
    {
        self.driver_mut().adapt_weights_to_target(pattern)
    }
    /// execute the driver with the stored data
    pub fn execute_with_stored(&mut self) -> crate::Result<()>
    where
        T: core::iter::Sum + NumAssign,
    {
        self.driver.execute_with_stored(&self.store)
    }
    /// use the driver to decode the outputs of the network into a meaningful [`tail`](Tail)
    pub fn decode_driver_output(&self, outputs: ndarray::Array1<T>) -> Tail<usize, usize> {
        self.driver().decode_outputs_into_tail(outputs)
    }
}
