ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_m43.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 
18  {
19  dvar_matrix& m= (dvar_matrix&) _m;
20  int i;
21  int mmin=m.indexmin();
22  int mmax=m.indexmax();
23  int ii=0;
24  ivector io(mmin-1,mmax);
25  io(mmin-1)=0;
26  for (i=mmin;i<=mmax;i++)
27  {
28  ii+=m(i).indexmax()-m(i).indexmin()+1;
29  io(i)=ii;
30  }
31  dvar_vector tmp(1,ii);
32  for (i=mmin;i<=mmax;i++)
33  {
34  tmp(io(i-1)+1,io(i)).shift(m(i).indexmin())=m(i);
35  }
36  return tmp;
37  }
38 
46 dvar_matrix MAT(const dvar_vector& v, int n, int m)
47  {
48  dvar_matrix tmp(1,n,1,m);
49  int mmin=v.indexmin();
50  int mmax=v.indexmax();
51  int ii=mmin;
52  if ( mmax-mmin+1 != n*m)
53  {
54  cerr << " Vector and Matrix sizes don't match in function MAT" << endl;
55  tmp.initialize();
56  return tmp;
57  }
58  for (int i=1;i<=n;i++)
59  {
60  for (int j=1;j<=m;j++)
61  {
62  tmp(i,j)=v(ii++);
63  }
64  }
65  return tmp;
66  }
dvar_vector & shift(int min)
Description not yet available.
Definition: fvar_arr.cpp:28
void initialize(void)
Zero initialize allocated dvar_matrix, then saves adjoint function and position data.
Definition: fvar_ma7.cpp:48
ADMB variable vector.
Definition: fvar.hpp:2172
prnstream & endl(prnstream &)
Array of integers(int) with indexes from index_min to indexmax.
Definition: ivector.h:50
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dmatrix MAT(const dvector &v, int n, int m)
The MAT operator is the inverse of the VEC operator.
Definition: dmat29.cpp:45
int indexmin() const
Definition: fvar.hpp:2287
int indexmax(void) const
Definition: fvar.hpp:2572
Class definition of matrix with derivitive information .
Definition: fvar.hpp:2480
dvector VEC(const dmatrix &_m)
The VEC operator concatenates the columns of matrix M into a column vector.
Definition: dmat29.cpp:17
int indexmin(void) const
Definition: fvar.hpp:2568
int indexmax() const
Definition: fvar.hpp:2292