• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

sst/elements/genericProc/programs/MTGL/test/test_find_degree_degree_correlation.h

Go to the documentation of this file.
00001 /*  _________________________________________________________________________
00002  *
00003  *  MTGL: The MultiThreaded Graph Library
00004  *  Copyright (c) 2008 Sandia Corporation.
00005  *  This software is distributed under the BSD License.
00006  *  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00007  *  the U.S. Government retains certain rights in this software.
00008  *  For more information, see the README file in the top MTGL directory.
00009  *  _________________________________________________________________________
00010  */
00011 
00012 /****************************************************************************/
00013 /*! \file test_find_degree_degree_correlation.h
00014 
00015     \author Vitus Leung (vjleung@sandia.gov)
00016 
00017     \date 3/4/2008
00018 */
00019 /****************************************************************************/
00020 
00021 #include <mtgl/util.hpp>
00022 #include <mtgl/metrics.hpp>
00023 
00024 using namespace mtgl;
00025 
00026 #ifndef GET_FREQ
00027 #define GET_FREQ
00028 
00029 double get_freq()
00030 {
00031 #ifdef __MTA__
00032   double freq = mta_clock_freq();
00033 #else
00034   double freq = 1000000;
00035 #endif
00036   return freq;
00037 }
00038 #endif
00039 
00040 template <typename graph>
00041 void test_find_degree_degree_correlation(graph& g)
00042 {
00043   int ord = num_vertices(g);
00044   int size = num_edges(g);
00045   int maxdegree = (int) ceil(log(2. * ord - 1) / log(2.)) + 1;
00046 
00047   double** result = (double**) malloc(maxdegree * sizeof(double*));
00048 
00049   #pragma mta assert parallel
00050   for (int i = 0; i < maxdegree; ++i)
00051   {
00052     result[i] = (double*) malloc(maxdegree * sizeof(double));
00053   }
00054 
00055   find_degree_degree_correlation<graph> fddc(g, result);
00056   int ticks1 = fddc.run();
00057   fprintf(stdout, "degree degree correlation:\n\t");
00058 
00059   for (int j = 1; j < maxdegree; ++j) fprintf(stdout, "%6d ", j);
00060 
00061   fprintf(stdout, "\n");
00062 
00063   for (int i = 1; i < maxdegree; ++i)
00064   {
00065     fprintf(stdout, "%7d ", i);
00066 
00067     for (int j = 1; j < maxdegree; ++j) fprintf(stdout, "%.4lf ", result[i][j]);
00068 
00069     fprintf(stdout, "\n");
00070   }
00071 
00072   for (int i = 0; i < maxdegree; ++i) free(result[i]);
00073   free(result);
00074 }

Generated on Fri Oct 22 2010 11:02:23 for SST by  doxygen 1.7.1