NPL
Neurological Programs and Libraries
basic_functions.h File Reference
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <list>
#include "macros.h"

Go to the source code of this file.

Classes

struct  npl::Counter< T, MAXDIM >
 Very basic counter that iterates over an ND region. More...
 

Namespaces

 npl
 

Functions

template<typename T >
npl::clamp (T inf, T sup, T v)
 Clamps value to range of [inf, sup]. Values outside will be pulled to either sup or inf, whichever is closer. More...
 
template<typename T >
npl::wrap (T inf, T sup, T v)
 Wraps and index based on the range [inf, sup] (when v is outside that) range. Thus inf = 1, sup = 5, v = 0 will wrap around to 4, and v = 6 would wrap around to 1. More...
 
double npl::rectWindow (double x, double a)
 Rectangle function centered at 0, with radius a, range should be = 2a. More...
 
double npl::sincWindow (double x, double a)
 Sinc function centered at 0, with radius a, range should be = 2a. More...
 
double npl::freqGaussian (double x, double sd)
 Gaussian function in the frequency domain. Note that the standard deviation is in the time domain. More...
 
double npl::hammingWindow (double x, double a)
 
double npl::welchWindow (double x, double a)
 
double npl::hannWindow (double x, double a)
 
double npl::lanczosKern (double x, double a)
 Derivative of lanczos kernel with respect to x. More...
 
double npl::dLanczosKern (double x, double a)
 Derivative of lanczos kernel with respect to x. More...
 
double npl::linKern (double x, double a)
 
double npl::dLinKern (double x, double a)
 
double npl::B3kern (double x)
 3rd order B-Spline, radius 2 [-2,2] More...
 
double npl::B3kern (double x, double r)
 3rd order B-Spline, variable radius (w) More...
 
double npl::dB3kern (double x)
 3rd order B-Spline derivative, radius 2 [-2,2] More...
 
double npl::dB3kern (double x, double r)
 3rd order B-Spline, variable radius (w) More...
 
double npl::ddB3kern (double x)
 3rd order B-Spline, 2nd derivative, radius 2 [-2,2] More...
 
double npl::ddB3kern (double x, double r)
 3rd order B-Spline, variable radius (w) More...
 
double npl::cot (double v)
 Cotangent function. More...
 
double npl::csc (double v)
 Cosecant function. More...
 
double npl::sec (double v)
 Secand function. More...
 
double npl::degToRad (double rad)
 
double npl::radToDeg (double rad)
 
int npl::hob (int num)
 Highest order bit. More...
 
int64_t npl::round2 (int64_t in)
 Round up to the nearest power of 2. More...
 
std::list< int64_t > npl::factor (int64_t f)
 Provides a list of the prime-fractors of the input number. More...
 
int64_t npl::round357 (int64_t in)
 Rounds a number up to the nearest number that can be broken down into 3,5,7. More...