Main Page   Modules   Compound List   File List   Compound Members   File Members  

numerics.c File Reference

#include <gandalf/common/numerics.h>
#include <gandalf/common/allocate.h>
#include <gandalf/common/misc_error.h>
#include <math.h>
#include <string.h>

Defines

#define ADDRESS(i)   ((void *)CHADDR(i))
#define CHADDR(i)   ((void *)(&(((char *)base)[(i)*size])))
#define SWAP(i, j)   {memcpy(tmpbuf,CHADDR(i),size); memcpy(CHADDR(i),CHADDR(j),size); memcpy(CHADDR(j),tmpbuf,size);}

Functions

double gan_sqr_d (double x)
 Real square function.

float gan_sqr_f (float x)
 Real square function (single precision).

int gan_sqr_i (int x)
 Integer square function.

unsigned gan_sqr_ui (unsigned x)
 Unsigned integer square function.

long gan_sqr_l (long x)
 Long integer square function.

double gan_cbrt (double x)
 Real cube root function.

double gan_normal_sample (double mu, double sigma)
 Returns a sample of a normally distributed random variable.

int gan_solve_quadratic (double a, double b, double c, Gan_Complex x[2])
 Find roots of a quadratic equation with real coefficients.

int gan_solve_cubic (double a, double b, double c, double d, Gan_Complex x[3])
 Find roots of a cubic equation with real coefficients.

void * gan_kth_highest (void *base, size_t nmemb, size_t size, unsigned int k, int(*compar)(const void *, const void *))
 Return k'th highest element of an array.


Detailed Description

Module: Numerical functions

Part of: Gandalf Library

Revision: Last edited: Author:

Copyright: (c) 2000 Imagineer Software Limited


Generated on Mon Oct 13 16:14:45 2003 by doxygen1.3-rc1