ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvarm1_i.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 #ifdef __TURBOC__
14  #pragma hdrstop
15  #include <iostream.h>
16  #include <iomanip.h>
17  #include <fstream.h>
18  #define __USE_IOSTREAM__
19 #endif
20 
21 #ifdef __ZTC__
22  #include <iostream.hpp>
23  #include <iomanip.hpp>
24  #include <fstream.hpp>
25  #define __USE_IOSTREAM__
26 #endif
27 
28 // unformatted i/o
29 
30 #ifdef __USE_IOSTREAM__
31 
36 uistream& operator>>(const uistream& istr, const dvar_matrix& _z)
37 {
39  z.read_from(istr);
40  return (uistream&)istr;
41 }
47 {
48  if (allocated(*this))
49  {
50  //size = max - min + 1;
51  int n = rowmax();
52  for (int i = rowmin(); i <= n; ++i)
53  {
54  s >> (*this)[i];
55  if (!s.good())
56  {
57  cerr << " Error: Unable to read dvar_matrix from uostream in "
58  << __FILE__ << ':' << __LINE__ << '\n';
59  ad_exit(1);
60  }
61  }
62  }
63 }
69 uostream& operator<<(const uostream& ostr, const dvar_matrix& z)
70 {
71  if (allocated(z))
72  z.write_on(ostr);
73 
74  return (uostream&)ostr;
75 }
80 void dvar_matrix::write_on(const uostream& s) const
81 {
82  if (allocated(*this))
83  {
84  int n = rowmax();
85  for (int i = rowmin(); i <= n; ++i)
86  {
87  s << (*this)[i];
88  if (!s.good())
89  {
90  cerr << " Error: Unable to write dvar_matrix to uostream in "
91  << __FILE__ << ':' << __LINE__ << '\n';
92  ad_exit(1);
93  }
94  }
95  }
96 }
97 #endif
98 
int rowmax(void) const
Definition: fvar.hpp:2564
void read_from(const istream &)
Read values to dvar_matrix from input istream s.
Definition: fvarm_io.cpp:97
int allocated(const ivector &v)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: fvar_a59.cpp:13
#define ADUNCONST(type, obj)
Creates a shallow copy of obj that is not CONST.
Definition: fvar.hpp:140
exitptr ad_exit
Definition: gradstrc.cpp:53
Description not yet available.
Definition: fvar.hpp:3398
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int rowmin(void) const
Definition: fvar.hpp:2560
void write_on(const ostream &) const
Description not yet available.
Definition: fvarm_io.cpp:49
istream & operator>>(const istream &input, const d3_array &arr3)
Read values from input stream into arr3.
Definition: d3_io.cpp:60
ostream & operator<<(const ostream &_s, preshowpoint p)
Description not yet available.
Definition: admanip.cpp:48
Class definition of matrix with derivitive information .
Definition: fvar.hpp:2480
Description not yet available.
Definition: fvar.hpp:3516