ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lmat7.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 
14 /* JCA: Need sum(lvector)
15 AD_LONG_INT sum(const lmatrix& m)
16 {
17  AD_LONG_INT ssum=0;
18  int mmin=m.rowmin();
19  int mmax=m.rowmax();
20  for (int i=mmin;i<=mmax;i++)
21  {
22  ssum+=sum(m(i));
23  }
24  return ssum;
25 }
26 */
27 
32 AD_LONG_INT colsum(const lmatrix& m,int col)
33 {
34  if (col < m.colmin() || col > m.colmax())
35  {
36  ADMB_ARRAY_BOUNDS_ERROR("Row out of bounds",
37  "AD_LONG_INT colsum(const lmatrix& m,int col)",
38  m.colmin(), m.colmax(), col);
39  }
40  AD_LONG_INT isum=0;
41  int mmin=m.rowmin();
42  int mmax=m.rowmax();
43  for (int i=mmin;i<=mmax;i++)
44  {
45  isum+=m(i,col);
46  }
47  return isum;
48 }
49 
54 lvector column(const lmatrix& m,int col)
55 {
56  if (col < m.colmin() || col > m.colmax())
57  {
58  ADMB_ARRAY_BOUNDS_ERROR("Row out of bounds",
59  "lvector column(const lmatrix& m,int col)",
60  m.colmin(), m.colmax(), col);
61  }
62  int mmin=m.rowmin();
63  int mmax=m.rowmax();
64  lvector tmp(mmin,mmax);
65  for (int i=mmin;i<=mmax;i++)
66  {
67  tmp(i)=m(i,col);
68  }
69  return tmp;
70 }
int colmax(void) const
Definition: fvar.hpp:7588
Description not yet available.
Definition: fvar.hpp:656
int rowmax(void) const
Definition: fvar.hpp:7596
Description not yet available.
Definition: fvar.hpp:7500
int rowmin(void) const
Definition: fvar.hpp:7592
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
double colsum(const dmatrix &m, int col)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dmat27.cpp:10
#define ADMB_ARRAY_BOUNDS_ERROR(message, function, lower_bounds, upper_bounds, index)
Definition: admb_messages.h:47
int colmin(void) const
Definition: fvar.hpp:7584
#define AD_LONG_INT
Definition: fvar.hpp:81
dvector column(const dmatrix &matrix, int j)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dmat6.cpp:13