TheBoussinesqModel
3.2.1
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Macros
Pages
doublevector_utilities.c
Go to the documentation of this file.
1
32
#include "
turtle.h
"
33
#include "
t_datamanipulation.h
"
34
#include "
t_utilities.h
"
35
#include "
linear_span.h
"
36
37
#include "
doublevector_utilities.h
"
38
39
#define MAX_REITERATON 1
40
41
#define DELTA_MIN epsilon
42
43
int
linear_comb_doublevector
(
DOUBLEVECTOR
*result,
DOUBLEVECTOR
*a,
DOUBLEVECTOR
*b,
double
ca,
double
cb) {
57
long
i;
58
59
if
((result->
nh
!=a->
nh
) || (result->
nh
!=b->
nh
) || (b->
nh
!=a->
nh
) ) {
60
printf(
"Error: in linear_comb vectors result and a and b do not have the same number of elements!! /n"
);
61
return
-1;
62
}
63
64
for
(i=a->
nl
;i<=a->nh;i++){
65
result->element[i]=ca*a->element[i]+cb*b->element[i];
66
67
}
68
69
return
0;
70
71
}
72
73
74
75
76
double
max_doublevector
(
DOUBLEVECTOR
*v) {
84
long
j;
85
double
MK=fabs(v->element[v->
nl
]);
86
87
for
(j=v->
nl
+1;j<=v->nh;j++){
88
MK=fmax(MK,fabs(v->element[j]));
89
}
90
91
return
MK;
92
}
93
94
double
min_doublevector
(
DOUBLEVECTOR
*v) {
102
long
j;
103
char
*function_name=
"min_doublevector"
;
104
double
MK=fabs(v->element[v->
nl
]);
105
for
(j=v->
nl
;j<=v->nh;j++) {
106
if
(v->element[j]<0.0) {
107
printf(
"Warning in function %s, the at %ld position is %le (negative) \n"
,function_name,j,v->element[j]);
108
}
109
}
110
111
for
(j=v->
nl
+1;j<=v->nh;j++){
112
MK=fmin(MK,fabs(v->element[j]));
113
}
114
115
return
MK;
116
}
117
118
119
120
MATH2
doublevector_utilities.c
Generated on Wed Jun 5 2013 10:08:45 for TheBoussinesqModel by
1.8.4