Files | Defines | Functions

General Number Utilities

Files

file  eg_numutil.c
file  eg_numutil.h
 

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


Defines

#define EGlpNumInnProd(__rop, __arr1, __arr2, __length)   __EGlpNumInnProd((&(__rop)),__arr1,__arr2,__length)
 compute the inner product of two arrays.

Functions

void __EGlpNumInnProd (EGlpNum_t *rop, EGlpNum_t *const arr1, EGlpNum_t *const arr2, const size_t length)
 internal version, this is done to avoid using stdc99 and rely on more basic stdc89
void EGutilPermSort (const size_t sz, int *const perm, const EGlpNum_t *const elem)
 Sort (in increasing 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.
void EGutilPermSort2 (const size_t sz, int *const perm, const EGlpNum_t *const elem)
 Sort (in decreasing 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.

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
  • 2007-10-08
    • Separate template file and independet file into eg_nummacros.h
    • Move EGabs, EGswap, EGmin and EGmax to this file
  • 2005-10-31
    • First implementation.

Define Documentation

#define EGlpNumInnProd (   __rop,
  __arr1,
  __arr2,
  __length 
)    __EGlpNumInnProd((&(__rop)),__arr1,__arr2,__length)

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

Referenced by EGdBsRedBuildGM().


Function Documentation

void __EGlpNumInnProd ( EGlpNum_t *  rop,
EGlpNum_t *const   __EGa1,
EGlpNum_t *const   __EGa2,
const size_t  length 
)

internal version, this is done to avoid using stdc99 and rely on more basic stdc89

void EGutilPermSort ( const size_t  sz,
int *const   perm,
const EGlpNum_t *const   elem 
)

Sort (in increasing 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.

Referenced by EGdBsRedBuildGM().

void EGutilPermSort2 ( const size_t  sz,
int *const   perm,
const EGlpNum_t *const   elem 
)

Sort (in decreasing 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.