vmath(3)

NAME
vmath - provides routines that perform various types of mathematical operations. For example, noise and signal generation routines can be found in this library.

ALL programs that utilize these routines MUST include the statement:

#include "vinclude.h"

AVAILABLE ROUTINES

absolute()

Return the absolute value of the first argument.

double absolute(num)
double num;

bess()

Return the value of a bessel function

double bess(num)
double num;

cadd()

Find complex result from (r1,i1)+(r2,i2) and put the result in (r3,i3)

int cadd(r3,i3,r1,i1,r2,i2)
float r1,i1,r2,i2,*r3,*i3;

dcadd()

Find complex result from (r1,i1)+(r2,i2) and put the result in (r3,i3)

int dcadd(r3,i3,r1,i1,r2,i2)
double r1,i1,r2,i2,*r3,*i3;

cang()

Return phasor angle of a complex number.

double cang(r,i)
float r,i;

dcang()

Return phasor angle of a complex number.

double dcang(r,i)
double r,i;

cconj()

This routine finds the conjugate of the complex number (r1,i1) and places it in (r2,i2).

int cconj(r2,i2,r1,i1)
float r1,i1,*r2,*i2;

cdiv()

Find complex quotient from (r1,i1)/(r2,i2) and put the result in (r3,i3).

int cdiv(r3,i3,r1,i1,r2,i2)
float r1,i1,r2,i2,*r3,*i3;

dcdiv()

Find complex quotient from (r1,i1)/(r2,i2) and put the result in (r3,i3).

int dcdiv(r3,i3,r1,i1,r2,i2)
double r1,i1,r2,i2,*r3,*i3;

cmagsq()

Return power of complex number.

double cmagsq(r,i)
float r,i;

cmul()

Find complex result from (r1,i1)*(r2,i2) and put the result in (r3,i3).

int cmul(r3,i3,r1,i1,r2,i2)
float r1,i1,r2,i2,*r3,*i3;

dcmul()

Find complex result from (r1,i1)*(r2,i2) and put the result in (r3,i3).

int dcmul(r3,i3,r1,i1,r2,i2)
double r1,i1,r2,i2,*r3,*i3;

cquad()

This routine evaluates the following expression:
s*s + coeff1*s + coeff2,
where s = real + imag.
and places the result in (real,imag).

int cquad(real,imag,coeff1,coeff2)
float coeff1, coeff2, *real, *imag;

csub()

Find complex result from (r1,i1)-(r2,i2) and put the result in (r3,i3).

int csub(r3,i3,r1,i1,r2,i2)
float r1,i1,r2,i2,*r3,*i3;

dcsub()

Find complex result from (r1,i1)-(r2,i2) and put the result in (r3,i3).

int dcsub(r3,i3,r1,i1,r2,i2)
double r1,i1,r2,i2,*r3,*i3;

dpower()

Returns base raised to the exp power.

double dpower(base,exp)
int exp;
double base;

get_princ_axis()

Obtain the principal axis (the eigenvector associated with the largest eigenvalue) for the covariance matrix "a" of size nXn.

get_princ_axis(a,n,y)
double *a,*y;
int n;

gexpon()

Generates a 2d exponential random noise data set

int gexpon(vect,rows,cols,variance)
float *vect,variance
int rows,cols;

ggauss()

Generates a 2d Gaussian distributed random noise data set, with dimensions and characteristics as specified.

int ggauss(vect,rows,cols,mean,variance)
float *vect,mean,variance;
int rows,cols;

gpoiss()

Generates a 2d Poisson random noise data set

int gpoiss(vect,rows,cols,variance,time)
float *vect,time,variance;
int rows,cols;

gpwl()

Generates a 2d "piecewise linear" data set. By properly setting arguments to this routine, you can generate impulse data (spikes), triangular waves, sawtooth waves, reverse sawtooth waves, and square waves.

int gpwl(vect,rows,cols,sample,minimum,maximum,rperiod,cperiod,rrise,crise, rwidth,cwidth)
float *vect,sample,minimum,maximum,rperiod,cperiod;
float rrise,crise,rfall,cfall,rwidth,cwidth;
int rows,cols;

grleigh()

Generates a 2d Rayleigh random noise data set.

int grleigh(vect,rows,cols,variance)
float *vect,variance;
int rows,cols;

gsin()

Generates a 2d sinusoid data set

int gsin(vect,rows,cols,sample,amp,rfreq,cfreq,rphase,cphase)
float *vect,sample,amp,rfreq,cfreq,rphase,cphase;
int rows,cols;

gsinc()

Generates a 2d Sinc data set.

int gsinc(vect, rows, cols, sample, amp, rfreq, cfreq, center)
float *image,sample,amp,rfreq,cfreq;
int rows,cols,center;

gunif()

Generates a 2d uniform random noise data set with minimum and maximum as specified.

int gunif(vect,rows,cols,minimum,maximum)
float *vect,minimum,maximum;
int rows,cols;

inner()

Return the inner (dot) product of two vectors.

double inner(x,y,n)
double *x,*y;
int n;

kfmod()

Return the double percision floating point modulos of two numbers.

double kfmod(x,y)
double *x,*y;

matvec()

Compute matrix-vector product.

matvec(y,a,x,rows,cols)
double *a,*x,*y;
int rows,cols;

powtwo()

Returns 1 if length is an integer power of 2, 0 otherwise.

int powtwo(length)
int length;

urng()

generate a uniform random number.

float urng()

vcabs()

Return the magnitude of complex number.

double vcabs(r,i)
float r,i;

dvcabs()

Return the magnitude of complex number.

double dvcabs(r,i)
double r,i;

vfact()

Computes the factorial (n!) of a number.

double vfact(n)
double n;

vgnoise()

Generates a gaussian random number.

double vgnoise(x)
double x;

vimpulse()

Gives the impulse function of x.

double vimpulse(x)
double x;

vrandom()

Generates a random number. If the compile variable RANDOM is defined, then the system call random() is used, and big will be returned as 2^31-1. Otherwise, the system call rand() is used, and big will be returned as 2^15-1. For more, do %man rand or %man random.

vrandom(big)
long *big;

vsrandom()

Sets the seed for use by the vrandom() random number generator. If the compile variable RANDOM is defined, then the system call srandom() is used; otherwise, the system call srand() is used. Note that anyone using a call to vrandom() should make a call to this routine first. For more information, do %man srand or %man srandom.

vsrandom(seed)
int seed;

vsign()

Returns -1 if argument is less that 0.0; 1 if it is greater than 0.0; and 0 if it is equal to zero.

double vsign()
double x;

vstep()

Returns the step function of x (if x < 0, return 0; else return 1).

double vstep(x)
double x;

vunoise()

Generates a uniform randon number with variance 1 and mean 0.

double vunoise(x)
double x;