[ return ]

alib.h



/*
 *  file : lib.h
 *
 *
 */
#define ALIB

#define Exp(x) ((float) exp((double) (x)))
#define PI 3.14159
#define CONST 2.5066
#define Square(x) ((x) * (x))

#define Max(x,y) (((x) > (y)) ? (x) : (y))
#define Abs(x) (((x) > 0) ? (x) : (-(x)))

#define Sqrt(x) ((float) sqrt((double) (x)))

extern double drand48();
extern double exp(double);

#define nl << "\n"
#define sp << " "
#define tab << "\t"

overload gauss_to_value;

extern nsl_matrix vec_mult_vec_trans(nsl_vector&, nsl_vector&);
extern nsl_vector mat_mult_col_vec(nsl_matrix&, nsl_vector&);
extern nsl_vector mat_trans_mult_col_vec(nsl_matrix&, nsl_vector&);
extern void extract_col_vector(nsl_matrix&, int, nsl_vector&);
extern void extract_row_vector(nsl_matrix&, int, nsl_vector&);
extern void insert_col_vector(nsl_matrix&, int, nsl_vector&);
extern void insert_row_vector(nsl_matrix&, int, nsl_vector&);

extern float random_value();
extern float randomv();
extern nsl_vector square(nsl_vector& a);
extern nsl_vector sqrt(nsl_vector& a);
extern nsl_vector abs(nsl_vector& a);
extern nsl_vector apply_func(nsl_vector& a,double (*func)(double));        //OVERLOAD CALL: apply_func: funcs.c(?), funcs.c(?)
extern nsl_matrix apply_func(nsl_matrix& a,double (*func)(double));        //OVERLOAD CALL: apply_func: funcs.c(?), funcs.c(?)
extern nsl_vector sigmoid(nsl_vector& vec);
extern void randomize(nsl_vector& vec);        //OVERLOAD CALL: randomize: funcs.c(?), funcs.c(?)
extern void randomize(nsl_matrix& mat);        //OVERLOAD CALL: randomize: funcs.c(?), funcs.c(?)

extern nsl_vector distributed_sum(nsl_vector& a, nsl_vector& b);
extern void gauss_to_value(nsl_vector& a, float& total, float& div);
extern nsl_vector biased_distributed_sum(nsl_vector& a, nsl_vector& b, nsl_matrix& bias, int size);
extern nsl_vector value_to_gauss(float val, float min, float max, 
				 int pad, float std, nsl_vector& vec);
extern void gauss_to_value(float min, float max, int pad,
			   nsl_vector& vec, float& total, float& div);



extern nsl_vector& random(nsl_vector&);        //OVERLOAD CALL: random: funcs.c(?), funcs.c(?)
extern nsl_matrix& random(nsl_matrix&);        //OVERLOAD CALL: random: funcs.c(?), funcs.c(?)
extern nsl_data dot(nsl_vector&, nsl_vector&);

void normal_row(nsl_matrix&, int);
void normal_col(nsl_matrix&, int);

extern nsl_vector threshlog(nsl_vector& vec, float kx1 = 0,        //OVERLOAD CALL: threshlog: funcs.c(?), funcs.c(?)
			    float ky1 = 0, float ky2 = 0);

extern nsl_data threshlog(nsl_data& vec, float kx1 = 0,        //OVERLOAD CALL: threshlog: funcs.c(?), funcs.c(?)
			  float ky1 = 0, float ky2 = 0);

extern nsl_vector threshlogmax(nsl_vector& vec, float kx1 = 0,        //OVERLOAD CALL: threshlogmax: funcs.c(?), funcs.c(?)
			    float ky1 = 0, float ky2 = 0, float ky3 = 10);

extern nsl_data threshlogmax(nsl_data& vec, float kx1 = 0,        //OVERLOAD CALL: threshlogmax: funcs.c(?), funcs.c(?)
			  float ky1 = 0, float ky2 = 0, float ky3 = 10);


extern nsl_vector elevatedSAT(nsl_vector& vec, float kx1 = 0, float kx2 = 1,        //OVERLOAD CALL: elevatedSAT: funcs.c(?), funcs.c(?)
			    float ky1 = 0, float ky2 = 0, float ky3 = 1);

extern nsl_data elevatedSAT(nsl_data& vec, float kx1 = 0, float kx2 = 1,        //OVERLOAD CALL: elevatedSAT: funcs.c(?), funcs.c(?)
			  float ky1 = 0, float ky2 = 0, float ky3 = 1);


extern nsl_vector threshexp(nsl_vector& vec, float kx1 = 0,         //OVERLOAD CALL: threshexp: funcs.c(?), funcs.c(?)
			    float ky1 = 0, float ky2 = 0, float gain = 0.5);

extern nsl_data threshexp(nsl_data& vec, float kx1 = 0,         //OVERLOAD CALL: threshexp: funcs.c(?), funcs.c(?)
			  float ky1 = 0, float ky2 = 0, float gain = 0.5);


#define L1 1
#define L2 2

#include "nslsock.h"
#include "nslsocket.h"


[ return ]