R/RcppExports.R

Defines functions lif_forward_Cpp

Documented in lif_forward_Cpp

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Solve the LIF forward problem
#'
#' Integrate a feedforward Linear Leaky Integrate and Fire Network via forward Euler.
#'
#' @param n_in The number of input neurons, a scalar integer.
#' @param l_h The number of hidden layers, a scalar integer.
#' @param n_h The number of hidden neurons in each layer (of length l_h).
#' @param n_out The number of output neurons, a scalar integer, for now has to be 1.
#' @param Ws A list of matrices giving the weights between layers, of length 1 fewer than the number of layers. The first matrix is of dimension n_in x n_h[1], etc.
#' @param Fin A list of numeric vectors, giving the times of the input spikes.
#' @param t_eps A scalar double, the step size for numerical integration.
#' @param t_steps A scalar integer, the number of finite difference iterations.
#' @return A list of lists of numeric vectors. The first entry will be Fin, and so on.
#' @examples
#' t_eps <- 0.01
#' t_end <- 10
#' ts <- seq(0, t_end, by = t_eps)
#' t_steps <- length(ts)
#' n_in <- 2
#' n_out <- 1
#' n_h <- c(1)
#' layers <- 2 + length(n_h)
#' #Ws <- list(matrix(c(3.5), ncol = 1), matrix(c(3), ncol = 1))
#' Fin <- list(seq(0,10, by = 1), seq(0,10, by = 1))
#' # Generate random wieghts
#' set.seed(123)
#' sizes <- c(n_in, n_h, n_out)
#' Ws <- lapply(1:(length(sizes)-1), function(i) 
#'              matrix(rnorm(sizes[i]*sizes[i+1], 3), nrow = sizes[i], ncol = sizes[i+1]))
#' l_h <- length(n_h)
#' a <- goc(n_in, l_h, n_h, n_out, Ws, Fin, t_eps, t_steps) 
#' cat('Firing Times by layer-neuron:\n')
#' print(a)
#'
#' @export
lif_forward_Cpp <- function(n_in, l_h, n_h, n_out, Ws, Fin, t_eps, t_steps) {
    .Call(`_snnLearn_lif_forward_Cpp`, n_in, l_h, n_h, n_out, Ws, Fin, t_eps, t_steps)
}
NathanWycoff/snnLearn documentation built on May 17, 2019, 11:40 a.m.