Skip to content
Snippets Groups Projects
Unverified Commit cb204e02 authored by Tobias Leibner's avatar Tobias Leibner Committed by GitHub
Browse files

Merge pull request #86 from dune-community/tmp_branch

[lapacke] add dorgqr, zungqr
parents 8109446d 0c8a3c24
No related branches found
No related tags found
No related merge requests found
......@@ -198,6 +198,26 @@ int dorgqr(int matrix_layout, int m, int n, int k, double* a, int lda, const dou
}
int dorgqr_work(int matrix_layout, int m, int n, int k, double* a, int lda, const double* tau, double* work, int lwork)
{
#if HAVE_MKL || HAVE_LAPACKE
return LAPACKE_dorgqr_work(matrix_layout, m, n, k, a, lda, tau, work, lwork);
#else
DUNE_UNUSED_PARAMETER(matrix_layout);
DUNE_UNUSED_PARAMETER(m);
DUNE_UNUSED_PARAMETER(n);
DUNE_UNUSED_PARAMETER(k);
DUNE_UNUSED_PARAMETER(a);
DUNE_UNUSED_PARAMETER(lda);
DUNE_UNUSED_PARAMETER(tau);
DUNE_UNUSED_PARAMETER(work);
DUNE_UNUSED_PARAMETER(lwork);
DUNE_THROW(Exceptions::dependency_missing, "You are missing lapacke or the intel mkl, check available() first!");
return 1;
#endif
}
int dormqr(int matrix_layout,
char side,
char trans,
......@@ -348,6 +368,24 @@ int zgeqp3(int matrix_layout, int m, int n, std::complex<double>* a, int lda, in
}
int zungqr(int matrix_layout, int m, int n, int k, std::complex<double>* a, int lda, const std::complex<double>* tau)
{
#if HAVE_MKL || HAVE_LAPACKE
return LAPACKE_zungqr(matrix_layout, m, n, k, a, lda, tau);
#else
DUNE_UNUSED_PARAMETER(matrix_layout);
DUNE_UNUSED_PARAMETER(m);
DUNE_UNUSED_PARAMETER(n);
DUNE_UNUSED_PARAMETER(k);
DUNE_UNUSED_PARAMETER(a);
DUNE_UNUSED_PARAMETER(lda);
DUNE_UNUSED_PARAMETER(tau);
DUNE_THROW(Exceptions::dependency_missing, "You are missing lapacke or the intel mkl, check available() first!");
return 1;
#endif
}
int zunmqr(int matrix_layout,
char side,
char trans,
......
......@@ -90,12 +90,19 @@ int dgeqp3(int matrix_layout, int m, int n, double* a, int lda, int* jpvt, doubl
*/
int dgeqp3_work(int matrix_layout, int m, int n, double* a, int lda, int* jpvt, double* tau, double* work, int lwork);
/**
* \brief Wrapper around LAPACKE_dorgqr
* \sa LAPACKE_dorqqr
* \sa LAPACKE_dorgqr
*/
int dorgqr(int matrix_layout, int m, int n, int k, double* a, int lda, const double* tau);
/**
* \brief Wrapper around LAPACKE_dorgqr_work
* \sa LAPACKE_dorgqr_work
*/
int dorgqr_work(int matrix_layout, int m, int n, int k, double* a, int lda, const double* tau, double* work, int lwork);
/**
* \brief Wrapper around LAPACKE_dormqr
......@@ -184,6 +191,13 @@ int zunmqr(int matrix_layout,
int ldc);
/**
* \brief Wrapper around LAPACKE_zungqr
* \sa LAPACKE_zungqr
*/
int zungqr(int matrix_layout, int m, int n, int k, std::complex<double>* a, int lda, const std::complex<double>* tau);
} // namespace Lapacke
namespace Blas {
......
......@@ -275,6 +275,19 @@ constexpr size_t factorial(size_t n)
return n > 0 ? n * factorial(n - 1) : 1;
}
//! calculates complex conjugate like std::conj, but returns T instead of complex<T>
template <class T>
std::enable_if_t<std::is_arithmetic<T>::value, T> conj(T val)
{
return val;
}
template <class T>
std::complex<T> conj(std::complex<T> val)
{
return std::conj(val);
}
//! calculates binomial coefficient for arbitrary n
inline double binomial_coefficient(const double n, const size_t k)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment