Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
4894c068
Commit
4894c068
authored
Apr 14, 2017
by
Uwe Schulzweida
Browse files
removed fpe handling (speedup of 50% for ensmean ...).
parent
4bc54ea7
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
4894c068
2017-04-14 Uwe Schulzweida
* removed fpe handling (speedup of 50% for ensmean ...)
2017-04-13 Uwe Schulzweida
* Using CDI library version 1.8.1
...
...
src/array.c
View file @
4894c068
...
...
@@ -45,8 +45,8 @@ int array_minmaxsum_val(size_t len, const double *array, double *rmin, double *r
int
array_minmaxmean_val
(
size_t
len
,
const
double
*
array
,
double
*
rmin
,
double
*
rmax
,
double
*
rmean
)
{
int
excepts
=
FE_INVALID
|
FE_DIVBYZERO
|
FE_OVERFLOW
|
FE_UNDERFLOW
;
feclearexcept
(
FE_ALL_EXCEPT
);
//
int excepts = FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW;
//
feclearexcept(FE_ALL_EXCEPT);
// expensive !!!!
double
min
=
DBL_MAX
;
double
max
=
-
DBL_MAX
;
...
...
@@ -67,14 +67,15 @@ int array_minmaxmean_val(size_t len, const double *array, double *rmin, double *
if
(
rmax
)
*
rmax
=
max
;
if
(
rmean
)
*
rmean
=
mean
;
return
fetestexcept
(
excepts
);
// return fetestexcept(excepts);
return
0
;
}
int
array_mean_val_weighted
(
size_t
len
,
const
double
*
restrict
array
,
const
double
*
restrict
w
,
double
missval
,
double
*
rmean
)
{
int
excepts
=
FE_INVALID
|
FE_DIVBYZERO
|
FE_OVERFLOW
|
FE_UNDERFLOW
;
feclearexcept
(
FE_ALL_EXCEPT
);
//
int excepts = FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW;
//
feclearexcept(FE_ALL_EXCEPT);
// expensive !!!!
double
rsum
=
0
,
rsumw
=
0
;
...
...
@@ -86,19 +87,21 @@ int array_mean_val_weighted(size_t len, const double *restrict array, const doub
*
rmean
=
DBL_IS_EQUAL
(
rsumw
,
0
.)
?
missval
:
rsum
/
rsumw
;
return
fetestexcept
(
excepts
);
// return fetestexcept(excepts);
return
0
;
}
int
array_add_array
(
size_t
len
,
double
*
restrict
array1
,
const
double
*
restrict
array2
)
{
int
excepts
=
FE_INVALID
|
FE_DIVBYZERO
|
FE_OVERFLOW
|
FE_UNDERFLOW
;
feclearexcept
(
FE_ALL_EXCEPT
);
//
int excepts = FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW;
//
feclearexcept(FE_ALL_EXCEPT);
// expensive !!!!
//#if defined(_OPENMP)
//#pragma omp parallel for default(none) shared(array1,array2)
//#endif
for
(
size_t
i
=
0
;
i
<
len
;
i
++
)
array1
[
i
]
+=
array2
[
i
];
return
fetestexcept
(
excepts
);
// return fetestexcept(excepts);
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment