Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Annotation of /trunk/gadget/agebandmatrixratio.cc
[mareframe] / trunk / gadget / agebandmatrixratio.cc Repository:
ViewVC logotype

Annotation of /trunk/gadget/agebandmatrixratio.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #include "intvector.h"
2 :     #include "agebandmatrixratio.h"
3 :     #include "commentstream.h"
4 :     #include "gadget.h"
5 :    
6 :     AgeBandMatrixRatio::AgeBandMatrixRatio(const AgeBandMatrixRatio& initial)
7 :     : minage(initial.minAge()), nrow(initial.Nrow()) {
8 :    
9 :     int i;
10 :     if (nrow > 0) {
11 :     v = new PopRatioIndexVector*[nrow];
12 :     for (i = 0; i < nrow; i++)
13 :     v[i] = new PopRatioIndexVector(initial[i + minage]);
14 :     } else
15 :     v = 0;
16 :     }
17 :    
18 :     AgeBandMatrixRatio::AgeBandMatrixRatio(int age, const IntVector& minl,
19 :     const IntVector& size) : minage(age), nrow(size.Size()) {
20 :    
21 :     int i;
22 :     if (nrow > 0) {
23 :     v = new PopRatioIndexVector*[nrow];
24 :     for (i = 0; i < nrow; i++)
25 :     v[i] = new PopRatioIndexVector(size[i], minl[i]);
26 :     } else
27 :     v = 0;
28 :     }
29 :    
30 :     AgeBandMatrixRatio::AgeBandMatrixRatio(int age, const PopRatioIndexVector& initial)
31 :     : minage(age), nrow(1) {
32 :    
33 :     v = new PopRatioIndexVector*[1];
34 :     v[0] = new PopRatioIndexVector(initial);
35 :     }
36 :    
37 :     AgeBandMatrixRatio::~AgeBandMatrixRatio() {
38 :     int i;
39 :     if (v != 0) {
40 :     for (i = 0; i < nrow; i++)
41 :     delete v[i];
42 :     delete[] v;
43 :     v = 0;
44 :     }
45 :     }
46 :    
47 :     int AgeBandMatrixRatio::numTagExperiments() const {
48 :     if (nrow > 0)
49 :     return (*v[0])[v[0]->minCol()].Size();
50 :     return 0;
51 :     }
52 :    
53 :     void AgeBandMatrixRatio::setToZero() {
54 :     int i, j, k;
55 :     for (i = 0; i < nrow; i++) {
56 :     for (j = v[i]->minCol(); j < v[i]->maxCol(); j++) {
57 :     for (k = 0; k < this->numTagExperiments(); k++) {
58 :     *(*v[i])[j][k].N = 0.0;
59 :     (*v[i])[j][k].R = 0.0;
60 :     }
61 :     }
62 :     }
63 :     }

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge