CVM Class Library  8.1
This C++ class library encapsulates concepts of vector and different matrices including square, band, symmetric and hermitian ones in Euclidean space of real and complex numbers.
 All Classes Files Functions Variables Typedefs Friends Macros Pages
axpym.f
Go to the documentation of this file.
1 C CVM Class Library
2 C http://cvmlib.com
3 C
4 C Copyright Sergei Nikolaev 1992-2013
5 C Distributed under the Boost Software License, Version 1.0.
6 C (See accompanying file LICENSE_1_0.txt or copy at
7 C http://www.boost.org/LICENSE_1_0.txt)
8 C
9 C
10 C Matrix axpy routines
11 C
12 C The ?axpy routines perform a vector-vector operation defined as
13 C y := a*x + y
14 C
15 C
16 C Input/Output parameters:
17 C
18 C M - rows (int)(input)
19 C N - columns (int)(input)
20 C A - multiplier (real)(input)
21 C X - source matrix (real)(input)
22 C LDX - leading dimesion of X (int)(input)
23 C Y - destination matrix (real)(output)
24 C LDY - leading dimesion of Y (int)(input)
25 
26  SUBROUTINE saxpym (M, N, A, X, LDX, Y, LDY)
27 CDEC$ IF DEFINED (FTN_EXPORTS)
28 CDEC$ ATTRIBUTES DLLEXPORT::SAXPYM
29 CDEC$ ENDIF
30  INTEGER m, n, ldx, ldy
31  REAL a, x(ldx*n), y(ldy*n)
32  INTEGER i
33 
34  IF (m .EQ. ldx .AND. m .EQ. ldy) THEN
35  CALL saxpy(m * n, a, x, 1, y, 1)
36  ELSE
37  DO 10 i = 0, n-1
38  CALL saxpy(m, a, x(i*ldx+1), 1, y(i*ldy+1), 1)
39 10 CONTINUE
40  END IF
41  RETURN
42  END !SUBROUTINE SAXPYM
43 
44 
45  SUBROUTINE daxpym (M, N, A, X, LDX, Y, LDY)
46 CDEC$ IF DEFINED (FTN_EXPORTS)
47 CDEC$ ATTRIBUTES DLLEXPORT::DAXPYM
48 CDEC$ ENDIF
49  INTEGER m, n, ldx, ldy
50  DOUBLE PRECISION a, x(ldx*n), y(ldy*n)
51  INTEGER i
52 
53  IF (m .EQ. ldx .AND. m .EQ. ldy) THEN
54  CALL daxpy(m * n, a, x, 1, y, 1)
55  ELSE
56  DO 20 i = 0, n-1
57  CALL daxpy(m, a, x(i*ldx+1), 1, y(i*ldy+1), 1)
58 20 CONTINUE
59  END IF
60  RETURN
61  END !SUBROUTINE DAXPYM
62 
63 
64  SUBROUTINE caxpym (M, N, A, X, LDX, Y, LDY)
65 CDEC$ IF DEFINED (FTN_EXPORTS)
66 CDEC$ ATTRIBUTES DLLEXPORT::CAXPYM
67 CDEC$ ENDIF
68  INTEGER m, n, ldx, ldy
69  COMPLEX a, x(ldx*n), y(ldy*n)
70  INTEGER i
71 
72  IF (m .EQ. ldx .AND. m .EQ. ldy) THEN
73  CALL caxpy(m * n, a, x, 1, y, 1)
74  ELSE
75  DO 30 i = 0, n-1
76  CALL caxpy(m, a, x(i*ldx+1), 1, y(i*ldy+1), 1)
77 30 CONTINUE
78  END IF
79  RETURN
80  END !SUBROUTINE CAXPYM
81 
82 
83  SUBROUTINE zaxpym (M, N, A, X, LDX, Y, LDY)
84 CDEC$ IF DEFINED (FTN_EXPORTS)
85 CDEC$ ATTRIBUTES DLLEXPORT::ZAXPYM
86 CDEC$ ENDIF
87  INTEGER m, n, ldx, ldy
88  DOUBLE COMPLEX a, x(ldx*n), y(ldy*n)
89  INTEGER i
90 
91  IF (m .EQ. ldx .AND. m .EQ. ldy) THEN
92  CALL zaxpy(m * n, a, x, 1, y, 1)
93  ELSE
94  DO 40 i = 0, n-1
95  CALL zaxpy(m, a, x(i*ldx+1), 1, y(i*ldy+1), 1)
96 40 CONTINUE
97  END IF
98  RETURN
99  END !SUBROUTINE ZAXPYM