ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dvect5.cpp
Go to the documentation of this file.
1 /*
2  * Author: David Fournier
3  * Copyright (c) 2008-2012 Regents of the University of California
4  */
5 #include "fvar.hpp"
6 
11 {
12  if (allocated()) // only initialize allocated objects
13  {
14  constexpr size_t sizeofdouble = sizeof(double);
15  memset(v + index_min, 0, size() * sizeofdouble);
16 /*
17  for (int i=indexmin();i<=indexmax();i++)
18  {
19  elem(i)=0.0;
20  }
21 */
22  }
23 }
24 /*
25 Ir I1mr ILmr Dr D1mr DLmr Dw D1mw DLmw
26 
27 Improved
28 7,747,070 18,376 179 1,367,130 0 0 1,822,840 0 0 memset(&elem(indexmin()), 0, size() * sizeof(double));
29 
30 Iterating
31 116,625,194 0 0 38,571,258 0 0 13,768,506 0 0 for (int i=indexmin();i<=indexmax();i++)
32  . . . . . . . . . {
33  86,809,632 18,376 179 24,802,752 0 0 24,802,752 678,899 574,142 elem(i)=0.0;
34  . . . . . . . . . }
35 */
double * v
pointer to the data
Definition: dvector.h:53
int allocated(void) const
Returns 1 (TRUE) if memory is allocated.
Definition: dvector.h:71
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void initialize(void)
Initialze all elements of dvector to zero.
Definition: dvect5.cpp:10
unsigned int size() const
Get number of elements in array.
Definition: dvector.h:209
int index_min
minimum valid subscript
Definition: dvector.h:54