Skip to content
GitLab
Explore
Sign in
Hide whitespace changes
Inline
Side-by-side
Some changes are not shown.
For a faster browsing experience, only
3 of 183+
files are shown. Download one of the files below to see all changes.
external/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_
MKL
.h
→
external/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_
BLAS
.h
View file @
a394b22a
...
...
@@ -25,13 +25,13 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
********************************************************************************
* Content : Eigen bindings to
Intel(R) MKL
* Content : Eigen bindings to
BLAS F77
* Selfadjoint matrix-vector product functionality based on ?SYMV/HEMV.
********************************************************************************
*/
#ifndef EIGEN_SELFADJOINT_MATRIX_VECTOR_
MKL
_H
#define EIGEN_SELFADJOINT_MATRIX_VECTOR_
MKL
_H
#ifndef EIGEN_SELFADJOINT_MATRIX_VECTOR_
BLAS
_H
#define EIGEN_SELFADJOINT_MATRIX_VECTOR_
BLAS
_H
namespace
Eigen
{
...
...
@@ -47,31 +47,31 @@ template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool Conju
struct
selfadjoint_matrix_vector_product_symv
:
selfadjoint_matrix_vector_product
<
Scalar
,
Index
,
StorageOrder
,
UpLo
,
ConjugateLhs
,
ConjugateRhs
,
BuiltIn
>
{};
#define EIGEN_
MKL
_SYMV_SPECIALIZE(Scalar) \
#define EIGEN_
BLAS
_SYMV_SPECIALIZE(Scalar) \
template<typename Index, int StorageOrder, int UpLo, bool ConjugateLhs, bool ConjugateRhs> \
struct selfadjoint_matrix_vector_product<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs,Specialized> { \
static void run( \
Index size, const Scalar* lhs, Index lhsStride, \
const Scalar* _rhs,
Index rhsIncr,
Scalar* res, Scalar alpha) { \
const Scalar* _rhs, Scalar* res, Scalar alpha) { \
enum {\
IsColMajor = StorageOrder==ColMajor \
}; \
if (IsColMajor == ConjugateLhs) {\
selfadjoint_matrix_vector_product<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs,BuiltIn>::run( \
size, lhs, lhsStride, _rhs,
rhsIncr,
res, alpha); \
size, lhs, lhsStride, _rhs, res, alpha); \
} else {\
selfadjoint_matrix_vector_product_symv<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs>::run( \
size, lhs, lhsStride, _rhs,
rhsIncr,
res, alpha); \
size, lhs, lhsStride, _rhs, res, alpha); \
}\
} \
}; \
EIGEN_
MKL
_SYMV_SPECIALIZE
(
double
)
EIGEN_
MKL
_SYMV_SPECIALIZE
(
float
)
EIGEN_
MKL
_SYMV_SPECIALIZE
(
dcomplex
)
EIGEN_
MKL
_SYMV_SPECIALIZE
(
scomplex
)
EIGEN_
BLAS
_SYMV_SPECIALIZE
(
double
)
EIGEN_
BLAS
_SYMV_SPECIALIZE
(
float
)
EIGEN_
BLAS
_SYMV_SPECIALIZE
(
dcomplex
)
EIGEN_
BLAS
_SYMV_SPECIALIZE
(
scomplex
)
#define EIGEN_
MKL
_SYMV_SPECIALIZATION(EIGTYPE,
MKL
TYPE,
MKL
FUNC) \
#define EIGEN_
BLAS
_SYMV_SPECIALIZATION(EIGTYPE,
BLAS
TYPE,
BLAS
FUNC) \
template<typename Index, int StorageOrder, int UpLo, bool ConjugateLhs, bool ConjugateRhs> \
struct selfadjoint_matrix_vector_product_symv<EIGTYPE,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs> \
{ \
...
...
@@ -79,36 +79,33 @@ typedef Matrix<EIGTYPE,Dynamic,1,ColMajor> SYMVVector;\
\
static void run( \
Index size, const EIGTYPE* lhs, Index lhsStride, \
const EIGTYPE* _rhs,
Index rhsIncr,
EIGTYPE* res, EIGTYPE alpha) \
const EIGTYPE* _rhs, EIGTYPE* res, EIGTYPE alpha) \
{ \
enum {\
IsRowMajor = StorageOrder==RowMajor ? 1 : 0, \
IsLower = UpLo == Lower ? 1 : 0 \
}; \
MKL_INT n=
size, lda=lhsStride, incx=
rhsIncr
, incy=1; \
MKL
TYPE
alpha_,
beta
_
; \
const EIGTYPE *x_ptr
, myone(1)
; \
BlasIndex n=convert_index<BlasIndex>(
size
)
, lda=
convert_index<BlasIndex>(
lhsStride
)
, incx=
1
, incy=1; \
EIG
TYPE beta
(1)
; \
const EIGTYPE *x_ptr; \
char uplo=(IsRowMajor) ? (IsLower ? 'U' : 'L') : (IsLower ? 'L' : 'U'); \
assign_scalar_eig2mkl(alpha_, alpha); \
assign_scalar_eig2mkl(beta_, myone); \
SYMVVector x_tmp; \
if (ConjugateRhs) { \
Map<const SYMVVector, 0
, InnerStride<>
> map_x(_rhs,size,1
,InnerStride<>(incx)
); \
Map<const SYMVVector, 0 > map_x(_rhs,size,1); \
x_tmp=map_x.conjugate(); \
x_ptr=x_tmp.data(); \
incx=1; \
} else x_ptr=_rhs; \
MKL
FUNC(&uplo, &n, &alpha
_
, (const
MKL
TYPE*)lhs, &lda, (const
MKL
TYPE*)x_ptr, &incx, &beta
_
, (
MKL
TYPE*)res, &incy); \
BLAS
FUNC(&uplo, &n, &
numext::real_ref(
alpha
)
, (const
BLAS
TYPE*)lhs, &lda, (const
BLAS
TYPE*)x_ptr, &incx, &
numext::real_ref(
beta
)
, (
BLAS
TYPE*)res, &incy); \
}\
};
EIGEN_
MKL
_SYMV_SPECIALIZATION
(
double
,
double
,
dsymv
)
EIGEN_
MKL
_SYMV_SPECIALIZATION
(
float
,
float
,
ssymv
)
EIGEN_
MKL
_SYMV_SPECIALIZATION
(
dcomplex
,
MKL_Complex16
,
zhemv
)
EIGEN_
MKL
_SYMV_SPECIALIZATION
(
scomplex
,
MKL_Complex8
,
chemv
)
EIGEN_
BLAS
_SYMV_SPECIALIZATION
(
double
,
double
,
dsymv
_
)
EIGEN_
BLAS
_SYMV_SPECIALIZATION
(
float
,
float
,
ssymv
_
)
EIGEN_
BLAS
_SYMV_SPECIALIZATION
(
dcomplex
,
double
,
zhemv
_
)
EIGEN_
BLAS
_SYMV_SPECIALIZATION
(
scomplex
,
float
,
chemv
_
)
}
// end namespace internal
}
// end namespace Eigen
#endif // EIGEN_SELFADJOINT_MATRIX_VECTOR_
MKL
_H
#endif // EIGEN_SELFADJOINT_MATRIX_VECTOR_
BLAS
_H
external/eigen3/Eigen/src/Core/products/SelfadjointProduct.h
View file @
a394b22a
...
...
@@ -53,7 +53,6 @@ struct selfadjoint_product_selector<MatrixType,OtherType,UpLo,true>
static
void
run
(
MatrixType
&
mat
,
const
OtherType
&
other
,
const
typename
MatrixType
::
Scalar
&
alpha
)
{
typedef
typename
MatrixType
::
Scalar
Scalar
;
typedef
typename
MatrixType
::
Index
Index
;
typedef
internal
::
blas_traits
<
OtherType
>
OtherBlasTraits
;
typedef
typename
OtherBlasTraits
::
DirectLinearAccessType
ActualOtherType
;
typedef
typename
internal
::
remove_all
<
ActualOtherType
>::
type
_ActualOtherType
;
...
...
@@ -86,7 +85,6 @@ struct selfadjoint_product_selector<MatrixType,OtherType,UpLo,false>
static
void
run
(
MatrixType
&
mat
,
const
OtherType
&
other
,
const
typename
MatrixType
::
Scalar
&
alpha
)
{
typedef
typename
MatrixType
::
Scalar
Scalar
;
typedef
typename
MatrixType
::
Index
Index
;
typedef
internal
::
blas_traits
<
OtherType
>
OtherBlasTraits
;
typedef
typename
OtherBlasTraits
::
DirectLinearAccessType
ActualOtherType
;
typedef
typename
internal
::
remove_all
<
ActualOtherType
>::
type
_ActualOtherType
;
...
...
@@ -94,15 +92,27 @@ struct selfadjoint_product_selector<MatrixType,OtherType,UpLo,false>
Scalar
actualAlpha
=
alpha
*
OtherBlasTraits
::
extractScalarFactor
(
other
.
derived
());
enum
{
IsRowMajor
=
(
internal
::
traits
<
MatrixType
>::
Flags
&
RowMajorBit
)
?
1
:
0
};
enum
{
IsRowMajor
=
(
internal
::
traits
<
MatrixType
>::
Flags
&
RowMajorBit
)
?
1
:
0
,
OtherIsRowMajor
=
_ActualOtherType
::
Flags
&
RowMajorBit
?
1
:
0
};
Index
size
=
mat
.
cols
();
Index
depth
=
actualOther
.
cols
();
typedef
internal
::
gemm_blocking_space
<
IsRowMajor
?
RowMajor
:
ColMajor
,
Scalar
,
Scalar
,
MatrixType
::
MaxColsAtCompileTime
,
MatrixType
::
MaxColsAtCompileTime
,
_ActualOtherType
::
MaxColsAtCompileTime
>
BlockingType
;
BlockingType
blocking
(
size
,
size
,
depth
,
1
,
false
);
internal
::
general_matrix_matrix_triangular_product
<
Index
,
Scalar
,
_ActualOtherType
::
Flags
&
RowMajor
Bit
?
RowMajor
:
ColMajor
,
OtherBlasTraits
::
NeedToConjugate
&&
NumTraits
<
Scalar
>::
IsComplex
,
Scalar
,
_ActualOtherType
::
Flags
&
RowMajor
Bit
?
ColMajor
:
RowMajor
,
(
!
OtherBlasTraits
::
NeedToConjugate
)
&&
NumTraits
<
Scalar
>::
IsComplex
,
MatrixType
::
Flags
&
RowMajor
Bit
?
RowMajor
:
ColMajor
,
UpLo
>
::
run
(
mat
.
cols
(),
actualOther
.
cols
()
,
Scalar
,
OtherIs
RowMajor
?
RowMajor
:
ColMajor
,
OtherBlasTraits
::
NeedToConjugate
&&
NumTraits
<
Scalar
>::
IsComplex
,
Scalar
,
OtherIs
RowMajor
?
ColMajor
:
RowMajor
,
(
!
OtherBlasTraits
::
NeedToConjugate
)
&&
NumTraits
<
Scalar
>::
IsComplex
,
Is
RowMajor
?
RowMajor
:
ColMajor
,
UpLo
>
::
run
(
size
,
depth
,
&
actualOther
.
coeffRef
(
0
,
0
),
actualOther
.
outerStride
(),
&
actualOther
.
coeffRef
(
0
,
0
),
actualOther
.
outerStride
(),
mat
.
data
(),
mat
.
outerStride
(),
actualAlpha
);
mat
.
data
(),
mat
.
outerStride
(),
actualAlpha
,
blocking
);
}
};
...
...
external/eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h
View file @
a394b22a
...
...
@@ -79,11 +79,11 @@ SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
if
(
IsRowMajor
)
actualAlpha
=
numext
::
conj
(
actualAlpha
);
internal
::
selfadjoint_rank2_update_selector
<
Scalar
,
Index
,
typename
internal
::
remove_all
<
typename
internal
::
conj_expr_if
<
IsRowMajor
^
U
BlasTraits
::
NeedToConjugate
,
_Actual
U
Type
>::
type
>::
type
,
typename
internal
::
remove_all
<
typename
internal
::
conj_expr_if
<
IsRowMajor
^
VBlasTraits
::
NeedToConjugate
,
_ActualVType
>::
type
>::
t
ype
,
typedef
typename
internal
::
remove_all
<
typename
internal
::
conj_expr_if
<
IsRowMajor
^
UBlasTraits
::
NeedToConjugate
,
_ActualUType
>::
type
>::
type
UType
;
typedef
typename
internal
::
remove_all
<
typename
internal
::
conj_expr_if
<
IsRowMajor
^
V
BlasTraits
::
NeedToConjugate
,
_Actual
V
Type
>::
type
>::
type
VType
;
internal
::
selfadjoint_rank2_update_selector
<
Scalar
,
Index
,
UType
,
VT
ype
,
(
IsRowMajor
?
int
(
UpLo
==
Upper
?
Lower
:
Upper
)
:
UpLo
)
>
::
run
(
_expression
().
const_cast_derived
().
data
(),
_expression
().
outerStride
(),
actualU
,
actualV
,
actualAlpha
);
::
run
(
_expression
().
const_cast_derived
().
data
(),
_expression
().
outerStride
(),
UType
(
actualU
),
VType
(
actualV
)
,
actualAlpha
);
return
*
this
;
}
...
...
Prev
1
…
6
7
8
9
10
Next