www.pudn.com > shengtai432.rar > nlib.h, change:2007-05-17,size:2131b


#ifndef NLIB_H 
#define NLIB_H 
/* -------------------------------------------------------------------- */ 
/* File:     nlib.h  
/* -------------------------------------------------------------------- */ 
 
/* Description: Define symbolic constants, data types, macros, and   
                function prototypes for functions in NLIB. */ 
 
/* ------------------------------------------------------------------- */ 
/* Select precision */ 
/* ------------------------------------------------------------------- */ 
 
 
 
#define PRECISION SINGLE 
#if   PRECISION == SINGLE 
   #define  INFINITY  FLT_MAX  
#elif PRECISION == DOUBLE                   
   #define  float  double 
   #define  INFINITY  DBL_MAX 
#endif 
 
/* ------------------------------------------------------------------- */ 
/* Function macros */ 
/* ------------------------------------------------------------------- */ 
 
#define MIN(x,y) ((x) < (y) ? (x) : (y)) 
#define MAX(x,y) ((x) > (y) ? (x) : (y)) 
 
 
/* ------------------------------------------------------------------- */ 
/* Function prototypes: ANSI C library */ 
/* ------------------------------------------------------------------- */ 
 
#include <math.h> 
#include <stdio.h>		 
#include <stdlib.h>		 
#include <string.h> 
#include <time.h> 
#include <float.h> 
 
/* ------------------------------------------------------------------- */ 
/* Symbolic constants */ 
/* ------------------------------------------------------------------- */ 
 
 
#define  PI         3.141592654f   /* unit circle area */ 
#define  LRAND_MAX  2147483647L	   /* maximum random integer */ 
 
 
 
 
/* ------------------------------------------------------------------- */ 
/* Public data types */ 
/* ------------------------------------------------------------------- */ 
 
typedef struct {			 
   float        x;                   /* real part */ 
   float        y;                   /* imaginary part */ 
} complex; 
 
typedef float*    vector;            /* real vector */	 	 
typedef vector*   matrix;            /* real matrix */ 
typedef complex*  cvector;           /* complex vector */  
 
 
 
#endif