#ifndef HAMILTON_INCLUDED #define HAMILTON_INCLUDED #include "basis.h" /* Structure to hold matrix elements of a sparse Hamiltonian. Here, we use "symmetric column pointer format" as suggested in the Cray "man intro_sparse" pages. Proper initialization is {NULL,NULL,NULL,NULL,0,0,0,0,0} Here we include only one triangle of the matrix, assuming symmetry. The array j is length n+1 and els.j[els.n] contains the length of els.e and els.i. The structure can also hold a complex matrix. The pointer for the complex matrix points to the same memory. The pointer not being used is set to null. The pointers could be "size_mem" but they are never passed over mpi. If size_mem is larger than size_t then memory is wasted. */ typedef struct { element *r; /* The elements of the matrix */ complex_element *c; /* The elements of the matrix in the case of a complex matrix */ size_t *i; /* The corresponding column of that element */ size_t *j; /* The position in the above list of each row of the matrix */ size_t rc_length; /* bytes of memory allocated for els.r or els.c */ size_t i_length; /* bytes of memory allocated for els.i */ size_t j_length; /* bytes of memory allocated for els.j */ size_t n; /* Size of the matrix */ } elslist; /************* Prototypes for functions in hamilton.c ***************/ void hamels(elslist *els, full_basis *,element *couplings); void hamelsc(elslist *els, full_basis *x, element *couplings); /* make a list of nonzero matrix elements for nonzero transverse momentum. */ void print_els(elslist *els, int); /* print some nonzero matrix elements */ void free_els(elslist *els); /* free memory used by els */ #endif