35#ifndef _BLAZE_MATH_LAPACK_GGES_H_
36#define _BLAZE_MATH_LAPACK_GGES_H_
77template<
typename MT1,
bool SO1,
typename MT2,
bool SO2
78 ,
typename VT1,
bool TF1,
typename VT2,
bool TF2 >
82template<
typename MT1,
bool SO1,
typename MT2,
bool SO2
83 ,
typename VT1,
bool TF1,
typename VT2,
bool TF2
89template<
typename MT1,
bool SO1,
typename MT2,
bool SO2,
typename MT3,
bool SO3
90 ,
typename VT1,
bool TF1,
typename VT2,
bool TF2,
typename MT4,
bool SO4 >
94template<
typename MT1,
bool SO1,
typename MT2,
bool SO2,
typename MT3,
bool SO3
95 ,
typename VT1,
bool TF1,
typename VT2,
bool TF2,
typename MT4,
bool SO4
124template<
typename MT1
157 const std::unique_ptr<BT[]> alphar(
new BT[n] );
158 const std::unique_ptr<BT[]> alphai(
new BT[n] );
159 const std::unique_ptr<BT[]> work(
new BT[
max(1,lwork)] );
160 const std::unique_ptr<blas_int_t[]> bwork(
select ?
new blas_int_t[n] :
nullptr );
162 gges(
'N',
'N', (
select ?
'S' :
'N' ),
select, n, (*A).data(), lda, (*B).data(), ldb, &sdim,
163 alphar.get(), alphai.get(), (*beta).data(),
nullptr, 1,
nullptr, 1,
164 work.get(), lwork, bwork.get(), &info );
172 for(
size_t i=0UL; i<(*A).rows(); ++i ) {
173 (*alpha)[i] = CT( alphar[i], alphai[i] );
200template<
typename MT1
221 using BT =
typename CT::value_type;
233 const std::unique_ptr<CT[]> work(
new CT[
max(1,lwork)] );
234 const std::unique_ptr<BT[]> rwork(
new BT[8*n] );
235 const std::unique_ptr<blas_int_t[]> bwork(
select ?
new blas_int_t[n] :
nullptr );
237 gges(
'N',
'N', (
select ?
'S' :
'N' ),
select, n, (*A).data(), lda, (*B).data(), ldb, &sdim,
238 (*alpha).data(), (*beta).data(),
nullptr, 1,
nullptr, 1,
239 work.get(), lwork, rwork.get(), bwork.get(), &info );
318template<
typename MT1
352 const size_t N( (*A).rows() );
358 resize( *B, N, N,
false );
359 resize( *alpha, N,
false );
360 resize( *beta, N,
false );
366 gges_backend( *A, *B, *alpha, *beta,
nullptr );
451template<
typename MT1
487 const size_t N( (*A).rows() );
493 resize( *B, N, N,
false );
494 resize( *alpha, N,
false );
495 resize( *beta, N,
false );
501 gges_backend( *A, *B, *alpha, *beta,
select );
528template<
typename MT1
541inline auto gges_backend( DenseMatrix<MT1,SO1>& A, DenseMatrix<MT2,SO2>& B,
542 DenseMatrix<MT3,SO3>& VSL, DenseVector<VT1,TF1>& alpha,
543 DenseVector<VT2,TF2>& beta, DenseMatrix<MT4,SO4>& VSR,
557 using CT = ElementType_t<VT1>;
558 using BT = ElementType_t<MT1>;
572 const std::unique_ptr<BT[]> alphar(
new BT[n] );
573 const std::unique_ptr<BT[]> alphai(
new BT[n] );
574 const std::unique_ptr<BT[]> work(
new BT[
max(1, lwork)] );
575 const std::unique_ptr<blas_int_t[]> bwork(
select ?
new blas_int_t[n] :
nullptr );
577 gges(
'V',
'V', (
select ?
'S' :
'N' ),
select, n, (*A).data(), lda, (*B).data(), ldb, &sdim,
578 alphar.get(), alphai.get(), (*beta).data(), (*VSL).data(), ldvsl, (*VSR).data(), ldvsr,
579 work.get(), lwork, bwork.get(), &info );
587 for(
size_t i=0UL; i<(*A).rows(); ++i ) {
588 (*alpha)[i] = CT( alphar[i], alphai[i] );
617template<
typename MT1
647 using BT =
typename CT::value_type;
661 const std::unique_ptr<CT[]> work(
new CT[
max(1,lwork)] );
662 const std::unique_ptr<BT[]> rwork(
new BT[8*n] );
663 const std::unique_ptr<blas_int_t[]> bwork(
select ?
new blas_int_t[n] :
nullptr );
665 gges(
'V',
'V', (
select ?
'S' :
'N' ),
select, n, (*A).data(), lda, (*B).data(), ldb, &sdim,
666 (*alpha).data(), (*beta).data(), (*VSL).data(), ldvsl, (*VSR).data(), ldvsr,
667 work.get(), lwork, rwork.get(), bwork.get(), &info );
761template<
typename MT1
812 const size_t N( (*A).rows() );
818 if( (*A).rows() != (*B).rows() || (*A).columns() != (*B).columns() ) {
822 resize( *VSL, N, N,
false );
823 resize( *alpha, N,
false );
824 resize( *beta, N,
false );
825 resize( *VSR, N, N,
false );
831 gges_backend( *A, *B, *VSL, *alpha, *beta, *VSR,
nullptr );
932template<
typename MT1
985 const size_t N( (*A).rows() );
991 resize( *B, N, N,
false );
992 resize( *VSL, N, N,
false );
993 resize( *alpha, N,
false );
994 resize( *beta, N,
false );
995 resize( *VSR, N, N,
false );
1001 gges_backend( *A, *B, *VSL, *alpha, *beta, *VSR,
select );
Constraint on the data type.
Header file for auxiliary alias declarations.
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition Aliases.h:190
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
Header file for the complex data type.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsComplex type trait.
Deactivation of problematic macros.
Constraint on the data type.
Cast operators for numeric types.
Header file for the CLAPACK gges wrapper functions.
Base class for dense matrices.
Definition DenseMatrix.h:82
Base class for N-dimensional dense vectors.
Definition DenseVector.h:77
Constraint on the data type.
Constraint on the data type.
Header file for the DenseMatrix base class.
Header file for the DenseVector base class.
#define BLAZE_CONSTRAINT_MUST_BE_BUILTIN_TYPE(T)
Constraint on the data type.
Definition Builtin.h:60
#define BLAZE_CONSTRAINT_MUST_BE_COMPLEX_TYPE(T)
Constraint on the data type.
Definition Complex.h:62
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition DMatDMatMapExpr.h:1375
decltype(auto) select(const DenseMatrix< MT1, SO > &cond, const DenseMatrix< MT2, SO > &lhs, const DenseMatrix< MT3, SO > &rhs)
Elementwise conditional selection of values from the dense matrices lhs and rhs.
Definition DMatDMatMapExpr.h:1528
void gges(char jobvsl, char jobvsr, char sort, blas_int_t(*selctg)(const float *, const float *, const float *), blas_int_t n, float *A, blas_int_t lda, float *B, blas_int_t ldb, blas_int_t *sdim, float *alphar, float *alphai, float *beta, float *VSL, blas_int_t ldvsl, float *VSR, blas_int_t ldvsr, float *work, blas_int_t lwork, blas_int_t *bwork, blas_int_t *info)
LAPACK kernel for computing the generalized Schur decomposition for a pair of non-symmetric single pr...
Definition gges.h:227
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.
Definition BLASCompatible.h:61
#define BLAZE_CONSTRAINT_MUST_BE_CONTIGUOUS_TYPE(T)
Constraint on the data type.
Definition Contiguous.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition Computation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ADAPTOR_TYPE(T)
Constraint on the data type.
Definition Adaptor.h:81
#define BLAZE_CONSTRAINT_MUST_HAVE_MUTABLE_DATA_ACCESS(T)
Constraint on the data type.
Definition MutableDataAccess.h:61
int32_t blas_int_t
Signed integer type used in the BLAS/LAPACK wrapper functions.
Definition Types.h:64
#define BLAZE_THROW_LAPACK_ERROR(MESSAGE)
Macro for the emission of an exception on detection of a LAPACK error.
Definition Exception.h:146
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition Matrix.h:1108
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition Matrix.h:1383
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition Assert.h:101
To numeric_cast(From from)
Checked conversion of values of numeric type.
Definition NumericCast.h:275
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:138
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition Exception.h:235
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:175
Header file for the exception macros of the math module.
Header file for the equal shim.
Header file for the generic max algorithm.