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
infnm.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 infinity norm routines
11 C
12 C Input/Output parameters:
13 C
14 C M - rows (int)(input)
15 C N - columns (int)(input)
16 C A - matrix (real)(input)
17 C LDA - leading dimesion of A (int)(input)
18 
19  REAL FUNCTION sinfnm (M, N, A, LDA)
20 CDEC$ IF DEFINED (FTN_EXPORTS)
21 CDEC$ ATTRIBUTES DLLEXPORT::SINFNM
22 CDEC$ ENDIF
23  INTEGER m, n, lda
24  REAL a(lda*n)
25  INTEGER i
26  REAL s
27  INTEGER isamax
28 
29  sinfnm = 0.
30  IF (m .EQ. lda) THEN
31  sinfnm = abs(a(isamax(m * n, a, 1)))
32  ELSE
33  DO 10 i = 0, n-1
34  s = abs(a(isamax(m, a(i*lda+1), 1)))
35  IF (s .GT. sinfnm) sinfnm = s
36 10 CONTINUE
37  END IF
38  RETURN
39  END !FUNCTION SINFNM
40 
41 
42  DOUBLE PRECISION FUNCTION dinfnm (M, N, A, LDA)
43 CDEC$ IF DEFINED (FTN_EXPORTS)
44 CDEC$ ATTRIBUTES DLLEXPORT::DINFNM
45 CDEC$ ENDIF
46  INTEGER m, n, lda
47  DOUBLE PRECISION a(lda*n)
48  INTEGER i
49  DOUBLE PRECISION s
50  INTEGER idamax
51 
52  dinfnm = 0.d0
53  IF (m .EQ. lda) THEN
54  dinfnm = dabs(a(idamax(m * n, a, 1)))
55  ELSE
56  DO 20 i = 0, n-1
57  s = dabs(a(idamax(m, a(i*lda+1), 1)))
58  IF (s .GT. dinfnm) dinfnm = s
59 20 CONTINUE
60  END IF
61  RETURN
62  END !FUNCTION DINFNM
63 
64 
65  REAL FUNCTION cinfnm (M, N, A, LDA)
66 CDEC$ IF DEFINED (FTN_EXPORTS)
67 CDEC$ ATTRIBUTES DLLEXPORT::CINFNM
68 CDEC$ ENDIF
69  INTEGER m, n, lda
70  COMPLEX a(lda*n)
71  INTEGER i
72  REAL s
73  INTEGER icamax
74 
75  cinfnm = (0., 0.)
76  IF (m .EQ. lda) THEN
77  cinfnm = cabs(a(icamax(m * n, a, 1)))
78  ELSE
79  DO 20 i = 0, n-1
80  s = cabs(a(icamax(m, a(i*lda+1), 1)))
81  IF (s .GT. cinfnm) cinfnm = s
82 20 CONTINUE
83  END IF
84  RETURN
85  END !FUNCTION CINFNM
86 
87 
88  DOUBLE PRECISION FUNCTION zinfnm (M, N, A, LDA)
89 CDEC$ IF DEFINED (FTN_EXPORTS)
90 CDEC$ ATTRIBUTES DLLEXPORT::ZINFNM
91 CDEC$ ENDIF
92  INTEGER m, n, lda
93  DOUBLE COMPLEX a(lda*n)
94  INTEGER i
95  DOUBLE PRECISION s
96  INTEGER izamax
97 
98  zinfnm = (0.d0, 0.d0)
99  IF (m .EQ. lda) THEN
100  zinfnm = zabs(a(izamax(m * n, a, 1)))
101  ELSE
102  DO 20 i = 0, n-1
103  s = zabs(a(izamax(m, a(i*lda+1), 1)))
104  IF (s .GT. zinfnm) zinfnm = s
105 20 CONTINUE
106  END IF
107  RETURN
108  END !FUNCTION ZINFNM