ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
f1b2v10.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier and Mollie Brooks
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
11 #include <df1b2fun.h>
12 
13 #ifndef OPT_LIB
14  #include <cassert>
15  #include <climits>
16 #endif
17 
22 df1b2vector pow(const df1b2vector& _v,double x)
23 {
25  //check_shape(x,M,"operator *");
26  int mmin=v.indexmin();
27  int mmax=v.indexmax();
28  df1b2vector tmp;
29  tmp.noallocate(mmin,mmax);
30  for (int i=mmin;i<=mmax;i++) tmp(i)=pow(v(i),x);
31  return tmp;
32 }
33 
38 df1b2vector pow(const df1b2vector& _x,const df1b2vector& _v)
39 {
42  //check_shape(x,M,"operator *");
43  //check_shape(x,M,"operator *");
44  int mmin=v.indexmin();
45  int mmax=v.indexmax();
46  df1b2vector tmp;
47  tmp.noallocate(mmin,mmax);
48  for (int i=mmin;i<=mmax;i++) tmp(i)=pow(x(i),v(i));
49  return tmp;
50 }
51 
57 {
60  int mmin=v.indexmin();
61  int mmax=v.indexmax();
62  df1b2vector tmp;
63  tmp.noallocate(mmin,mmax);
64  for (int i=mmin;i<=mmax;i++)
65  {
66  tmp(i)=pow(v(i),x);
67  }
68  return tmp;
69 }
70 
76 {
79  int mmin=x.indexmin();
80  int mmax=x.indexmax();
81  df1b2vector tmp;
82  tmp.noallocate(mmin,mmax);
83  for (int i=mmin;i<=mmax;i++)
84  {
85  tmp(i)=pow(v,x(i));
86  }
87  return tmp;
88 }
89 
94 df1b2vector pow(const double v,const df1b2vector& _x)
95 {
97  int mmin=x.indexmin();
98  int mmax=x.indexmax();
99  df1b2vector tmp;
100  tmp.noallocate(mmin,mmax);
101  for (int i=mmin;i<=mmax;i++)
102  {
103  tmp(i)=pow(v,x(i));
104  }
105  return tmp;
106 }
113 {
116  df1b2vector y(x.indexmin(), x.indexmax());
117  for(int i=x.indexmin(); i<=x.indexmax(); i++)
118  {
119  y(i)=pow(x(i),a);
120  }
121 
123  return(y);
124 }
131 {
134  df1b2vector y(x.indexmin(), x.indexmax());
135 
136  for(int i=x.indexmin(); i<=x.indexmax(); i++)
137  {
138  y(i)=pow(x(i),a(i));
139  }
140 
142  return(y);
143 }
149  dvar_vector pow(const dvar_vector& v1, const dvector& v2)
150  {
153 
154  dvar_vector tmp(v1.indexmin(),v1.indexmax());
155  for (int i=v1.indexmin();i<=v1.indexmax();i++)
156  {
157  tmp.elem(i)=pow(v1.elem(i),v2.elem(i));
158  }
160  return(tmp);
161  }
167  df1b2vector pow(df1b2vector const& _x,dvector const& v)
168  {
170  int mmin=v.indexmin();
171  int mmax=v.indexmax();
172  df1b2vector tmp;
173  tmp.noallocate(mmin,mmax);
174  for (int i=mmin;i<=mmax;i++) tmp(i)=pow(x(i),v(i));
175  return tmp;
176  }
177 
183 {
186  df1b2variable tmp=0.0;
187  int mmin=x.indexmin();
188  int mmax=x.indexmax();
189  for (int i=mmin;i<=mmax;i++)
190  {
191  *tmp.get_u() += *x(i).get_u() * *y(i).get_u();
192  }
193  {
194  double* zd=tmp.get_u_dot();
195  for (unsigned int j=0;j<df1b2variable::nvar;j++)
196  {
197  *zd++ = 0;
198  }
199  }
200  for (int i=mmin;i<=mmax;i++)
201  {
202  double * zd=tmp.get_u_dot();
203  double * xd=x(i).get_u_dot();
204  double * yd=y(i).get_u_dot();
205  double xu= *x(i).get_u();
206  double yu= *y(i).get_u();
207 
208  for (unsigned int j=0;j<df1b2variable::nvar;j++)
209  {
210  *zd++ += yu * *xd++ + xu * *yd++;
211  }
212  }
213  // WRITE WHATEVER ON TAPE
215  f1b2gradlist->write_pass1_prod(&x,&y,&tmp);
216 
217  return tmp;
218 }
219 
224 void ad_read_pass2_prod_vector(void);
225 
227  const df1b2vector * _py,df1b2variable * pz)
228  {
231  ncount++;
232 #if defined(CHECK_COUNT)
233  if (ncount >= ncount_check)
234  cout << ncount << endl;
235 #endif
236  unsigned int nvar=df1b2variable::nvar;
237 
238  int mmin=px->indexmin();
239  int mmax=px->indexmax();
240 #ifndef OPT_LIB
241  assert(mmax >= mmin);
242 #endif
243  size_t size = (size_t)(mmax - mmin + 1);
244  constexpr size_t sizeofdouble = sizeof(double);
245 
246  //int total_bytes=3*sizeof(df1b2_header)+2*(nvar+1)*sizeof(double);
247  size_t total_bytes= 2*sizeof(int) + 2 * size * sizeof(df1b2_header)
248  + sizeof(df1b2_header) + 2 * size * sizeofdouble
249  + 2 * size * nvar * sizeofdouble;
250 // string identifier debug stuff
251 #if defined(SAFE_ALL)
252  char ids[]="DL";
253  size_t slen=strlen(ids);
254  total_bytes+=slen;
255 #endif
256 
257  list.check_buffer_size(total_bytes);
258 
259  void * tmpptr=list.bptr;
260 #if defined(SAFE_ALL)
261  memcpy(list,ids,slen);
262 #endif
263 // end of string identifier debug stuff
264 
265  memcpy(list,&mmin,sizeof(int));
266  memcpy(list,&mmax,sizeof(int));
267  for (int i=mmin;i<=mmax;i++)
268  {
269  memcpy(list,(df1b2_header*)( &(*px)(i) ),sizeof(df1b2_header));
270  memcpy(list,(df1b2_header*)( &(*py)(i) ),sizeof(df1b2_header));
271  }
272  memcpy(list,(df1b2_header*)(pz),sizeof(df1b2_header));
273 
274  for (int i=mmin;i<=mmax;i++)
275  {
276  memcpy(list,(*px)(i).get_u(),sizeofdouble);
277  memcpy(list,(*py)(i).get_u(),sizeofdouble);
278  }
279  for (int i=mmin;i<=mmax;i++)
280  {
281  memcpy(list,(*px)(i).get_u_dot(),nvar*sizeofdouble);
282  memcpy(list,(*py)(i).get_u_dot(),nvar*sizeofdouble);
283  }
284  // ***** write record size
286  //cout << "XX " << nlist.bptr->numbytes << " " << total_bytes << endl;
288  ++nlist;
289  return 0;
290  }
291 
292 void read_pass2_1_prod_vector(void);
293 void read_pass2_2_prod_vector(void);
294 void read_pass2_3_prod_vector(void);
295 
301 {
303  {
304  case 1:
306  break;
307  case 2:
309  break;
310  case 3:
312  break;
313  default:
314  cerr << "illegal value for df1b2variable::pass = "
316  ad_exit(1);
317  }
318 }
319 
325 {
326  size_t nvar = df1b2variable::nvar;
327 
328  constexpr size_t sizeofdouble = sizeof(double);
329  size_t size = nvar * sizeofdouble;
330 
332  int num_bytes=f1b2gradlist->nlist.bptr->numbytes;
333  list-=num_bytes;
334  list.saveposition(); // save pointer to beginning of record;
335 
336 #if defined(SAFE_ALL)
338 #endif
339  char * bptr=f1b2gradlist->list.bptr;
340  int& mmin = *(int *) bptr;
341  bptr+=sizeof(int);
342  int& mmax = *(int *) bptr;
343  bptr+=sizeof(int);
344  df1b2_header_ptr_vector px(mmin,mmax);
345  df1b2_header_ptr_vector py(mmin,mmax);
346  double_ptr_vector xdot(mmin,mmax);
347  double_ptr_vector ydot(mmin,mmax);
348  dvector xu(mmin,mmax);
349  dvector yu(mmin,mmax);
350 
351  df1b2_header** ppxi = &px(mmin);
352  df1b2_header** ppyi = &py(mmin);
353  for (int i=mmin;i<=mmax;i++)
354  {
355  // df1b2_header *
356  *ppxi = (df1b2_header*)bptr;
357  bptr+=sizeof(df1b2_header);
358  // df1b2_header *
359  *ppyi = (df1b2_header*)bptr;
360  bptr+=sizeof(df1b2_header);
361 
362  ++ppxi;
363  ++ppyi;
364  }
365  df1b2_header * pz=(df1b2_header *) bptr;
366  bptr+=sizeof(df1b2_header);
367 
368  double* pxui = xu.get_v() + mmin;
369  double* pyui = yu.get_v() + mmin;
370  for (int i=mmin;i<=mmax;i++)
371  {
372  memcpy(pxui, bptr, sizeofdouble);
373  bptr+=sizeofdouble;
374  memcpy(pyui, bptr, sizeofdouble);
375  bptr+=sizeofdouble;
376 
377  ++pxui;
378  ++pyui;
379  }
380  size_t nvarsizeofdouble = nvar * sizeofdouble;
381  for (int i=mmin;i<=mmax;i++)
382  {
383  // double *
384  xdot(i)=(double*)bptr;
385  bptr += nvarsizeofdouble;
386  // double *
387  ydot(i)=(double*)bptr;
388  bptr += nvarsizeofdouble;
389  }
390 
391  list.restoreposition(); // save pointer to beginning of record;
392 
393  // ****************************************************************
394  // turn this off if no third derivatives are calculated
395  // if (!no_third_derivatives)
396  // {
397  // save for second reverse pass
398  // save identifier 1
399  test_smartlist & list2 = f1b2gradlist->list2;
400 
401  size_t total_bytes=2*nvar*sizeof(double);
402 // string identifier debug stuff
403 #if defined(SAFE_ALL)
404  char ids[]="QK";
405  size_t slen=strlen(ids);
406  total_bytes+=slen;
407 #endif
408 
409  list2.check_buffer_size(total_bytes);
410 
411  void * tmpptr=list2.bptr;
412 #if defined(SAFE_ALL)
413  memcpy(list2,ids,slen);
414 #endif
415 
417 
418  memcpy(list2,pz->get_u_bar(), size);
419  memcpy(list2,pz->get_u_dot_bar(), size);
420  *nlist2.bptr=adptr_diff(list2.bptr,tmpptr);
421  ++nlist2;
422 
423  // Do first reverse pass calculations
424  ppxi = &px(mmin);
425  ppyi = &py(mmin);
426  double* pyu = yu.get_v() + mmin;
427  double* pxu = xu.get_v() + mmin;
428  for (int i=mmin;i<=mmax;i++)
429  {
430  double yui = *pyu;
431  double* pz_u_bar = pz->u_bar;
432  double* pxi_u_bar = (*ppxi)->u_bar;
433  for (size_t j = 0; j < nvar; ++j)
434  {
435  *pxi_u_bar += yui * *pz_u_bar;
436 
437  ++pz_u_bar;
438  ++pxi_u_bar;
439  }
440  ++pyu;
441 
442  double xui = *pxu;
443  pz_u_bar = pz->u_bar;
444  double* pyi_u_bar = (*ppyi)->u_bar;
445  for (size_t j = 0; j < nvar; ++j)
446  {
447  *pyi_u_bar += xui * *pz_u_bar;
448 
449  ++pz_u_bar;
450  ++pyi_u_bar;
451  }
452  ++pxu;
453  ++ppxi;
454  ++ppyi;
455  }
456 
457  ppxi = &px(mmin);
458  ppyi = &py(mmin);
459  pyu = yu.get_v() + mmin;
460  pxu = xu.get_v() + mmin;
461  for (int i=mmin;i<=mmax;i++)
462  {
463  double* pydoti = ydot(i);
464  double* pz_u_dot_bar = pz->u_dot_bar;
465  double* pxi_u_bar = (*ppxi)->u_bar;
466  for (size_t j=0;j<nvar;j++)
467  {
468  *pxi_u_bar += *pydoti * *pz_u_dot_bar;
469 
470  ++pydoti;
471  ++pz_u_dot_bar;
472  ++pxi_u_bar;
473  }
474 
475  pz_u_dot_bar = pz->u_dot_bar;
476  double* pxdoti = xdot(i);
477  double* pyi_u_bar = (*ppyi)->u_bar;
478  for (size_t j=0;j<nvar;j++)
479  {
480  *pyi_u_bar += *pxdoti * *pz_u_dot_bar;
481 
482  ++pxdoti;
483  ++pz_u_dot_bar;
484  ++pyi_u_bar;
485  }
486 
487  double yui = *pyu;
488  pz_u_dot_bar = pz->u_dot_bar;
489  double* pxi_u_dot_bar = (*ppxi)->u_dot_bar;
490  for (size_t j=0;j<nvar;j++)
491  {
492  *pxi_u_dot_bar += yui * *pz_u_dot_bar;
493 
494  ++pz_u_dot_bar;
495  ++pxi_u_dot_bar;
496  }
497  ++pyu;
498 
499  double xui = *pxu;
500  pz_u_dot_bar = pz->u_dot_bar;
501  double* pyi_u_dot_bar = (*ppyi)->u_dot_bar;
502  for (size_t j=0;j<nvar;j++)
503  {
504  *pyi_u_dot_bar += xui * *pz_u_dot_bar;
505 
506  ++pz_u_dot_bar;
507  ++pyi_u_dot_bar;
508  }
509  ++pxu;
510  ++ppyi;
511  ++ppxi;
512  }
513 
514  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
515  memset(pz->u_bar, 0, size);
516  memset(pz->u_dot_bar, 0, size);
517 }
518 
524 {
525  //const int nlist_record_size=sizeof(int)+sizeof(char*);
526  // We are going forward for bptr and backword for bptr2
527  //
528  // list 1
529  //
530  unsigned int nvar=df1b2variable::nvar;
532 
533  //int total_bytes=3*sizeof(df1b2_header)+sizeof(char*)
534  // +2*(nvar+1)*sizeof(double);
535  //int total_bytes=3*sizeof(df1b2_header)
536  // +2*(nvar+1)*sizeof(double);
537 // string identifier debug stuff
538 #if defined(SAFE_ALL)
539  //char ids[]="DL";
540  //int slen=strlen(ids);
541  //total_bytes+=slen;
542 #endif
543 // end of string identifier debug stuff
544 
546  int total_bytes = nlist.bptr->numbytes;
547  if (total_bytes > 0)
548  {
549  list.check_buffer_size((size_t)total_bytes);
550  }
551  list.saveposition(); // save pointer to beginning of record;
552  //cout << "YY " << total_bytes << endl;
553  //
554  // list 2
555  //
558  // get record size
559  int num_bytes2=*nlist2.bptr;
560  --nlist2;
561  // backup the size of the record
562  list2-=num_bytes2;
563  list2.saveposition(); // save pointer to beginning of record;
564  // save the pointer to the beginning of the record
565  // bptr and bptr2 now both point to the beginning of their records
566 
567  //df1b2_header x,z;
568  //df1b2function2 * pf;
569 
570  // get info from tape1
571  // get info from tape1
572 #if defined(SAFE_ALL)
573  checkidentiferstring("DL",list);
574  checkidentiferstring("QK",list2);
575 #endif
576  int mmin = *(int *) list.bptr;
577  list.bptr+=sizeof(int);
578  int mmax = *(int *) list.bptr;
579  list.bptr+=sizeof(int);
580 
581  df1b2_header_ptr_vector px(mmin,mmax);
582  df1b2_header_ptr_vector py(mmin,mmax);
583  double_ptr_vector xdot(mmin,mmax);
584  double_ptr_vector ydot(mmin,mmax);
585  dvector xu(mmin,mmax);
586  dvector yu(mmin,mmax);
587 
588  df1b2_header** ppxi = &px(mmin);
589  df1b2_header** ppyi = &py(mmin);
590  for (int i=mmin;i<=mmax;i++)
591  {
592  // df1b2_header * //
593  *ppxi = (df1b2_header*)list.bptr;
594  list.bptr+=sizeof(df1b2_header);
595  // df1b2_header *
596  *ppyi = (df1b2_header*)list.bptr;
597  list.bptr+=sizeof(df1b2_header);
598 
599  ++ppxi;
600  ++ppyi;
601  }
602 
603  df1b2_header * pz=(df1b2_header *) list.bptr;
604  list.bptr+=sizeof(df1b2_header);
605 
606  constexpr size_t sizeofdouble = sizeof(double);
607  double* pxui = xu.get_v() + mmin;
608  double* pyui = yu.get_v() + mmin;
609  for (int i=mmin;i<=mmax;i++)
610  {
611  memcpy(pxui,list.bptr, sizeofdouble);
612  list.bptr += sizeofdouble;
613  memcpy(pyui,list.bptr, sizeofdouble);
614  list.bptr += sizeofdouble;
615 
616  ++pxui;
617  ++pyui;
618  }
619 
620  size_t nvarsizeofdouble = nvar * sizeofdouble;
621  for (int i=mmin;i<=mmax;i++)
622  {
623  xdot(i)=(double*)list.bptr;
624  list.bptr += nvarsizeofdouble;
625  ydot(i)=(double*)list.bptr;
626  list.bptr += nvarsizeofdouble;
627  }
628  list.restoreposition(total_bytes); // save pointer to beginning of record;
629 
630  double* zbar=(double*)list2.bptr;
631  double* zdotbar=(double*)(list2.bptr + nvarsizeofdouble);
632  list2.restoreposition(); // save pointer to beginning of record;
633 
634  double* z_bar_tilde=pz->get_u_bar_tilde();
635  double* z_dot_bar_tilde=pz->get_u_dot_bar_tilde();
636 
637  memset(z_bar_tilde, 0, nvarsizeofdouble);
638  memset(z_dot_bar_tilde, 0, nvarsizeofdouble);
639 
640  ppxi = &px(mmin);
641  ppyi = &py(mmin);
642  double* pyu = yu.get_v() + mmin;
643  double* pxu = xu.get_v() + mmin;
644  for (int i=mmin;i<=mmax;i++)
645  {
646  double* x_tilde= (*ppxi)->get_u_tilde();
647  double* x_dot_tilde= (*ppxi)->get_u_dot_tilde();
648  double* x_bar_tilde= (*ppxi)->get_u_bar_tilde();
649  double* x_dot_bar_tilde= (*ppxi)->get_u_dot_bar_tilde();
650  double* y_tilde= (*ppyi)->get_u_tilde();
651  double* y_dot_tilde= (*ppyi)->get_u_dot_tilde();
652  double* y_bar_tilde= (*ppyi)->get_u_bar_tilde();
653  double* y_dot_bar_tilde= (*ppyi)->get_u_dot_bar_tilde();
654 
655  double yui = *pyu;
656  // start wjth x and add y
657  double* px_bar_tilde = x_bar_tilde;
658  for (size_t j=0;j<nvar;j++)
659  {
660  z_bar_tilde[j]+= yui * *px_bar_tilde;
661  *y_tilde+=zbar[j]* *px_bar_tilde;
662  ++px_bar_tilde;
663  }
664 
665  double* px_dot_bar_tilde = x_dot_bar_tilde;
666  for (size_t j=0;j<nvar;j++)
667  {
668  *y_tilde+=zdotbar[j]* *px_dot_bar_tilde;
669  z_dot_bar_tilde[j]+= yui * *px_dot_bar_tilde;
670  ++px_dot_bar_tilde;
671  }
672  ++pyu;
673 
674  double xui = *pxu;
675  // start wjth y and add x
676  double* py_bar_tilde = y_bar_tilde;
677  for (size_t j=0;j<nvar;j++)
678  {
679  *x_tilde+=zbar[j]* *py_bar_tilde;
680  z_bar_tilde[j]+= xui * *py_bar_tilde;
681  ++py_bar_tilde;
682  }
683 
684  double* py_dot_bar_tilde = y_dot_bar_tilde;
685  for (size_t j=0;j<nvar;j++)
686  {
687  *x_tilde+=zdotbar[j]* *py_dot_bar_tilde;
688  z_dot_bar_tilde[j]+= xui * *py_dot_bar_tilde;
689  ++py_dot_bar_tilde;
690  }
691  ++pxu;
692 
693  px_bar_tilde = x_bar_tilde;
694  for (size_t j=0;j<nvar;j++)
695  {
696  y_dot_tilde[j]+=zdotbar[j]* *px_bar_tilde;
697  z_dot_bar_tilde[j]+=ydot(i)[j]* *px_bar_tilde;
698  ++px_bar_tilde;
699  }
700  py_bar_tilde = y_bar_tilde;
701  for (size_t j=0;j<nvar;j++)
702  {
703  x_dot_tilde[j]+=zdotbar[j]* *py_bar_tilde;
704  z_dot_bar_tilde[j]+=xdot(i)[j]* *py_bar_tilde;
705  ++py_bar_tilde;
706  }
707  ++ppxi;
708  ++ppyi;
709  }
710 }
711 
717 {
718  // We are going backword for bptr and forward for bptr2
719  // the current entry+2 in bptr is the size of the record i.e
720  // points to the next record
721  unsigned int nvar=df1b2variable::nvar;
724  // nlist-=sizeof(int);
725  // get record size
726  int num_bytes=nlist.bptr->numbytes;
727  // backup the size of the record
728  list-=num_bytes;
729  list.saveposition(); // save pointer to beginning of record;
730  // save the pointer to the beginning of the record
731 
732  //df1b2_header x,z;
733  //df1b2function2 * pf;
734 
735  // get info from tape1
736  // get info from tape1
737 #if defined(SAFE_ALL)
738  checkidentiferstring("DL",list);
739 #endif
740  int& mmin = *(int *) list.bptr;
741  list.bptr+=sizeof(int);
742  int& mmax = *(int *) list.bptr;
743  list.bptr+=sizeof(int);
744  df1b2_header_ptr_vector px(mmin,mmax);
745  df1b2_header_ptr_vector py(mmin,mmax);
746  double_ptr_vector xdot(mmin,mmax);
747  double_ptr_vector ydot(mmin,mmax);
748  dvector xu(mmin,mmax);
749  dvector yu(mmin,mmax);
750  int i;
751  df1b2_header** ppxi = &px(mmin);
752  df1b2_header** ppyi = &py(mmin);
753  for (i=mmin;i<=mmax;i++)
754  {
755  // df1b2_header *
756  *ppxi = (df1b2_header*)list.bptr;
757  list.bptr+=sizeof(df1b2_header);
758  // df1b2_header *
759  *ppyi = (df1b2_header*)list.bptr;
760  list.bptr+=sizeof(df1b2_header);
761 
762  ++ppxi;
763  ++ppyi;
764  }
765  df1b2_header * pz=(df1b2_header *) list.bptr;
766  list.bptr+=sizeof(df1b2_header);
767 
768  constexpr size_t sizeofdouble = sizeof(double);
769 
770  double* pxui = xu.get_v() + mmin;
771  double* pyui = yu.get_v() + mmin;
772  for (i=mmin;i<=mmax;i++)
773  {
774  memcpy(pxui, list.bptr, sizeofdouble);
775  list.bptr+=sizeofdouble;
776  memcpy(pyui, list.bptr, sizeofdouble);
777  list.bptr+=sizeofdouble;
778 
779  ++pxui;
780  ++pyui;
781  }
782 
783  size_t nvarsizeofdouble = nvar * sizeofdouble;
784  for (i=mmin;i<=mmax;i++)
785  {
786  // double *
787  xdot(i)=(double*)list.bptr;
788  list.bptr += nvarsizeofdouble;
789  // double *
790  ydot(i)=(double*)list.bptr;
791  list.bptr += nvarsizeofdouble;
792  }
793 
794  list.restoreposition(); // save pointer to beginning of record;
795 
796  pxui = xu.get_v() + mmin;
797  pyui = yu.get_v() + mmin;
798  ppxi = &px(mmin);
799  ppyi = &py(mmin);
800  for (i=mmin;i<=mmax;i++)
801  {
802  *((*ppxi)->u_tilde) += *pyui * *(pz->u_tilde);
803  *((*ppyi)->u_tilde) += *pxui * *(pz->u_tilde);
804 
805  double* pz_u_dot_tildej = pz->u_dot_tilde;
806  for (size_t j=0;j<nvar;j++)
807  {
808  *((*ppyi)->u_tilde) += xdot(i)[j]* *pz_u_dot_tildej;
809  *((*ppxi)->u_tilde) += ydot(i)[j]* *pz_u_dot_tildej;
810 
811  ++pz_u_dot_tildej;
812  }
813 
814  double* ppxi_u_dot_tildej = (*ppxi)->u_dot_tilde;
815  double* ppyi_u_dot_tildej = (*ppyi)->u_dot_tilde;
816  pz_u_dot_tildej = pz->u_dot_tilde;
817  for (size_t j=0;j<nvar;j++)
818  {
819  *ppxi_u_dot_tildej += *pyui * *pz_u_dot_tildej;
820  *ppyi_u_dot_tildej += *pxui * *pz_u_dot_tildej;
821 
822  ++ppxi_u_dot_tildej;
823  ++ppyi_u_dot_tildej;
824  ++pz_u_dot_tildej;
825  }
826 
827  ++pxui;
828  ++pyui;
829  ++ppxi;
830  ++ppyi;
831  }
832  *(pz->u_tilde)=0;
833 
834  memset(pz->u_dot_tilde, 0, nvarsizeofdouble);
835 }
char * bptr
Definition: df1b2fun.h:543
double * get_u_bar_tilde() const
Definition: df1b2fun.h:234
void check_buffer_size(const size_t)
Description not yet available.
Definition: df1b2f10.cpp:185
df1b2_gradlist * f1b2gradlist
Definition: df1b2glo.cpp:49
void read_pass2_3_prod_vector(void)
Description not yet available.
Definition: f1b2v10.cpp:716
void memcpy(test_smartlist &dest, void *source, const size_t nsize)
memcpy for test_smartlist
Definition: df1b2f10.cpp:367
double & elem(int i)
Definition: dvector.h:152
double * u_bar
Definition: df1b2fun.h:197
double * get_u() const
Definition: df1b2fun.h:228
#define x
#define ADUNCONST(type, obj)
Creates a shallow copy of obj that is not CONST.
Definition: fvar.hpp:140
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Get minimum valid index.
Definition: dvector.h:199
static int passnumber
Definition: df1b2fun.h:289
Description not yet available.
Definition: df1b2fun.h:953
int adptr_diff(void *x, void *y)
Definition: df1b2fn2.cpp:110
exitptr ad_exit
Definition: gradstrc.cpp:53
prevariable elem(int i)
Definition: fvar.hpp:2221
Description not yet available.
Definition: df1b2fun.h:1774
ADMB variable vector.
Definition: fvar.hpp:2172
double * u_tilde
Definition: df1b2fun.h:199
void ad_read_pass2_prod_vector(void)
Description not yet available.
Definition: f1b2v10.cpp:300
void restoreposition(void)
Definition: df1b2fun.h:560
Description not yet available.
Definition: df1b2fun.h:266
Description not yet available.
Definition: df1b2fun.h:669
dmatrix operator*(const d3_array &t, const dvector &v)
Description not yet available.
Definition: d3arr12.cpp:17
fixed_smartlist nlist
Definition: df1b2fun.h:754
double * get_u_dot() const
Definition: df1b2fun.h:229
int write_pass1_prod(double x, const df1b2variable *py, df1b2variable *pz)
Description not yet available.
Definition: df1b2prc.cpp:65
Description not yet available.
Definition: df1b2fun.h:602
prnstream & endl(prnstream &)
double * u_dot_bar
Definition: df1b2fun.h:198
test_smartlist list
Definition: df1b2fun.h:753
void noallocate(int lib, int ub)
Description not yet available.
Definition: f1b2vc1.cpp:733
ADrfptr pf
Definition: df1b2fun.h:595
void RETURN_ARRAYS_INCREMENT()
Definition: gradstrc.cpp:478
static int no_derivatives
Definition: df1b2fun.h:759
int indexmax() const
Get maximum valid index.
Definition: dvector.h:204
fixed_smartlist2 nlist2
Definition: df1b2fun.h:756
Description not yet available.
Definition: df1b2fun.h:1756
static _THREAD gradient_structure * _instance
Description not yet available.
Definition: df1b2fun.h:527
double * get_u_dot_bar() const
Definition: df1b2fun.h:231
int indexmin() const
Definition: fvar.hpp:2287
double * get_u_dot_bar_tilde() const
Definition: df1b2fun.h:235
static unsigned int nvar
Definition: df1b2fun.h:290
void(* ADrfptr)(void)
Definition: df1b2fun.cpp:139
void read_pass2_1_prod_vector(void)
Description not yet available.
Definition: f1b2v10.cpp:324
double * u_dot_tilde
Definition: df1b2fun.h:200
Base class for df1b2variable.
Definition: df1b2fun.h:191
Description not yet available.
fixed_list_entry * bptr
Definition: df1b2fun.h:626
void RETURN_ARRAYS_DECREMENT()
Definition: gradstrc.cpp:511
void checkidentiferstring(const char *ids, test_smartlist &list)
Description not yet available.
Definition: df1b2fn5.cpp:256
void read_pass2_2_prod_vector(void)
Description not yet available.
Definition: f1b2v10.cpp:523
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
double * get_u_bar() const
Definition: df1b2fun.h:230
int numbytes
Definition: df1b2fun.h:594
double *& get_v(void)
Definition: dvector.h:148
void saveposition(void)
Definition: df1b2fun.h:552
int indexmax() const
Definition: fvar.hpp:2292
test_smartlist list2
Definition: df1b2fun.h:755
d3_array pow(const d3_array &m, int e)
Description not yet available.
Definition: d3arr6.cpp:17