ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dmat2.cpp
Go to the documentation of this file.
1 
6 #include "fvar.hpp"
7 
13 dmatrix trans(const dmatrix& m1)
14 {
15  dmatrix tmp(m1.colmin(), m1.colmax(), m1.rowmin(), m1.rowmax());
16 
17  for (int i = m1.rowmin(); i <= m1.rowmax(); ++i)
18  {
19  for (int j = m1.colmin(); j <= m1.colmax(); ++j)
20  {
21  tmp[j][i] = m1[i][j];
22  }
23  }
24  return tmp;
25 }
31 double norm(const dmatrix& m1)
32 {
33  double tmp = 0;
34  int min = m1.rowmin();
35  int max = m1.rowmax();
36  const dvector* pm1i = &m1(min);
37  for (int i = min; i <= max; ++i)
38  {
39  tmp += norm2(*pm1i);
40 
41  ++pm1i;
42  }
43  return sqrt(tmp);
44 }
50 double norm2(const dmatrix& m1)
51 {
52  double tmp = 0;
53  int min = m1.rowmin();
54  int max = m1.rowmax();
55  const dvector* pm1i = &m1(min);
56  for (int i = min; i <= max; ++i)
57  {
58  tmp += norm2(*pm1i);
59 
60  ++pm1i;
61  }
62  return tmp;
63 }
69 double sumsq(const dmatrix& m1) { return norm2(m1); }
double sumsq(const d3_array &a)
Definition: d3arr2a.cpp:181
dmatrix trans(const dmatrix &m1)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dmat2.cpp:13
Vector of double precision numbers.
Definition: dvector.h:50
double norm(const d3_array &a)
Return computed norm value of a.
Definition: d3arr2a.cpp:190
int rowmax() const
Definition: fvar.hpp:2929
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2c.cpp:11
#define min(a, b)
Definition: cbivnorm.cpp:188
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int colmin(void) const
Definition: fvar.hpp:2939
Description not yet available.
Definition: fvar.hpp:2819
double norm2(const d3_array &a)
Return sum of squared elements in a.
Definition: d3arr2a.cpp:167
#define max(a, b)
Definition: cbivnorm.cpp:189
int rowmin() const
Definition: fvar.hpp:2925
int colmax(void) const
Definition: fvar.hpp:2943