ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ranfill1.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
16 #include <fvar.hpp>
17 
18 #ifdef __TURBOC__
19  #pragma hdrstop
20  #include <iostream.h>
21 #endif
22 
23 #ifdef __ZTC__
24  #include <iostream.hpp>
25 #endif
26 
27 #include <math.h>
28 
33 void dvar_vector::fill_seqadd(const double base, const double offset)
34  {
37 
38  double temp=0;
39  for (int i=indexmin(); i<=indexmax(); i++)
40  {
41  elem(i) =base+temp;
42  temp =temp+offset;
43  }
45  }
55 void imatrix::colfill_seqadd(int j, int base, int offset)
56  {
57  int temp=0;
58  for (int i=rowmin(); i<=rowmax(); i++)
59  {
60  (*this)[i][j] = base+temp;
61  temp = temp+offset;
62  }
63  }
74 void dvar_matrix::colfill_seqadd(const int& j, const double base,
75  const double offset)
76  {
77  double temp=0;
80  for (int i=rowmin(); i<=rowmax(); i++)
81  {
82  elem(i,j) =base+temp;
83  temp =temp+offset;
84  }
86  }
87 
96 void dvar_matrix::rowfill_seqadd(const int& i, const double base,
97  const double offset)
98  {
99  double temp=0;
102  for (int j=colmin(); j<=colmax(); j++)
103  {
104  elem(i,j) =base+temp;
105  temp =temp+offset;
106  }
108  }
109 
118 void dvar_matrix::colfill(int j, const dvar_vector& v)
119  {
122  for (int i=rowmin(); i<=rowmax(); i++)
123  {
124  (*this)[i][j]=v[i];
125  }
127  }
128 
137 void dvar_matrix::rowfill(int i, const dvar_vector& v)
138  {
141  // for (int j=colmin(); j<=colmax(); j++)
142  // {
143  // (*this)[i][j]=v[j];
144  // }
145  (*this)[i]=v;
147  }
void colfill_seqadd(const int &, double, double)
Fills column of a matrix with a sequence of the form base, base+offset, base+2*offset,...
Definition: ranfill1.cpp:74
int rowmax(void) const
Definition: fvar.hpp:2564
dvar_vector & elem(int i)
Definition: fvar.hpp:2507
void colfill_seqadd(int, int, int)
Fills column of a matrix with a sequence of the form base, base+offset, base+2*offset,...
Definition: ranfill1.cpp:55
int colmin(void) const
Definition: fvar.hpp:2552
int rowmin() const
Definition: imatrix.h:146
prevariable elem(int i)
Definition: fvar.hpp:2221
ADMB variable vector.
Definition: fvar.hpp:2172
void colfill(int j, const dvar_vector &v)
Fills column of a matrix with a vector (supplied)
Definition: ranfill1.cpp:118
void RETURN_ARRAYS_INCREMENT()
Definition: gradstrc.cpp:478
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
static _THREAD gradient_structure * _instance
void rowfill_seqadd(const int &, double, double)
Fills vector with a sequence of the form base, base+offset, base+2*offset,...
Definition: ranfill1.cpp:96
int rowmin(void) const
Definition: fvar.hpp:2560
int indexmin() const
Definition: fvar.hpp:2287
void rowfill(int j, const dvar_vector &v)
Fills row of a matrix with a vector (supplied)
Definition: ranfill1.cpp:137
void RETURN_ARRAYS_DECREMENT()
Definition: gradstrc.cpp:511
void fill_seqadd(double, double)
Description not yet available.
Definition: ranfill1.cpp:33
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
int rowmax() const
Definition: imatrix.h:150
int indexmax() const
Definition: fvar.hpp:2292
int colmax(void) const
Definition: fvar.hpp:2556