UP | HOME

Utility functions

Table of Contents

1 Matrix operations

1.1 qmckl_transpose

Transposes a matrix: \(B_{ji} = A_{ij}\)

qmcklcontext context in Global state
int64t m in Number of rows of the input matrix
int64t n in Number of columns of the input matrix
double A[][lda] in Array containing the \(m \times n\) matrix \(A\)
int64t lda in Leading dimension of array A
double B[][ldb] out Array containing the \(n \times m\) matrix \(B\)
int64t ldb in Leading dimension of array B

1.1.1 Requirements

  • context is not QMCKL_NULL_CONTEXT
  • m > 0
  • n > 0
  • lda >= m
  • ldb >= n
  • A is allocated with at least \(m \times n \times 8\) bytes
  • B is allocated with at least \(n \times m \times 8\) bytes

1.1.2 C header

qmckl_exit_code qmckl_transpose (
              const qmckl_context context,
      const int64_t m,
      const int64_t n,
      const double* A,
      const int64_t lda,
      double* const B,
      const int64_t ldb ); 

1.1.3 Source

integer function qmckl_transpose_f(context, m, n, A, LDA, B, LDB) &
     result(info)
  use qmckl
  implicit none
  integer(qmckl_context)  , intent(in)  :: context
  integer*8  , intent(in)  :: m, n
  integer*8  , intent(in)  :: lda
  real*8     , intent(in)  :: A(lda,*)
  integer*8  , intent(in)  :: ldb
  real*8     , intent(out) :: B(ldb,*)

  integer*8 :: i,j

  info = QMCKL_SUCCESS

  if (context == QMCKL_NULL_CONTEXT) then
     info = QMCKL_INVALID_CONTEXT
     return
  endif

  if (m <= 0_8) then
     info = QMCKL_INVALID_ARG_2
     return
  endif

  if (n <= 0_8) then
     info = QMCKL_INVALID_ARG_3
     return
  endif

  if (LDA < m) then
     info = QMCKL_INVALID_ARG_5
     return
  endif

  if (LDB < n) then
     info = QMCKL_INVALID_ARG_7
     return
  endif

  do j=1,m
     do i=1,n
       B(i,j) = A(j,i)
    end do
 end do

end function qmckl_transpose_f

Author: TREX CoE

Created: 2021-06-21 Mon 09:21

Validate