COPASI API  4.16.103
Functions
dfnorm.cpp File Reference
#include <cmath>
#include <algorithm>
#include "copasi.h"
#include "dfnorm.h"
Include dependency graph for dfnorm.cpp:

Go to the source code of this file.

Functions

double dfnorm_ (C_INT *n, double *a, double *w)
 

Function Documentation

double dfnorm_ ( C_INT n,
double *  a,
double *  w 
)

Definition at line 31 of file dfnorm.cpp.

References C_INT, and max.

Referenced by CInternalSolver::dprja_().

32 {
33  /* System generated locals */
34  C_INT a_dim1, a_offset, i__1, i__2;
35  double ret_val, d__1, d__2;
36 
37  /* Local variables */
38  C_INT i__, j;
39  double an, sum;
40 
41  /* ----------------------------------------------------------------------- */
42  /* This function computes the norm of a full N by N matrix, */
43  /* stored in the array A, that is consistent with the weighted max-norm */
44  /* on vectors, with weights stored in the array W: */
45  /* DFNORM = MAX(i=1,...,N) (W(i) * Sum(j=1,...,N) ABS(a(i,j))/W(j)) */
46  /* ----------------------------------------------------------------------- */
47  /* Parameter adjustments */
48  --w;
49  a_dim1 = *n;
50  a_offset = 1 + a_dim1;
51  a -= a_offset;
52 
53  /* Function Body */
54  an = 0.;
55  i__1 = *n;
56 
57  for (i__ = 1; i__ <= i__1; ++i__)
58  {
59  sum = 0.;
60  i__2 = *n;
61 
62  for (j = 1; j <= i__2; ++j)
63  {
64  /* L10: */
65  sum += (d__1 = a[i__ + j * a_dim1], fabs(d__1)) / w[j];
66  }
67 
68  /* Computing MAX */
69  d__1 = an, d__2 = sum * w[i__];
70  an = std::max(d__1, d__2);
71  /* L20: */
72  }
73 
74  ret_val = an;
75  return ret_val;
76  /* ----------------------- End of Function DFNORM ------------------------ */
77 } /* dfnorm_ */
#define C_INT
Definition: copasi.h:115
#define max(a, b)
Definition: f2c.h:176