1!
2! Copyright (c) 2012-2018, NVIDIA CORPORATION.  All rights reserved.
3!
4! Licensed under the Apache License, Version 2.0 (the "License");
5! you may not use this file except in compliance with the License.
6! You may obtain a copy of the License at
7!
8!     http://www.apache.org/licenses/LICENSE-2.0
9!
10! Unless required by applicable law or agreed to in writing, software
11! distributed under the License is distributed on an "AS IS" BASIS,
12! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13! See the License for the specific language governing permissions and
14! limitations under the License.
15!
16
17
18#include "mmul_dir.h"
19
20
21subroutine ftn_mvmul_real8( ta, m, k, alpha, a, lda, b, beta, c )
22  implicit none
23
24  integer*8 :: m, k, lda
25  real*8      :: alpha, beta
26  real*8, dimension( lda, * ) :: a
27  real*8, dimension( * )      :: b, c
28  integer   :: ta
29  ! Local variables
30
31  integer*8   :: i, j, kk
32  real*8      :: temp
33
34  if( ta .eq. 0 )then ! normally oriented a matrix
35     if( beta .ne. 0 )then
36        do i = 1, m
37           c( i ) = beta * c( i )
38        enddo
39     else
40        do i = 1, m
41           c( i ) = 0.0
42        enddo
43     endif
44     do kk = 1, k
45        temp = alpha * b( kk )
46        do i = 1, m
47           c( i ) = c( i ) + a( i, kk ) * temp
48        enddo
49     enddo
50  else ! matrix a is transposed - may be improved with buffering of b * alpha
51     if( beta .ne. 0 )then
52        do i = 1, m
53           c( i ) = beta * c( i )
54        enddo
55     else
56        do i = 1, m
57           c( i ) = 0.0
58        enddo
59     endif
60     do i = 1, m
61        temp = 0.0
62        do kk = 1, k
63           temp = temp + a( kk, i ) * b( kk )
64        enddo
65        c( i ) = c( i ) + alpha * temp
66     enddo
67  endif
68  return
69end subroutine ftn_mvmul_real8
70