16 int rank, i, num_pes, pass;
21 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
22 MPI_Comm_size(MPI_COMM_WORLD, &num_pes);
25 int shapeN4[] = {
NS,
NS,
NS,NS};
26 int sizeN4[] = {n,m,n,m};
36 for (i=0; i<
np; i++ ) pairs[i] = drand48()-.5;
37 A.
write(np, indices, pairs);
43 if (fabs(tr) < 1.E-10){
49 if (fabs(tr) > 1.E-10)
53 printf(
"{ sum(ai)A[\"aiai\"]=sum(ai)mA[\"ai\"] } passed \n");
56 printf(
"{ sum(ai)A[\"aiai\"]=sum(ai)mA[\"ai\"] } failed \n");
68 char ** itr = std::find(begin, end, option);
69 if (itr != end && ++itr != end){
76 int main(
int argc,
char ** argv){
79 char ** input_str = argv;
81 MPI_Init(&argc, &argv);
82 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
83 MPI_Comm_size(MPI_COMM_WORLD, &np);
86 n = atoi(
getCmdOption(input_str, input_str+in_num,
"-n"));
91 m = atoi(
getCmdOption(input_str, input_str+in_num,
"-m"));
int diag_ctr(int n, int m, World &dw)
Matrix class which encapsulates a 2D tensor.
an instance of the CTF library (world) on a MPI communicator
int main(int argc, char **argv)
void get_local_data(int64_t *npair, int64_t **global_idx, dtype **data, bool nonzeros_only=false, bool unpack_sym=false) const
Gives the global indices and values associated with the local data.
char * getCmdOption(char **begin, char **end, const std::string &option)
an instance of a tensor within a CTF world
void write(int64_t npair, int64_t const *global_idx, dtype const *data)
writes in values associated with any set of indices The sparse data is defined in coordinate format...