#ifndef	NERD_HEADER
#define NERD_HEADER
#ident	"$Id: NeRDS.h,v 1.3 2015/01/20 03:42:23 pwh Exp $"

/* Error codes returned by NeRDinversion () */
#define	NERD_PARAM_CHECK	1
#define	NERD_MEMORY_CHECK	2
#define	NERD_ZERO_CHECK		3
#define	NERD_NAN_CHECK		4

/*
 * Matrix inversion via the general NeRD method.  For an explanation of the
 * math see: http://sudoku.pauls-pc-repair.com/NeRDS/NeRDS.pdf
 *
 * int NeRDinversion ( int n, double **original, double **inverse )
 *
 *	Where:
 *		n - is the dimension of the matrix to be inverted.
 *		original - is the nxn matrix to be inverted.
 *		inverse - is the nxn matrix where the results will be returned.
 *
 *	Return: the return value is 0 if the inversion succeeded or an error
 *		code on failure.  If invalid parameters, such as n < 1 or a
 *		NULL pointer to the original matrix are passed to the function
 *		it will fail returning NERD_PARAM_CHECK.  If the function is
 *		unable to allocate memory space to work in it will fail return-
 *		ing NERD_MEMORY_CHECK.  If a divide by 0 error is detected
 *		NERD_ZERO_CHECK is returned.  If an ill-tempered matrix causes
 *		infinite results NERD_NAN_CHECK is returned.
 *
 *	The inverse matrix must be setup to be a 2 dimensional matrix, that
 *	is, the pointers to the rows must be initialized, inverse cannot just
 *	be raw empty space.  You may reuse original for your inverse result,
 *	or in other words, original and inverse may be the same matrix.  Pass-
 *	ing a NULL inverse matrix to NeRDinversion () is the same as making it
 *	equal to original, the original matrix will be inverted in place.
 *	NeRDinversion () requires the same amount of working memory whether
 *	inverting a matrix in place or putting the results in separate memory
 *	space that you allocated.
 */

int NeRDinversion ( int n, double **original, double **inverse );
#endif	/* ! NERD_HEADER */


Last updated: Friday, June 12, 2015 03:21:43 AM