General Number Utilities


Detailed Description

Here we put some utilities common for different number types but thaat we want to implement as templates, like permutation sorting, inner product of vectors, and so-on..

History:
Revision 0.0.2


Files

file  dbl_eg_numutil.c
file  dbl_eg_numutil.h
 This file provide the user interface and function definitions for general number utilities.

Defines

#define dbl_EGlpNumInnProd(rop, arr1, arr2, length)
 compute the inner product of two arrays.

Functions

void dbl_EGutilPermSort (const size_t sz, int *const perm, double *const elem)
 Sort a sub-set of entries in an array using quicksort, by permutating the order of the elements in the subset rather than in the whole original array, this function sort from min to max value.
void dbl_EGutilPermSort2 (const size_t sz, int *const perm, double *const elem)
 Sort (in incresing order) a sub-set of entries in an array using quicksort, by permutating the order of the elements in the subset rather than in the whole original array.


Define Documentation

#define dbl_EGlpNumInnProd rop,
arr1,
arr2,
length   ) 
 

Value:

do{\
  double*const restrict __EGa1 = (arr1);\
  double*const restrict __EGa2 = (arr2);\
  register unsigned __EGdim = (length);\
  dbl_EGlpNumZero(rop);\
  while(__EGdim--) EGlpNumAddInnProdTo(rop,__EGa1[__EGdim],__EGa2[__EGdim]);\
  } while(0)
compute the inner product of two arrays.

Parameters:
arr1 first array.
arr2 second array.
length number of entries to consider in both arrays, from zero to length - 1.
rop where to store the result.

Definition at line 59 of file dbl_eg_numutil.h.


Function Documentation

void dbl_EGutilPermSort const size_t  sz,
int *const   perm,
double *const   elem
 

Sort a sub-set of entries in an array using quicksort, by permutating the order of the elements in the subset rather than in the whole original array, this function sort from min to max value.

Parameters:
sz length of the permutation array.
perm array of indices of elements that we want to sort.
elem array (of length at least max(perm[k]:k=0,...,sz-1)) containing the elements to be sorted.
Note:
The array of elements is not changed by this function.

This code is based in concorde's implementation of permutation-quick-sort.

Definition at line 26 of file dbl_eg_numutil.c.

void dbl_EGutilPermSort2 const size_t  sz,
int *const   perm,
double *const   elem
 

Sort (in incresing order) a sub-set of entries in an array using quicksort, by permutating the order of the elements in the subset rather than in the whole original array.

Parameters:
sz length of the permutation array.
perm array of indices of elements that we want to sort.
elem array (of length at least max(perm[k]:k=0,...,sz-1)) containing the elements to be sorted.
Note:
The array of elements is not changed by this function.

This code is based in concorde's implementation of permutation-quick-sort.

Definition at line 61 of file dbl_eg_numutil.c.


Generated on Wed Nov 21 09:38:35 2007 for MTgomory by  doxygen 1.4.6