FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
min_max_value_dense_mkl.cpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6// includes, FEAT
8#include <kernel/lafem/arch/min_max_value_dense.hpp>
9
10FEAT_DISABLE_WARNINGS
11#include <mkl.h>
12FEAT_RESTORE_WARNINGS
13
14namespace FEAT::LAFEM::Arch
15{
16 float MinMaxValueDense::exec_mkl_impl(const float * const x, const Index size, const bool min_, const bool abs_)
17 {
18 // MKL only supports absolute min/max
19 if(!abs_)
20 return MinMaxValueDense::exec_generic_impl(x, size, min_, abs_);
21
22 CBLAS_INDEX idx = (min_ ?
23 cblas_isamin(static_cast<MKL_INT>(size), x, 1) :
24 cblas_isamax(static_cast<MKL_INT>(size), x, 1));
25
26 return Math::abs(x[idx]);
27 }
28
29 double MinMaxValueDense::exec_mkl_impl(const double * const x, const Index size, const bool min_, const bool abs_)
30 {
31 // MKL only supports absolute min/max
32 if(!abs_)
33 return MinMaxValueDense::exec_generic_impl(x, size, min_, abs_);
34
35 CBLAS_INDEX idx = (min_ ?
36 cblas_idamin(static_cast<MKL_INT>(size), x, 1) :
37 cblas_idamax(static_cast<MKL_INT>(size), x, 1));
38
39 return Math::abs(x[idx]);
40 }
41} // namespace FEAT::LAFEM::Arch
FEAT Kernel base header.
T_ abs(T_ x)
Returns the absolute value.
Definition: math.hpp:275
std::uint64_t Index
Index data type.