Commit e2f491c3 authored by Andreas Marek's avatar Andreas Marek

Add skew routines

parent 82d83209
......@@ -60,6 +60,25 @@
elpa_eigenvectors_fc \
)(handle, a, ev, q, error)
/*! \brief generic C method for elpa_skew_eigenvectors
*
* \details
* \param handle handle of the ELPA object, which defines the problem
* \param a float/double float complex/double complex pointer to matrix a
* \param ev on return: float/double pointer to eigenvalues
* \param q on return: float/double float complex/double complex pointer to eigenvectors
* \param error on return the error code, which can be queried with elpa_strerr()
* \result void
*/
#define elpa_skew_eigenvectors(handle, a, ev, q, error) _Generic((a), \
double*: \
elpa_eigenvectors_d, \
\
float*: \
elpa_eigenvectors_f, \
)(handle, a, ev, q, error)
/*! \brief generic C method for elpa_generalized_eigenvectors
*
......@@ -111,6 +130,24 @@
elpa_eigenvalues_fc \
)(handle, a, ev, error)
/*! \brief generic C method for elpa_skew_eigenvalues
*
* \details
* \param handle handle of the ELPA object, which defines the problem
* \param a float/double float complex/double complex pointer to matrix a
* \param ev on return: float/double pointer to eigenvalues
* \param error on return the error code, which can be queried with elpa_strerr()
* \result void
*/
#define elpa_skew_eigenvalues(handle, a, ev, error) _Generic((a), \
double*: \
elpa_eigenvalues_d, \
\
float*: \
elpa_eigenvalues_f, \
)(handle, a, ev, error)
/* \brief generic C method for elpa_cholesky
*
* \details
......
......@@ -24,7 +24,7 @@ class(elpa_t), pointer :: elpa
.br
.TP
.RI "datatype :: \fBa\fP"
The matrix a for which the eigenvalues should be computed. The dimensions of matrix a must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The datatype of the matrix can be one of "real(kind=c_double)", "real(kind=c_float)", "complex(kind=c_double)", or "complex(kind=c_float)"
The matrix a for which the eigenvalues should be computed. The dimensions of matrix a must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The datatype of the matrix can be one of "real(kind=c_double)", "real(kind=c_float)", "complex(kind=c_double)", or "complex(kind=c_float)". The matrix has to be symmetric or hermitian, this is not checked by the routine.
.TP
.RI "datatype :: \fBev\fP"
The vector ev where the eigenvalues will be stored in \fIascending\fP order. The datatype of the vector ev can be either "real(kind=c_double)", or "real(kind=c_float)", depending of the datatype of the matrix. Note that complex hermitian matrices also have real valued eigenvalues.
......@@ -51,7 +51,7 @@ elpa_t handle;
The handle to the ELPA object
.TP
.RI "datatype *\fBa\fP;"
The matrix a for which the eigenvalues should be computed. The dimensions of the matrix must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The \fBdatatype\fP can be one of "double", "float", "double complex", or "float complex".
The matrix a for which the eigenvalues should be computed. The dimensions of the matrix must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The \fBdatatype\fP can be one of "double", "float", "double complex", or "float complex". The matrix has to be symmetric or hermitian, this is not checked by the routine.
.TP
.RI "datatype *\fBev\fP;"
The storage for the computed eigenvalues. Eigenvalues will be stored in \fIascendig\fP order. The \fBdatatype\fP can be either "double" or "float". Note that the eigenvalues of complex hermitian matrices are also real.
......@@ -60,8 +60,8 @@ The storage for the computed eigenvalues. Eigenvalues will be stored in \fIascen
The error code of the function. Should be "ELPA_OK". The error codes can be querried with \fBelpa_strerr\fP(3)
.SH DESCRIPTION
Compute the eigenvalues of a real symmtric or complex hermitian matrix.The functions \fBelpa_init\fP(3), \fBelpa_allocate\fP(3), \fBelpa_set\fP(3), and \fBelpa_setup\fP(3) must be called \fIBEFORE\fP \fBelpa_eigenvalues\fP can be called.
Compute the eigenvalues of a real symmetric or complex hermitian matrix.The functions \fBelpa_init\fP(3), \fBelpa_allocate\fP(3), \fBelpa_set\fP(3), and \fBelpa_setup\fP(3) must be called \fIBEFORE\fP \fBelpa_eigenvalues\fP can be called.
.br
.SH "SEE ALSO"
.br
\fBelpa2_print_kernels\fP(1) \fBelpa_init\fP(3) \fBelpa_allocate\fP(3) \fBelpa_set\fP(3) \fBelpa_setup\fP(3) \fBelpa_strerr\fP(3) \fBelpa_eigenvectors\fP(3) \fBelpa_cholesky\fP(3) \fBelpa_invert_triangular\fP(3) \fBelpa_solve_tridiagonal\fP(3) \fBelpa_eigenvalues\fP(3) \fBelpa_uninit\fP(3) \fBelpa_deallocate\fP(3)
\fBelpa2_print_kernels\fP(1) \fBelpa_init\fP(3) \fBelpa_allocate\fP(3) \fBelpa_set\fP(3) \fBelpa_setup\fP(3) \fBelpa_strerr\fP(3) \fBelpa_skew_eigenvalues\fP(3) \fBelpa_eigenvectors\fP(3) \fBelpa_skew_eigenvectors\fP(3) \fBelpa_cholesky\fP(3) \fBelpa_invert_triangular\fP(3) \fBelpa_solve_tridiagonal\fP(3) \fBelpa_eigenvalues\fP(3) \fBelpa_uninit\fP(3) \fBelpa_deallocate\fP(3)
......@@ -24,7 +24,7 @@ class(elpa_t), pointer :: elpa
.br
.TP
.RI "datatype :: \fBa\fP"
The matrix a for which the eigenvalues should be computed. The dimensions of matrix a must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The datatype of the matrix can be one of "real(kind=c_double)", "real(kind=c_float)", "complex(kind=c_double)", or "complex(kind=c_float)"
The matrix a for which the eigenvalues should be computed. The dimensions of matrix a must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The datatype of the matrix can be one of "real(kind=c_double)", "real(kind=c_float)", "complex(kind=c_double)", or "complex(kind=c_float)". The matrix has to be symmetric or hermitian, this is not checked by the routine.
.TP
.RI "datatype :: \fBev\fP"
The vector ev where the eigenvalues will be stored in \fIascending\fP order. The datatype of the vector ev can be either "real(kind=c_double)", or "real(kind=c_float)", depending of the datatype of the matrix. Note that complex hermitian matrices also have real valued eigenvalues.
......@@ -53,7 +53,7 @@ elpa_t handle;
The handle to the ELPA object
.TP
.RI "datatype *\fBa\fP;"
The matrix a for which the eigenvalues should be computed. The dimensions of the matrix must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The \fBdatatype\fP can be one of "double", "float", "double complex", or "float complex".
The matrix a for which the eigenvalues should be computed. The dimensions of the matrix must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The \fBdatatype\fP can be one of "double", "float", "double complex", or "float complex". The matrix has to be symmetric or hermitian, this is not checked by the routine.
.TP
.RI "datatype *\fBev\fP;"
The storage for the computed eigenvalues. Eigenvalues will be stored in \fIascendig\fP order. The \fBdatatype\fP can be either "double" or "float". Note that the eigenvalues of complex hermitian matrices are also real.
......@@ -65,8 +65,8 @@ The storage space for the computed eigenvectors. The dimensions of the matrix mu
The error code of the function. Should be "ELPA_OK". The error codes can be querried with \fBelpa_strerr\fP(3)
.SH DESCRIPTION
Compute the eigenvalues and (parts of) the eigenvector spectrum of a real symmtric or complex hermitian matrix.The functions \fBelpa_init\fP(3), \fBelpa_allocate\fP(3), \fBelpa_set\fP(3), and \fBelpa_setup\fP(3) must be called \fIBEFORE\fP \fBelpa_eigenvalues\fP can be called. Especially the number of eigenvectors to be computed can be set with \fPelpa_set\fB(3)
Compute the eigenvalues and (parts of) the eigenvector spectrum of a real symmetric or complex hermitian matrix.The functions \fBelpa_init\fP(3), \fBelpa_allocate\fP(3), \fBelpa_set\fP(3), and \fBelpa_setup\fP(3) must be called \fIBEFORE\fP \fBelpa_eigenvalues\fP can be called. Especially the number of eigenvectors to be computed can be set with \fPelpa_set\fB(3)
.br
.SH "SEE ALSO"
.br
\fBelpa2_print_kernels\fP(1) \fBelpa_init\fP(3) \fBelpa_allocate\fP(3) \fBelpa_set\fP(3) \fBelpa_setup\fP(3) \fBelpa_strerr\fP(3) \fBelpa_eigenvalues\fP(3) \fBelpa_cholesky\fP(3) \fBelpa_invert_triangular\fP(3) \fBelpa_solve_tridiagonal\fP(3) \fBelpa_hermitian_multiply\fP(3) \fBelpa_uninit\fP(3) \fBelpa_deallocate\fP(3)
\fBelpa2_print_kernels\fP(1) \fBelpa_init\fP(3) \fBelpa_allocate\fP(3) \fBelpa_set\fP(3) \fBelpa_setup\fP(3) \fBelpa_strerr\fP(3) \fBelpa_eigenvalues\fP(3) \fBelpa_skew_eigenvalues\fP(3) \fBelpa_skew_eigenvectors\fP(3) \fBelpa_cholesky\fP(3) \fBelpa_invert_triangular\fP(3) \fBelpa_solve_tridiagonal\fP(3) \fBelpa_hermitian_multiply\fP(3) \fBelpa_uninit\fP(3) \fBelpa_deallocate\fP(3)
.TH "elpa_skew_eigenvalues" 3 "Thur Nov 7 2019" "ELPA" \" -*- nroff -*-
.ad l
.nh
.SH NAME
elpa_skew_eigenvalues \- computes the eigenvalues of a real skew-symmetric matrix
.br
.SH SYNOPSIS
.br
.SS FORTRAN INTERFACE
use elpa
.br
class(elpa_t), pointer :: elpa
.br
.RI "call elpa%\fBskew_eigenvalues\fP (a, ev, error)"
.br
.RI " "
.br
.RI "With the definitions of the input and output variables:"
.br
.RI "class(elpa_t) :: \fBelpa\fP ! returns an instance of the ELPA object"
.br
.TP
.RI "datatype :: \fBa\fP"
The matrix a for which the eigenvalues should be computed. The dimensions of matrix a must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The datatype of the matrix can be one of "real(kind=c_double)" or "real(kind=c_float)". The matrix has to be skew-symmetric, this is not checked by the routine.
.TP
.RI "datatype :: \fBev\fP"
The vector ev where the eigenvalues will be stored in \fIascending\fP order. The datatype of the vector ev can be either "real(kind=c_double)", or "real(kind=c_float)", depending of the datatype of the matrix.
.TP
.RI "integer, optional :: \fBerror\fP"
The return error code of the function. Should be "ELPA_OK". The error code can be querried with the function \fBelpa_strerr\fP(3)
.br
.SS C INTERFACE
#include <elpa/elpa.h>
.br
elpa_t handle;
.br
.RI "void \fBelpa_skew_eigenvalues\fP(\fBelpa_t\fP handle, \fBdatatype\fP *a, \fBdatatype\fP *ev, \fBint\fP *error);"
.br
.RI " "
.br
.RI "With the definitions of the input and output variables:"
.br
.TP
.RI "elpa_t \fBhandle\fP;"
The handle to the ELPA object
.TP
.RI "datatype *\fBa\fP;"
The matrix a for which the eigenvalues should be computed. The dimensions of the matrix must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The \fBdatatype\fP can be one of "double" or "float".
.TP
.RI "datatype *\fBev\fP;"
The storage for the computed eigenvalues. Eigenvalues will be stored in \fIascendig\fP order. The \fBdatatype\fP can be either "double" or "float". Note that the eigenvalues of complex hermitian matrices are also real. The matrix has to be skew-symmetric, this is not checked by the routine.
.TP
.RI "int *\fBerror\fP;"
The error code of the function. Should be "ELPA_OK". The error codes can be querried with \fBelpa_strerr\fP(3)
.SH DESCRIPTION
Compute the eigenvalues of a real skew-symmetric matrix.The functions \fBelpa_init\fP(3), \fBelpa_allocate\fP(3), \fBelpa_set\fP(3), and \fBelpa_setup\fP(3) must be called \fIBEFORE\fP \fBelpa_skew_eigenvalues\fP can be called.
.br
.SH "SEE ALSO"
.br
\fBelpa2_print_kernels\fP(1) \fBelpa_init\fP(3) \fBelpa_allocate\fP(3) \fBelpa_set\fP(3) \fBelpa_setup\fP(3) \fBelpa_strerr\fP(3) \fBelpa_eigenvectors\fP(3) \fBelpa_skew_eigenvectors\fP(3) \fBelpa_eigenvalues\fP(3) \fBelpa_cholesky\fP(3) \fBelpa_invert_triangular\fP(3) \fBelpa_solve_tridiagonal\fP(3) \fBelpa_eigenvalues\fP(3) \fBelpa_uninit\fP(3) \fBelpa_deallocate\fP(3)
.TH "elpa_skew_eigenvectors" 3 "Thur Nov 7 2019" "ELPA" \" -*- nroff -*-
.ad l
.nh
.SH NAME
elpa_skew_eigenvectors \- computes the eigenvalues and (part of) the eigenvector spectrum for a real skew-symmetric matrix
.br
.SH SYNOPSIS
.br
.SS FORTRAN INTERFACE
use elpa
.br
class(elpa_t), pointer :: elpa
.br
.RI "call elpa%\fBskew_eigenvectors\fP (a, ev, q, error)"
.br
.RI " "
.br
.RI "With the definitions of the input and output variables:"
.br
.RI "class(elpa_t) :: \fBelpa\fP ! returns an instance of the ELPA object"
.br
.TP
.RI "datatype :: \fBa\fP"
The matrix a for which the eigenvalues should be computed. The dimensions of matrix a must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The datatype of the matrix can be one of "real(kind=c_double)", "real(kind=c_float)", "complex(kind=c_double)", or "complex(kind=c_float)". The matrix has to be skew-symmetric, this is not checked by the routine.
.TP
.RI "datatype :: \fBev\fP"
The vector ev where the eigenvalues will be stored in \fIascending\fP order. The datatype of the vector ev can be either "real(kind=c_double)", or "real(kind=c_float)", depending of the datatype of the matrix. Note that complex hermitian matrices also have real valued eigenvalues.
.RI "datatype :: \fBq\fP"
The storage space for the computed eigenvectors. The dimensions of matrix a must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The datatype of the matrix can be one of "real(kind=c_double)", "real(kind=c_float)", "complex(kind=c_double)", or "complex(kind=c_float)". Note, that for a skew-symmetric matrix the eigenvectors are complex. The routines returns separately the real and imaginary parts of the complex eigenvectors. Thus, the storage space has to be of dimension q(#numer_of_rows,2*#number_of_column).
.TP
.RI "integer, optional :: \fBerror\fP"
The return error code of the function. Should be "ELPA_OK". The error code can be querried with the function \fBelpa_strerr\fP(3)
.br
.SS C INTERFACE
#include <elpa/elpa.h>
.br
elpa_t handle;
.br
.RI "void \fBelpa_eigenvalues\fP(\fBelpa_t\fP handle, \fBdatatype\fP *a, \fBdatatype\fP *ev, \fBdatatype\fP *q, \fBint\fP *error);"
.br
.RI " "
.br
.RI "With the definitions of the input and output variables:"
.br
.TP
.RI "elpa_t \fBhandle\fP;"
The handle to the ELPA object
.TP
.RI "datatype *\fBa\fP;"
The matrix a for which the eigenvalues should be computed. The dimensions of the matrix must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The \fBdatatype\fP can be one of "double", "float", "double complex", or "float complex". The matrix has to be symmetric or hermitian, this is not checked by the routine.
.TP
.RI "datatype *\fBev\fP;"
The storage for the computed eigenvalues. Eigenvalues will be stored in \fIascendig\fP order. The \fBdatatype\fP can be either "double" or "float". Note that the eigenvalues of complex hermitian matrices are also real.
.TP
.RI "datatype *\fBq\fP;"
The storage space for the computed eigenvectors. The dimensions of the matrix must be set \fIBEFORE\fP with the methods \fBelpa_set\fP(3) and \fBelpa_setup\fP(3). The \fBdatatype\fP can be one of "double", "float", "double complex", or "float complex". Note, that for a skew-symmetric matrix the eigenvectors are complex. The routines returns separately the real and imaginary parts of the complex eigenvectors. Thus, the storage space has to be of dimension q(#numer_of_rows,2*#number_of_column).
.TP
.RI "int *\fBerror\fP;"
The error code of the function. Should be "ELPA_OK". The error codes can be querried with \fBelpa_strerr\fP(3)
.SH DESCRIPTION
Compute the eigenvalues and (parts of) the eigenvector spectrum of a real symmetric or complex hermitian matrix.The functions \fBelpa_init\fP(3), \fBelpa_allocate\fP(3), \fBelpa_set\fP(3), and \fBelpa_setup\fP(3) must be called \fIBEFORE\fP \fBelpa_eigenvalues\fP can be called. Especially the number of eigenvectors to be computed can be set with \fPelpa_set\fB(3)
.br
.SH "SEE ALSO"
.br
\fBelpa2_print_kernels\fP(1) \fBelpa_init\fP(3) \fBelpa_allocate\fP(3) \fBelpa_set\fP(3) \fBelpa_setup\fP(3) \fBelpa_strerr\fP(3) \fBelpa_eigenvalues\fP(3) \fBelpa_skew_eigenvalues\fP(3) \fBelpa_eigenvectors\fP(3) \fBelpa_cholesky\fP(3) \fBelpa_invert_triangular\fP(3) \fBelpa_solve_tridiagonal\fP(3) \fBelpa_hermitian_multiply\fP(3) \fBelpa_uninit\fP(3) \fBelpa_deallocate\fP(3)
......@@ -123,6 +123,15 @@ module elpa_api
elpa_eigenvalues_dc, &
elpa_eigenvalues_fc
generic, public :: skew_eigenvectors => & !< method skew_eigenvectors for solving the full skew-symmetric eigenvalue problem
elpa_skew_eigenvectors_d, & !< the eigenvalues and (parts of) the eigenvectors are computed
elpa_skew_eigenvectors_f !< for symmetric real valued skew-symmetric matrices
generic, public :: skew_eigenvalues => & !< method skew_eigenvalues for solving the skew-symmetric eigenvalue problem
elpa_skew_eigenvalues_d, & !< only the eigenvalues are computed
elpa_skew_eigenvalues_f !< for symmetric real valued skew-symmetric matrices
generic, public :: generalized_eigenvectors => & !< method eigenvectors for solving the full generalized eigenvalue problem
elpa_generalized_eigenvectors_d, & !< the eigenvalues and (parts of) the eigenvectors are computed
elpa_generalized_eigenvectors_f, & !< for symmetric real valued / hermitian complex valued matrices
......@@ -188,6 +197,13 @@ module elpa_api
procedure(elpa_eigenvalues_dc_i), deferred, public :: elpa_eigenvalues_dc
procedure(elpa_eigenvalues_fc_i), deferred, public :: elpa_eigenvalues_fc
procedure(elpa_skew_eigenvectors_d_i), deferred, public :: elpa_skew_eigenvectors_d
procedure(elpa_skew_eigenvectors_f_i), deferred, public :: elpa_skew_eigenvectors_f
procedure(elpa_skew_eigenvalues_d_i), deferred, public :: elpa_skew_eigenvalues_d
procedure(elpa_skew_eigenvalues_f_i), deferred, public :: elpa_skew_eigenvalues_f
procedure(elpa_generalized_eigenvectors_d_i), deferred, public :: elpa_generalized_eigenvectors_d
procedure(elpa_generalized_eigenvectors_f_i), deferred, public :: elpa_generalized_eigenvectors_f
procedure(elpa_generalized_eigenvectors_dc_i), deferred, public :: elpa_generalized_eigenvectors_dc
......
......@@ -26,11 +26,11 @@
!> \param ev double real: on output stores the eigenvalues
!> \param q double complex matrix q: on output stores the eigenvectors
#endif
#if ELPA_IMPL_SUFFIX ==fc
#if ELPA_IMPL_SUFFIX == fc
!> \param a single complex matrix a: defines the problem to solve
!> \param ev single real: on output stores the eigenvalues
!> \param q single complex matrix q: on output stores the eigenvectors
#endif
#endif
!> \result error integer, optional : error code, which can be queried with elpa_strerr
abstract interface
subroutine elpa_eigenvectors_&
......@@ -56,7 +56,52 @@
end subroutine
end interface
!> \brief abstract definition of interface to solve double real skew-symmetric eigenvalue problem
!>
!> The dimensions of the matrix a (locally ditributed and global), the block-cyclic distribution
!> blocksize, the number of eigenvectors
!> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
!> with the class method "setup"
!>
!> It is possible to change the behaviour of the method by setting tunable parameters with the
!> class method "set"
!> Parameters
!> \details
!> \param self class(elpa_t), the ELPA object
#if ELPA_IMPL_SUFFIX == d
!> \param a double real matrix a: defines the problem to solve
!> \param ev double real: on output stores the eigenvalues
!> \param q double real matrix q: on output stores the eigenvectors
#endif
#if ELPA_IMPL_SUFFIX == f
!> \param a single real matrix a: defines the problem to solve
!> \param ev single real: on output stores the eigenvalues
!> \param q single real matrix q: on output stores the eigenvectors
#endif
!> \result error integer, optional : error code, which can be queried with elpa_strerr
abstract interface
subroutine elpa_skew_eigenvectors_&
&ELPA_IMPL_SUFFIX&
&_i(self, a, ev, q, error)
use iso_c_binding
import elpa_t
implicit none
class(elpa_t) :: self
#ifdef USE_ASSUMED_SIZE
MATH_DATATYPE(kind=C_DATATYPE_KIND) :: a(self%local_nrows, *), q(self%local_nrows,*)
#else
MATH_DATATYPE(kind=C_DATATYPE_KIND) :: a(self%local_nrows, self%local_ncols), q(self%local_nrows, 2*self%local_ncols)
#endif
real(kind=C_REAL_DATATYPE) :: ev(self%na)
#ifdef USE_FORTRAN2008
integer, optional :: error
#else
integer :: error
#endif
end subroutine
end interface
!> \brief abstract definition of interface to solve a eigenvalue problem
!>
......@@ -81,15 +126,59 @@
#if ELPA_IMPL_SUFFIX == dc
!> \param a double complex matrix a: defines the problem to solve
!> \param ev double real: on output stores the eigenvalues
#endif
#if ELPA_IMPL_SUFFIX == fc
#endif
#if ELPA_IMPL_SUFFIX ==fc
!> \param a single complex matrix a: defines the problem to solve
!> \param ev single real: on output stores the eigenvalues
#endif
!> \result error integer, optional : error code, which can be queried with elpa_strerr
abstract interface
subroutine elpa_eigenvalues_&
&ELPA_IMPL_SUFFIX&
&_i(self, a, ev, error)
use iso_c_binding
import elpa_t
implicit none
class(elpa_t) :: self
#ifdef USE_ASSUMED_SIZE
MATH_DATATYPE(kind=C_DATATYPE_KIND) :: a(self%local_nrows, *)
#else
MATH_DATATYPE(kind=C_DATATYPE_KIND) :: a(self%local_nrows, self%local_ncols)
#endif
real(kind=C_REAL_DATATYPE) :: ev(self%na)
#ifdef USE_FORTRAN2008
integer, optional :: error
#else
integer :: error
#endif
end subroutine
end interface
!> \brief abstract definition of interface to solve a skew-symmetric eigenvalue problem
!>
!> The dimensions of the matrix a (locally ditributed and global), the block-cyclic distribution
!> blocksize, the number of eigenvectors
!> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
!> with the class method "setup"
!>
!> It is possible to change the behaviour of the method by setting tunable parameters with the
!> class method "set"
!> Parameters
!> \details
!> \param self class(elpa_t), the ELPA object
#if ELPA_IMPL_SUFFIX == d
!> \param a double real matrix a: defines the problem to solve
!> \param ev double real: on output stores the eigenvalues
#endif
#if ELPA_IMPL_SUFFIX == f
!> \param a single real matrix a: defines the problem to solve
!> \param ev single real: on output stores the eigenvalues
#endif
!> \result error integer, optional : error code, which can be queried with elpa_strerr
abstract interface
subroutine elpa_eigenvalues_&
subroutine elpa_skew_eigenvalues_&
&ELPA_IMPL_SUFFIX&
&_i(self, a, ev, error)
use iso_c_binding
......@@ -173,8 +262,6 @@
end subroutine
end interface
!> \brief abstract definition of interface to solve a generalized eigenvalue problem
!>
!> The dimensions of the matrix a and b (locally ditributed and global), the block-cyclic distribution
......
......@@ -117,6 +117,15 @@ module elpa_impl
procedure, public :: elpa_eigenvalues_dc
procedure, public :: elpa_eigenvalues_fc
procedure, public :: elpa_skew_eigenvectors_d !< public methods to implement the solve step for real skew-symmetric
!< double/single matrices
procedure, public :: elpa_skew_eigenvectors_f
procedure, public :: elpa_skew_eigenvalues_d !< public methods to implement the solve step for real skew-symmetric
!< double/single matrices; only the eigenvalues are computed
procedure, public :: elpa_skew_eigenvalues_f
procedure, public :: elpa_generalized_eigenvectors_d !< public methods to implement the solve step for generalized
!< eigenproblem and real/complex double/single matrices
procedure, public :: elpa_generalized_eigenvectors_f
......
......@@ -94,7 +94,7 @@
error = ELPA_ERROR
endif
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in solve() and you did not check for errors!"
write(error_unit,'(a)') "ELPA: Error in eigenvectors() and you did not check for errors!"
endif
#else
if (success_l) then
......@@ -161,6 +161,156 @@
& (self, a, ev, q, error)
end subroutine
#ifdef REALCASE
!> \brief elpa_skew_eigenvectors_d: class method to solve the real valued skew-symmetric eigenvalue problem
!>
!> The dimensions of the matrix a (locally ditributed and global), the block-cyclic distribution
!> blocksize, the number of eigenvectors
!> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
!> with the class method "setup"
!>
!> It is possible to change the behaviour of the method by setting tunable parameters with the
!> class method "set"
!>
!> Parameters
!>
!> \param a Distributed matrix for which eigenvalues are to be computed.
!> Distribution is like in Scalapack.
!> The full matrix must be set (not only one half like in scalapack).
!> Destroyed on exit (upper and lower half).
!>
!> \param ev On output: eigenvalues of a, every processor gets the complete set
!>
!> \param q On output: Eigenvectors of a
!> Distribution is like in Scalapack.
!> Must be always dimensioned to the full size (corresponding to (na,na))
!> even if only a part of the eigenvalues is needed.
!>
!> \param error integer, optional: returns an error code, which can be queried with elpa_strerr
subroutine elpa_skew_eigenvectors_&
&ELPA_IMPL_SUFFIX&
& (self, a, ev, q, error)
class(elpa_impl_t) :: self
#ifdef USE_ASSUMED_SIZE
MATH_DATATYPE(kind=C_DATATYPE_KIND) :: a(self%local_nrows, *), q(self%local_nrows, *)
#else
MATH_DATATYPE(kind=C_DATATYPE_KIND) :: a(self%local_nrows, self%local_ncols)
MATH_DATATYPE(kind=C_DATATYPE_KIND) :: q(self%local_nrows, 2*self%local_ncols)
#endif
real(kind=C_REAL_DATATYPE) :: ev(self%na)
#ifdef USE_FORTRAN2008
integer, optional :: error
#else
integer :: error
#endif
integer :: error2
integer(kind=c_int) :: solver
logical :: success_l
call self%get("solver", solver,error2)
call self%set("is_skewsymmetric",1)
if (error2 .ne. ELPA_OK) then
print *,"Problem setting option. Aborting..."
#ifdef USE_FORTRAN2008
if (present(error)) then
error = error2
endif
#else
error = error2
#endif
return
endif
if (solver .eq. ELPA_SOLVER_1STAGE) then
call self%autotune_timer%start("accumulator")
#if defined(INCLUDE_ROUTINES)
success_l = elpa_solve_evp_&
&MATH_DATATYPE&
&_1stage_&
&PRECISION&
&_impl(self, a, ev, q)
#endif
call self%autotune_timer%stop("accumulator")
else if (solver .eq. ELPA_SOLVER_2STAGE) then
call self%autotune_timer%start("accumulator")
#if defined(INCLUDE_ROUTINES)
success_l = elpa_solve_evp_&
&MATH_DATATYPE&
&_2stage_&
&PRECISION&
&_impl(self, a, ev, q)
#endif
call self%autotune_timer%stop("accumulator")
else
print *,"unknown solver"
stop
endif
#ifdef USE_FORTRAN2008
if (present(error)) then
if (success_l) then
error = ELPA_OK
else
error = ELPA_ERROR
endif
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in skew_eigenvectors() and you did not check for errors!"
endif
#else
if (success_l) then
error = ELPA_OK
else
error = ELPA_ERROR
endif
#endif
end subroutine
#ifdef REALCASE
#ifdef DOUBLE_PRECISION_REAL
!c> void elpa_skew_eigenvectors_d(elpa_t handle, double *a, double *ev, double *q, int *error);
#endif
#ifdef SINGLE_PRECISION_REAL
!c> void elpa_skew_eigenvectors_f(elpa_t handle, float *a, float *ev, float *q, int *error);
#endif
#endif
subroutine elpa_skew_eigenvectors_&
&ELPA_IMPL_SUFFIX&
&_c(handle, a_p, ev_p, q_p, error) &
#ifdef REALCASE
#ifdef DOUBLE_PRECISION_REAL
bind(C, name="elpa_skew_eigenvectors_d")
#endif
#ifdef SINGLE_PRECISION_REAL
bind(C, name="elpa_skew_eigenvectors_f")
#endif
#endif
type(c_ptr), intent(in), value :: handle, a_p, ev_p, q_p
#ifdef USE_FORTRAN2008
integer(kind=c_int), optional, intent(in) :: error
#else
integer(kind=c_int), intent(in) :: error
#endif
MATH_DATATYPE(kind=C_DATATYPE_KIND), pointer :: a(:, :), q(:, :)
real(kind=C_REAL_DATATYPE), pointer :: ev(:)
type(elpa_impl_t), pointer :: self
call c_f_pointer(handle, self)
call c_f_pointer(a_p, a, [self%local_nrows, self%local_ncols])
call c_f_pointer(ev_p, ev, [self%na])
call c_f_pointer(q_p, q, [self%local_nrows, self%local_ncols])
call elpa_skew_eigenvectors_&
&ELPA_IMPL_SUFFIX&
& (self, a, ev, q, error)
end subroutine
#endif /* REALCASE */
!> \brief elpa_eigenvalues_d: class method to solve the eigenvalue problem
!>
......@@ -249,7 +399,7 @@
error = ELPA_ERROR
endif
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in solve() and you did not check for errors!"
write(error_unit,'(a)') "ELPA: Error in eigenvalues() and you did not check for errors!"
endif
#else
if (success_l) then
......@@ -312,7 +462,140 @@
& (self, a, ev, error)
end subroutine
#ifdef REALCASE
!> \brief elpa_skew_eigenvalues_d: class method to solve the real valued skew-symmetric eigenvalue problem
!>
!> The dimensions of the matrix a (locally ditributed and global), the block-cyclic distribution
!> blocksize, the number of eigenvectors
!> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
!> with the class method "setup"
!>
!> It is possible to change the behaviour of the method by setting tunable parameters with the