ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_ar7.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 #include "admb_messages.h"
13 
19  {
20  return extract_column(m,j);
21  }
22 
27 dvar_vector row(const dvar_matrix& m,int j)
28  {
29  return extract_row(m,j);
30  }
31 
37  {
38  if (j < m.colmin() || j > m.colmax())
39  {
40  ADMB_ARRAY_BOUNDS_ERROR("Invalid matrix column specified",
41  "dvar_vector extract_column(const dvar_matrix& m,int j)",
42  m.colmin(), m.colmax(), j);
43  }
44  dvar_vector tmp(m.rowmin(),m.rowmax());
45 
46  for (int i=m.rowmin(); i<=m.rowmax(); i++)
47  {
48  tmp.elem(i)=m.elem(i,j);
49  }
50  return(tmp);
51  }
52 
58  {
59  if (j < m.colmin() || j > m.colmax())
60  {
61  ADMB_ARRAY_BOUNDS_ERROR("Invalid matrix column specified",
62  "dvector column_value(const dvar_matrix& m,int j)",
63  m.colmin(), m.colmax(), j);
64  }
65  dvector tmp(m.rowmin(),m.rowmax());
66 
67  for (int i=m.rowmin(); i<=m.rowmax(); i++)
68  {
69  tmp.elem(i)=m.elem_value(i,j);
70  }
71  return(tmp);
72  }
73 
79  {
80  if (i < m.rowmin() || i > m.rowmax())
81  {
82  ADMB_ARRAY_BOUNDS_ERROR("Invalid matrix row specified",
83  "dvar_vector extract_row(const dvar_matrix& m,int i)",
84  m.rowmin(), m.rowmax(), i);
85  }
86  dvar_vector tmp(m.colmin(),m.colmax());
87 
88  for (int j=m.colmin(); j<=m.colmax(); j++)
89  {
90  tmp.elem(j)=m.elem(i,j);
91  }
92  return(tmp);
93  }
int rowmax(void) const
Definition: fvar.hpp:2564
dvar_vector & elem(int i)
Definition: fvar.hpp:2507
double & elem(int i)
Definition: dvector.h:152
double & elem_value(int i, int j)
Definition: fvar.hpp:2676
int colmin(void) const
Definition: fvar.hpp:2552
Vector of double precision numbers.
Definition: dvector.h:50
prevariable elem(int i)
Definition: fvar.hpp:2221
dvector row(const dmatrix &matrix, int i)
Returns a copied row for matrix at i.
Definition: dmat6.cpp:24
ADMB variable vector.
Definition: fvar.hpp:2172
dvector extract_column(const dmatrix &matrix, int j)
Extract copy of jth column vector from matrix m.
Definition: dmat6.cpp:34
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int rowmin(void) const
Definition: fvar.hpp:2560
#define ADMB_ARRAY_BOUNDS_ERROR(message, function, lower_bounds, upper_bounds, index)
Definition: admb_messages.h:47
dvector column_value(const dvar_matrix &m, int i)
Description not yet available.
Definition: fvar_ar7.cpp:57
Class definition of matrix with derivitive information .
Definition: fvar.hpp:2480
dvector extract_row(const dmatrix &matrix, int i)
Returns a copied row for matrix at i.
Definition: dmat6.cpp:66
dvector column(const dmatrix &matrix, int j)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dmat6.cpp:13
int colmax(void) const
Definition: fvar.hpp:2556