PetaVision  Alpha
pv_types.h
1 /*
2  * pv_types.h
3  *
4  * Created: Sep 10, 2008
5  * Author: dcoates
6  */
7 
8 #ifndef PV_TYPES_H_
9 #define PV_TYPES_H_
10 
11 #include "PVLayerLoc.h"
12 #include "pv_common.h"
13 #include <float.h>
14 #include <stdio.h>
15 
16 enum ChannelType {
17  CHANNEL_EXC = 0,
18  CHANNEL_INH = 1,
19  CHANNEL_INHB = 2,
20  CHANNEL_GAP = 3,
21  CHANNEL_NORM = 4,
22  CHANNEL_NOUPDATE = -1
23 };
24 
25 enum PVDataType {
26  PV_FLOAT = 0,
27  PV_INT = 1,
28 };
29 
30 typedef struct PVPatchStrides_ {
31  int sx, sy, sf; // stride in x,y,features
33 
34 enum PVPatchStrideFields { PATCH_SX, PATCH_SY, PATCH_SF };
35 
36 typedef struct PV_Stream_ {
37  char *name;
38  char *mode;
39  FILE *fp;
40  long filepos;
41  long filelength;
42 
43  // True or false, tells whether stream corresponds to a file
44  int isfile;
45 
46  // True or false, if true, calls to PV_fwrite will do a readback check
47  int verifyWrites;
48 } PV_Stream;
49 
54 typedef struct PVLayerCube_ {
55  // size of entire cube in bytes
56  size_t size;
57 
58  // number of items in data buffer
59  int numItems;
60 
61  // pointer to data (may follow header)
62  float *data;
63 
64  // location of cube in global layer
65  PVLayerLoc loc;
66  int isSparse;
67  long const *numActive;
68  void const *activeIndices;
69 } PVLayerCube;
70 
74 typedef struct PVLayer_ {
75  // # neurons in this layer
76  int numNeurons;
77  // # neurons in layer including extended border regions
78  int numExtended;
79 
80  // # neurons in this layer across all batches
81  int numNeuronsAllBatches;
82 
83  // # neurons in this layer across all batches, including extended regions
84  int numExtendedAllBatches;
85 
86  PVLayerLoc loc;
87 
88  // Layer size = 2^(-scale) * column size.
89  // Layers with positive xScale are more dense in the x dimension
90  int xScale, yScale;
91 
92  PVLayerCube *activity;
93 
94  // time of previous spike for each neuron
95  float *prevActivity;
96 
97  // membrane potential
98  float *V;
99 } PVLayer;
100 
101 typedef struct { unsigned int s1, s2, s3; } taus_state_t;
102 
103 typedef struct taus_uint4_ {
104  unsigned int s0;
105  taus_state_t state;
106 } taus_uint4;
107 
108 #endif /* PV_TYPES_H_ */