libspatialSEIR  0.1
Bayesian Spatial SEIR Modeling
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
DistanceMatrix.hpp
Go to the documentation of this file.
1 /*Copyright 2014, Grant Brown*/
2 
3 #ifndef SPATIALSEIR_INCLUDEFILES
4 #define SPATIALSEIR_INCLUDEFILES
5 
6 #include<math.h>
7 #include<cstring>
8 #include<vector>
9 #endif
10 
11 #ifndef DISTANCE_MATRIX_INC
12 #define DISTANCE_MATRIX_INC
13 
14 namespace SpatialSEIR
15 {
16  struct distanceArgs
17  {
18  std::vector<double*> inData;
19  int* dim;
20  };
21 
23  {
24  double* phi;
25  std::vector<double*> inData;
26  int* dim;
27  int mode;
28  };
29 
30  // Begin with a naive implementation, this should eventually
31  // be updated to take advantage of the inherent sparsity of
32  // a distance matrix with a max range, as well as the structure
33  // given by symmetry.
34  //
35  // First priority: make it work
37  {
38  public:
39  // Methods
41 
42  int genFromDataStream(double *indata, int *dim);
43 
44  // Scaled options for already allocated distance matrix
45  int scaledInvFunc_CPU(double phi);
46  int scaledInvFunc_OCL(double phi);
47 
48  // Make rows sum to one.
49  void makeRowStochastic();
50 
51  // Scaled options for unallocated distance matrix
52  int scaledInvFunc_CPU(double phi, double *indata, int *dim);
53  int scaledInvFunc_OCL(double phi, double *indata, int *dim);
54  int gravityFunc_CPU(double phi, double *indata, int *dim);
55  int gravityFunc_OCL(double phi, double *indata, int *dim);
56 
57 
59  // Attributes
60  double *data;
62 
63  private:
64  int *hasAlloc;
65  };
66 }
67 
68 #endif
std::vector< double * > inData
Definition: DistanceMatrix.hpp:25
Definition: DistanceMatrix.hpp:22
int * dim
Definition: DistanceMatrix.hpp:19
int scaledInvFunc_CPU(double phi)
Definition: DistanceMatrix.cpp:30
int * numLocations
Definition: DistanceMatrix.hpp:61
int gravityFunc_CPU(double phi, double *indata, int *dim)
~DistanceMatrix()
Definition: DistanceMatrix.cpp:91
std::vector< double * > inData
Definition: DistanceMatrix.hpp:18
Definition: DistanceMatrix.hpp:16
double * data
Definition: DistanceMatrix.hpp:60
double * phi
Definition: DistanceMatrix.hpp:24
int genFromDataStream(double *indata, int *dim)
Definition: DistanceMatrix.cpp:15
int * dim
Definition: DistanceMatrix.hpp:26
int mode
Definition: DistanceMatrix.hpp:27
Definition: DistanceMatrix.hpp:36
DistanceMatrix()
Definition: DistanceMatrix.cpp:9
int gravityFunc_OCL(double phi, double *indata, int *dim)
int scaledInvFunc_OCL(double phi)
void makeRowStochastic()
Definition: DistanceMatrix.cpp:68