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  eg_numutil.c
file  eg_numutil.h
 This file provide the user interface and function definitions for general EGlpNum_t utilities.

Defines

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

Functions

void EGutilPermSort (const size_t sz, int *const perm, EGlpNum_t *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.


Define Documentation

#define EGlpNumInnProd rop,
arr1,
arr2,
length   ) 
 

Value:

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

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 55 of file eg_numutil.h.


Function Documentation

void EGutilPermSort const size_t  sz,
int *const   perm,
EGlpNum_t *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.

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 eg_numutil.c.


Generated on Mon Jan 30 08:55:41 2006 for EGlib by  doxygen 1.4.5