ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_a53.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  */
11 #include "fvar.hpp"
12 
13 void DF_dv_double_prod(void);
14 
19 dvar_vector operator*(const dvar_vector& t1, const double x)
20 {
24 
25  int min = t1.indexmin();
26  int max = t1.indexmax();
27  dvar_vector tmp(min, max);
28  save_identifier_string("ccbb");
29  fp->save_double_value(x);
30  double_and_int* ptmpi = tmp.va + min;
31  double_and_int* pt1i = t1.va + min;
32  for (int i = min; i <= max; ++i)
33  {
34  ptmpi->x = pt1i->x * x;
35 
36  ++pt1i;
37  ++ptmpi;
38  }
39 
42  save_identifier_string("DDaa");
45  return tmp;
46 }
47 
53 {
55 
59  double x=fp->restore_double_value();
61 
62  int min = t1_pos.indexmin();
63  int max = t1_pos.indexmax();
64  dvector dft1(min, max);
66  double* pdft1i = dft1.get_v() + max;
67  double* pdftmpi = dftmp.get_v() + max;
68  for (int i = max; i >= min; --i)
69  {
70  //tmp.elem_value(i)=value(x)*t1.elem_value(i)*x;
71  *pdft1i = *pdftmpi * x;
72 
73  --pdft1i;
74  --pdftmpi;
75  }
76  dft1.save_dvector_derivatives(t1_pos);
77 }
78 
83 dvar_vector operator*(const double x, const dvar_vector& t1)
84 {
85  return t1 * x;
86 }
#define x
Vector of double precision numbers.
Definition: dvector.h:50
void save_dvector_derivatives(const dvar_vector_position &pos) const
Puts the derivative values in a dvector into a dvar_vector&#39;s guts.
Definition: cmpdif5.cpp:212
Description not yet available.
Definition: fvar.hpp:4814
int indexmin() const
Definition: fvar.hpp:4827
ADMB variable vector.
Definition: fvar.hpp:2172
void verify_identifier_string(const char *)
Verifies gradient stack string.
Definition: cmpdif3.cpp:149
dmatrix operator*(const d3_array &t, const dvector &v)
Description not yet available.
Definition: d3arr12.cpp:17
Holds the data for the prevariable class.
Definition: fvar.hpp:191
void set_gradient_stack(void(*func)(void), double *dep_addr, double *ind_addr1=NULL, double mult1=0, double *ind_addr2=NULL, double mult2=0)
Description not yet available.
Definition: fvar.hpp:1045
int indexmax() const
Definition: fvar.hpp:4831
dvar_vector_position restore_dvar_vector_position()
Definition: cmpdif4.cpp:69
void RETURN_ARRAYS_INCREMENT()
Definition: gradstrc.cpp:478
#define min(a, b)
Definition: cbivnorm.cpp:188
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
double restore_double_value()
Definition: cmpdif8.cpp:186
void DF_dv_double_prod(void)
Description not yet available.
Definition: fvar_a53.cpp:52
static _THREAD gradient_structure * _instance
int save_identifier_string(const char *)
Writes a gradient stack verification string.
Definition: cmpdif2.cpp:315
int indexmin() const
Definition: fvar.hpp:2287
void save_dvar_vector_position(const dvar_vector &v)
Definition: cmpdif3.cpp:214
static _THREAD DF_FILE * fp
Stores the adjoint gradient data that will be processed by gradcalc.
dvector restore_dvar_vector_derivatives(const dvar_vector_position &tmp)
Description not yet available.
Definition: cmpdif5.cpp:150
void RETURN_ARRAYS_DECREMENT()
Definition: gradstrc.cpp:511
double_and_int * va
Definition: fvar.hpp:2175
void save_double_value(double x)
Definition: cmpdif8.cpp:94
static _THREAD grad_stack * GRAD_STACK1
#define max(a, b)
Definition: cbivnorm.cpp:189
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
double *& get_v(void)
Definition: dvector.h:148
int indexmax() const
Definition: fvar.hpp:2292
double x
&lt; value of the variable
Definition: fvar.hpp:195