3.5 Heap data structure

Among the tools routines of sec. 6, we have a number of sorting utilities; the heap sort is implemented in terms of heaps having the following signatures:

psb_T_heap
: a heap containing elements of type T, where T can be i,s,c,d,z for integer, real and complex data;
psb_T_idx_heap
: a heap containing elements of type T, as above, together with an integer index.

Given a heap object, the following methods are defined on it:

init
Initialize memory; also choose ascending or descending order;
howmany
Current heap occupancy;
insert
Add an item (or an item and its index);
get_first
Remove and return the first element;
dump
Print on file;
free
Release memory.

These objects are used in AMG4PSBLAS to implement the factorization algorithms.