-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathstdlib_linalg_blas_aux.fypp.html
451 lines (408 loc) · 66.4 KB
/
stdlib_linalg_blas_aux.fypp.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
<!-- -*- mode: jinja2 -*- -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="A community driven standard library for (modern) Fortran">
<meta name="author" content="fortran-lang/stdlib contributors" >
<link rel="icon" href="../favicon.png">
<title>stdlib_linalg_blas_aux.fypp – Fortran-lang/stdlib</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link href="../css/pygments.css" rel="stylesheet">
<link href="../css/font-awesome.min.css" rel="stylesheet">
<link href="../css/local.css" rel="stylesheet">
<link href="../tipuesearch/tipuesearch.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<script src="../js/svg-pan-zoom.min.js"></script>
</head>
<body>
<!-- Fixed navbar -->
<div class="container-fluid mb-sm-4 mb-xl-2">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="../index.html">Fortran-lang/stdlib </a>
<button type="button" class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#navbar"
aria-expanded="false" aria-controls="navbar" aria-label="Toggle navigation">
<span class="navbar-toggler-icon">
</button>
<div id="navbar" class="navbar-collapse collapse">
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" href="../page/index.html">Contributing and specs</a></li>
<li class="nav-item">
<a class="nav-link" href="../lists/files.html">Source Files</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../lists/modules.html">Modules</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../lists/procedures.html">Procedures</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../lists/absint.html">Abstract Interfaces</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../lists/types.html">Derived Types</a>
</li>
</ul>
<div class="d-flex align-items-end flex-grow-1">
<form action="../search.html" role="search" class="ms-auto">
<input type="text" class="form-control" aria-label="Search" placeholder="Search" name="q" id="tipue_search_input" autocomplete="off" required>
</form>
</div>
</div><!--/.nav-collapse -->
</div>
</nav>
</div>
<div class="container">
<div class="row">
<h1>stdlib_linalg_blas_aux.fypp
<small>Source File</small>
</h1>
<div class="container p-2 mb-4 bg-light border rounded-3">
<div class="row align-items-center justify-content-between" id="info-bar">
<div class="col">
<ul class="list-inline" style="margin-bottom:0px;display:inline">
<li class="list-inline-item" id="meta-license"><i class="fa fa-legal"></i> <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/80x15.png" /></a></li>
<li class="list-inline-item" id="statements"><i class="fa fa-list-ol"></i>
<a data-bs-toggle="tooltip"
data-bs-placement="bottom" data-html="true"
title=" 0.1% of total for source files.">197 statements</a>
</li>
<li class="list-inline-item" id="source-file">
<i class="fa fa-code"></i>
<a href="../src/stdlib_linalg_blas_aux.fypp"> Source File</a>
</li>
</ul>
</div>
<div class="col">
<nav aria-label="breadcrumb">
<ol class="breadcrumb justify-content-end mb-0">
<li class="breadcrumb-item active" aria-current="page">stdlib_linalg_blas_aux.fypp</li>
</ol>
</nav>
</div>
</div>
</div>
<script>
$(function () {
$('[data-bs-toggle="tooltip"]').tooltip()
})
</script>
</div>
<div class="row">
<div class="col-md-3 hidden-xs hidden-sm visible-md visible-lg">
<div id="sidebar">
<h3>Contents</h3>
<div class="card mb-4">
<a data-bs-toggle="collapse" href="#mods-0"
aria-expanded="false" aria-controls="mods-0">
<h4 class="card-header bg-primary text-white">Modules</h4>
</a>
<div id="mods-0" class="collapse">
<div class="list-group list-group-flush">
<a class="list-group-item" href="../module/stdlib_linalg_blas_aux.html">stdlib_linalg_blas_aux</a>
</div>
</div>
</div>
<div class="card card-primary">
<div class="card-header text-left"><h3 class="card-title">Source Code</h3></div>
<div class="list-group">
<a class="list-group-item" href="../sourcefile/stdlib_linalg_blas_aux.fypp.html#src">stdlib_linalg_blas_aux.fypp</a>
</div>
</div>
</div>
</div>
<div class="col-md-9" id='text'>
<br>
<section>
<h2><span class="anchor" id="src"></span>Source Code</h2>
<div class="hl codehilite"><pre><span></span><a id="ln-1" name="ln-1" href="#ln-1"></a><span class="cp">#:include "common.fypp" </span>
<a id="ln-2" name="ln-2" href="#ln-2"></a><span class="cp">#:set RC_KINDS_TYPES = REAL_KINDS_TYPES + CMPLX_KINDS_TYPES</span>
<a id="ln-3" name="ln-3" href="#ln-3"></a><span class="k">module </span><span class="n">stdlib_linalg_blas_aux</span>
<a id="ln-4" name="ln-4" href="#ln-4"></a><span class="w"> </span><span class="k">use </span><span class="n">stdlib_linalg_constants</span>
<a id="ln-5" name="ln-5" href="#ln-5"></a><span class="w"> </span><span class="k">implicit none</span>
<a id="ln-6" name="ln-6" href="#ln-6"></a><span class="k"> private</span>
<a id="ln-7" name="ln-7" href="#ln-7"></a>
<a id="ln-8" name="ln-8" href="#ln-8"></a>
<a id="ln-9" name="ln-9" href="#ln-9"></a><span class="k"> public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">sp</span><span class="p">,</span><span class="n">dp</span><span class="p">,</span><span class="n">qp</span><span class="p">,</span><span class="n">lk</span><span class="p">,</span><span class="n">ilp</span>
<a id="ln-10" name="ln-10" href="#ln-10"></a><span class="w"> </span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">stdlib_cabs1</span>
<a id="ln-11" name="ln-11" href="#ln-11"></a><span class="w"> </span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">stdlib_lsame</span>
<a id="ln-12" name="ln-12" href="#ln-12"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="n">for</span><span class="w"> </span><span class="n">ik</span><span class="p">,</span><span class="n">it</span><span class="p">,</span><span class="n">ii</span><span class="w"> </span><span class="n">in</span><span class="w"> </span><span class="n">LINALG_INT_KINDS_TYPES</span>
<a id="ln-13" name="ln-13" href="#ln-13"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="n">for</span><span class="w"> </span><span class="n">rk</span><span class="p">,</span><span class="n">rt</span><span class="p">,</span><span class="n">ri</span><span class="w"> </span><span class="n">in</span><span class="w"> </span><span class="n">RC_KINDS_TYPES</span>
<a id="ln-14" name="ln-14" href="#ln-14"></a><span class="w"> </span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">stdlib$</span><span class="err">{</span><span class="n">ii</span><span class="err">}$_</span><span class="n">i$</span><span class="err">{</span><span class="n">ri</span><span class="err">}$</span><span class="nb">amax</span>
<a id="ln-15" name="ln-15" href="#ln-15"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="n">endfor</span><span class="w"> </span>
<a id="ln-16" name="ln-16" href="#ln-16"></a><span class="w"> </span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">stdlib$</span><span class="err">{</span><span class="n">ii</span><span class="err">}$_</span><span class="n">xerbla</span>
<a id="ln-17" name="ln-17" href="#ln-17"></a><span class="w"> </span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">stdlib$</span><span class="err">{</span><span class="n">ii</span><span class="err">}$_</span><span class="n">xerbla_array</span>
<a id="ln-18" name="ln-18" href="#ln-18"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="n">endfor</span>
<a id="ln-19" name="ln-19" href="#ln-19"></a>
<a id="ln-20" name="ln-20" href="#ln-20"></a><span class="w"> </span><span class="k">interface </span><span class="n">stdlib_cabs1</span>
<a id="ln-21" name="ln-21" href="#ln-21"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="n">for</span><span class="w"> </span><span class="n">rk</span><span class="p">,</span><span class="n">rt</span><span class="p">,</span><span class="n">ri</span><span class="w"> </span><span class="n">in</span><span class="w"> </span><span class="n">REAL_KINDS_TYPES</span>
<a id="ln-22" name="ln-22" href="#ln-22"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">stdlib_$</span><span class="err">{</span><span class="n">ri</span><span class="err">}$</span><span class="n">cabs1</span>
<a id="ln-23" name="ln-23" href="#ln-23"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="n">endfor</span>
<a id="ln-24" name="ln-24" href="#ln-24"></a><span class="w"> </span><span class="k">end interface </span><span class="n">stdlib_cabs1</span>
<a id="ln-25" name="ln-25" href="#ln-25"></a>
<a id="ln-26" name="ln-26" href="#ln-26"></a><span class="w"> </span><span class="k">contains</span>
<a id="ln-27" name="ln-27" href="#ln-27"></a>
<a id="ln-28" name="ln-28" href="#ln-28"></a>
<a id="ln-29" name="ln-29" href="#ln-29"></a><span class="cp">#:for ck,ct,ci in REAL_KINDS_TYPES</span>
<a id="ln-30" name="ln-30" href="#ln-30"></a><span class="w"> </span><span class="k">pure elemental </span><span class="kt">real</span><span class="p">(</span><span class="err">${</span><span class="n">ck</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">stdlib_$</span><span class="err">{</span><span class="n">ci</span><span class="err">}$</span><span class="n">cabs1</span><span class="p">(</span><span class="n">z</span><span class="p">)</span>
<a id="ln-31" name="ln-31" href="#ln-31"></a><span class="w"> </span><span class="c">!! DCABS1 computes |Re(.)| + |Im(.)| of a double complex number</span>
<a id="ln-32" name="ln-32" href="#ln-32"></a><span class="w"> </span><span class="c">! -- reference blas level1 routine --</span>
<a id="ln-33" name="ln-33" href="#ln-33"></a><span class="w"> </span><span class="c">! -- reference blas is a software package provided by univ. of tennessee, --</span>
<a id="ln-34" name="ln-34" href="#ln-34"></a><span class="w"> </span><span class="c">! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--</span>
<a id="ln-35" name="ln-35" href="#ln-35"></a><span class="w"> </span><span class="c">! Scalar Arguments </span>
<a id="ln-36" name="ln-36" href="#ln-36"></a><span class="w"> </span><span class="kt">complex</span><span class="p">(</span><span class="err">${</span><span class="n">ck</span><span class="err">}$</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">z</span>
<a id="ln-37" name="ln-37" href="#ln-37"></a><span class="w"> </span><span class="c">! =====================================================================</span>
<a id="ln-38" name="ln-38" href="#ln-38"></a><span class="w"> </span><span class="c">! Intrinsic Functions </span>
<a id="ln-39" name="ln-39" href="#ln-39"></a><span class="w"> </span><span class="k">intrinsic</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="nb">abs</span><span class="p">,</span><span class="kt">real</span><span class="p">,</span><span class="nb">aimag</span>
<a id="ln-40" name="ln-40" href="#ln-40"></a><span class="nb"> </span><span class="n">stdlib_$</span><span class="err">{</span><span class="n">ci</span><span class="err">}$</span><span class="n">cabs1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">abs</span><span class="p">(</span><span class="kt">real</span><span class="p">(</span><span class="n">z</span><span class="p">,</span><span class="nb">KIND</span><span class="o">=</span><span class="err">${</span><span class="n">ck</span><span class="err">}$</span><span class="p">))</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="nb">abs</span><span class="p">(</span><span class="nb">aimag</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>
<a id="ln-41" name="ln-41" href="#ln-41"></a><span class="w"> </span><span class="k">return</span>
<a id="ln-42" name="ln-42" href="#ln-42"></a><span class="k"> end function </span><span class="n">stdlib_$</span><span class="err">{</span><span class="n">ci</span><span class="err">}$</span><span class="n">cabs1</span>
<a id="ln-43" name="ln-43" href="#ln-43"></a><span class="cp">#:endfor</span>
<a id="ln-44" name="ln-44" href="#ln-44"></a>
<a id="ln-45" name="ln-45" href="#ln-45"></a><span class="w"> </span><span class="k">pure elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">stdlib_lsame</span><span class="p">(</span><span class="n">ca</span><span class="p">,</span><span class="n">cb</span><span class="p">)</span>
<a id="ln-46" name="ln-46" href="#ln-46"></a><span class="w"> </span><span class="c">!! LSAME returns .TRUE. if CA is the same letter as CB regardless of</span>
<a id="ln-47" name="ln-47" href="#ln-47"></a><span class="w"> </span><span class="c">!! case.</span>
<a id="ln-48" name="ln-48" href="#ln-48"></a><span class="w"> </span><span class="c">! -- reference blas level1 routine --</span>
<a id="ln-49" name="ln-49" href="#ln-49"></a><span class="w"> </span><span class="c">! -- reference blas is a software package provided by univ. of tennessee, --</span>
<a id="ln-50" name="ln-50" href="#ln-50"></a><span class="w"> </span><span class="c">! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--</span>
<a id="ln-51" name="ln-51" href="#ln-51"></a><span class="w"> </span><span class="c">! Scalar Arguments </span>
<a id="ln-52" name="ln-52" href="#ln-52"></a><span class="w"> </span><span class="kt">character</span><span class="p">,</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">ca</span><span class="p">,</span><span class="w"> </span><span class="n">cb</span>
<a id="ln-53" name="ln-53" href="#ln-53"></a><span class="w"> </span><span class="c">! =====================================================================</span>
<a id="ln-54" name="ln-54" href="#ln-54"></a><span class="w"> </span><span class="c">! Intrinsic Functions </span>
<a id="ln-55" name="ln-55" href="#ln-55"></a><span class="w"> </span><span class="k">intrinsic</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="nb">ichar</span>
<a id="ln-56" name="ln-56" href="#ln-56"></a><span class="w"> </span><span class="c">! Local Scalars </span>
<a id="ln-57" name="ln-57" href="#ln-57"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="n">ilp</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">inta</span><span class="p">,</span><span class="w"> </span><span class="n">intb</span><span class="p">,</span><span class="w"> </span><span class="n">zcode</span>
<a id="ln-58" name="ln-58" href="#ln-58"></a><span class="w"> </span><span class="c">! test if the characters are equal</span>
<a id="ln-59" name="ln-59" href="#ln-59"></a><span class="w"> </span><span class="n">stdlib_lsame</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ca</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">cb</span>
<a id="ln-60" name="ln-60" href="#ln-60"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">stdlib_lsame</span><span class="p">)</span><span class="w"> </span><span class="k">return</span>
<a id="ln-61" name="ln-61" href="#ln-61"></a><span class="w"> </span><span class="c">! now test for equivalence if both characters are alphabetic.</span>
<a id="ln-62" name="ln-62" href="#ln-62"></a><span class="w"> </span><span class="n">zcode</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">ichar</span><span class="p">(</span><span class="s1">'Z'</span><span class="p">,</span><span class="nb">kind</span><span class="o">=</span><span class="n">ilp</span><span class="p">)</span>
<a id="ln-63" name="ln-63" href="#ln-63"></a><span class="w"> </span><span class="c">! use 'z' rather than 'a' so that ascii can be detected on prime</span>
<a id="ln-64" name="ln-64" href="#ln-64"></a><span class="w"> </span><span class="c">! machines, on which ichar returns a value with bit 8 set.</span>
<a id="ln-65" name="ln-65" href="#ln-65"></a><span class="w"> </span><span class="c">! ichar('a') on prime machines returns 193 which is the same as</span>
<a id="ln-66" name="ln-66" href="#ln-66"></a><span class="w"> </span><span class="c">! ichar('a') on an ebcdic machine.</span>
<a id="ln-67" name="ln-67" href="#ln-67"></a><span class="w"> </span><span class="n">inta</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">ichar</span><span class="p">(</span><span class="n">ca</span><span class="p">,</span><span class="nb">kind</span><span class="o">=</span><span class="n">ilp</span><span class="p">)</span>
<a id="ln-68" name="ln-68" href="#ln-68"></a><span class="w"> </span><span class="n">intb</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">ichar</span><span class="p">(</span><span class="n">cb</span><span class="p">,</span><span class="nb">kind</span><span class="o">=</span><span class="n">ilp</span><span class="p">)</span>
<a id="ln-69" name="ln-69" href="#ln-69"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">zcode</span><span class="o">==</span><span class="mi">90</span><span class="w"> </span><span class="p">.</span><span class="nb">or</span><span class="p">.</span><span class="w"> </span><span class="n">zcode</span><span class="o">==</span><span class="mi">122</span><span class="p">)</span><span class="w"> </span><span class="k">then</span>
<a id="ln-70" name="ln-70" href="#ln-70"></a><span class="w"> </span><span class="c">! ascii is assumed - zcode is the ascii code of either lower or</span>
<a id="ln-71" name="ln-71" href="#ln-71"></a><span class="w"> </span><span class="c">! upper case 'z'.</span>
<a id="ln-72" name="ln-72" href="#ln-72"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">inta</span><span class="o">>=</span><span class="mi">97</span><span class="w"> </span><span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="w"> </span><span class="n">inta</span><span class="o"><=</span><span class="mi">122</span><span class="p">)</span><span class="w"> </span><span class="n">inta</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">inta</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">32</span>
<a id="ln-73" name="ln-73" href="#ln-73"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">intb</span><span class="o">>=</span><span class="mi">97</span><span class="w"> </span><span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="w"> </span><span class="n">intb</span><span class="o"><=</span><span class="mi">122</span><span class="p">)</span><span class="w"> </span><span class="n">intb</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">intb</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">32</span>
<a id="ln-74" name="ln-74" href="#ln-74"></a><span class="w"> </span><span class="k">else if</span><span class="w"> </span><span class="p">(</span><span class="n">zcode</span><span class="o">==</span><span class="mi">233</span><span class="w"> </span><span class="p">.</span><span class="nb">or</span><span class="p">.</span><span class="w"> </span><span class="n">zcode</span><span class="o">==</span><span class="mi">169</span><span class="p">)</span><span class="w"> </span><span class="k">then</span>
<a id="ln-75" name="ln-75" href="#ln-75"></a><span class="w"> </span><span class="c">! ebcdic is assumed - zcode is the ebcdic code of either lower or</span>
<a id="ln-76" name="ln-76" href="#ln-76"></a><span class="w"> </span><span class="c">! upper case 'z'.</span>
<a id="ln-77" name="ln-77" href="#ln-77"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">inta</span><span class="o">>=</span><span class="mi">129</span><span class="w"> </span><span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="w"> </span><span class="n">inta</span><span class="o"><=</span><span class="mi">137</span><span class="w"> </span><span class="p">.</span><span class="nb">or</span><span class="p">.</span><span class="n">inta</span><span class="o">>=</span><span class="mi">145</span><span class="w"> </span><span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="w"> </span><span class="n">inta</span><span class="o"><=</span><span class="mi">153</span><span class="w"> </span><span class="p">.</span><span class="nb">or</span><span class="p">.</span><span class="n">inta</span><span class="o">>=</span><span class="mi">162</span><span class="w"> </span><span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="w"> </span><span class="p">&</span>
<a id="ln-78" name="ln-78" href="#ln-78"></a><span class="w"> </span><span class="n">inta</span><span class="o"><=</span><span class="mi">169</span><span class="p">)</span><span class="w"> </span><span class="n">inta</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">inta</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">64</span>
<a id="ln-79" name="ln-79" href="#ln-79"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">intb</span><span class="o">>=</span><span class="mi">129</span><span class="w"> </span><span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="w"> </span><span class="n">intb</span><span class="o"><=</span><span class="mi">137</span><span class="w"> </span><span class="p">.</span><span class="nb">or</span><span class="p">.</span><span class="n">intb</span><span class="o">>=</span><span class="mi">145</span><span class="w"> </span><span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="w"> </span><span class="n">intb</span><span class="o"><=</span><span class="mi">153</span><span class="w"> </span><span class="p">.</span><span class="nb">or</span><span class="p">.</span><span class="n">intb</span><span class="o">>=</span><span class="mi">162</span><span class="w"> </span><span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="w"> </span><span class="p">&</span>
<a id="ln-80" name="ln-80" href="#ln-80"></a><span class="w"> </span><span class="n">intb</span><span class="o"><=</span><span class="mi">169</span><span class="p">)</span><span class="w"> </span><span class="n">intb</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">intb</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">64</span>
<a id="ln-81" name="ln-81" href="#ln-81"></a><span class="w"> </span><span class="k">else if</span><span class="w"> </span><span class="p">(</span><span class="n">zcode</span><span class="o">==</span><span class="mi">218</span><span class="w"> </span><span class="p">.</span><span class="nb">or</span><span class="p">.</span><span class="w"> </span><span class="n">zcode</span><span class="o">==</span><span class="mi">250</span><span class="p">)</span><span class="w"> </span><span class="k">then</span>
<a id="ln-82" name="ln-82" href="#ln-82"></a><span class="w"> </span><span class="c">! ascii is assumed, on prime machines - zcode is the ascii code</span>
<a id="ln-83" name="ln-83" href="#ln-83"></a><span class="w"> </span><span class="c">! plus 128 of either lower or upper case 'z'.</span>
<a id="ln-84" name="ln-84" href="#ln-84"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">inta</span><span class="o">>=</span><span class="mi">225</span><span class="w"> </span><span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="w"> </span><span class="n">inta</span><span class="o"><=</span><span class="mi">250</span><span class="p">)</span><span class="w"> </span><span class="n">inta</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">inta</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">32</span>
<a id="ln-85" name="ln-85" href="#ln-85"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">intb</span><span class="o">>=</span><span class="mi">225</span><span class="w"> </span><span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="w"> </span><span class="n">intb</span><span class="o"><=</span><span class="mi">250</span><span class="p">)</span><span class="w"> </span><span class="n">intb</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">intb</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">32</span>
<a id="ln-86" name="ln-86" href="#ln-86"></a><span class="w"> </span><span class="k">end if</span>
<a id="ln-87" name="ln-87" href="#ln-87"></a><span class="k"> </span><span class="n">stdlib_lsame</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">inta</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">intb</span>
<a id="ln-88" name="ln-88" href="#ln-88"></a><span class="w"> </span><span class="c">! return</span>
<a id="ln-89" name="ln-89" href="#ln-89"></a><span class="w"> </span><span class="k">end function </span><span class="n">stdlib_lsame</span>
<a id="ln-90" name="ln-90" href="#ln-90"></a>
<a id="ln-91" name="ln-91" href="#ln-91"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="n">for</span><span class="w"> </span><span class="n">ik</span><span class="p">,</span><span class="n">it</span><span class="p">,</span><span class="n">ii</span><span class="w"> </span><span class="n">in</span><span class="w"> </span><span class="n">LINALG_INT_KINDS_TYPES</span>
<a id="ln-92" name="ln-92" href="#ln-92"></a><span class="w"> </span><span class="k">pure subroutine </span><span class="n">stdlib$</span><span class="err">{</span><span class="n">ii</span><span class="err">}$_</span><span class="n">xerbla</span><span class="p">(</span><span class="w"> </span><span class="n">srname</span><span class="p">,</span><span class="w"> </span><span class="n">info</span><span class="w"> </span><span class="p">)</span>
<a id="ln-93" name="ln-93" href="#ln-93"></a><span class="w"> </span><span class="c">!! XERBLA is an error handler for the LAPACK routines.</span>
<a id="ln-94" name="ln-94" href="#ln-94"></a><span class="w"> </span><span class="c">!! It is called by an LAPACK routine if an input parameter has an</span>
<a id="ln-95" name="ln-95" href="#ln-95"></a><span class="w"> </span><span class="c">!! invalid value. A message is printed and execution stops.</span>
<a id="ln-96" name="ln-96" href="#ln-96"></a><span class="w"> </span><span class="c">!! Installers may consider modifying the STOP statement in order to</span>
<a id="ln-97" name="ln-97" href="#ln-97"></a><span class="w"> </span><span class="c">!! call system-specific exception-handling facilities.</span>
<a id="ln-98" name="ln-98" href="#ln-98"></a><span class="w"> </span><span class="c">! -- reference blas level1 routine --</span>
<a id="ln-99" name="ln-99" href="#ln-99"></a><span class="w"> </span><span class="c">! -- reference blas is a software package provided by univ. of tennessee, --</span>
<a id="ln-100" name="ln-100" href="#ln-100"></a><span class="w"> </span><span class="c">! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--</span>
<a id="ln-101" name="ln-101" href="#ln-101"></a><span class="w"> </span><span class="c">! Scalar Arguments </span>
<a id="ln-102" name="ln-102" href="#ln-102"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=*</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">srname</span>
<a id="ln-103" name="ln-103" href="#ln-103"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="err">${</span><span class="n">ik</span><span class="err">}$</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">info</span>
<a id="ln-104" name="ln-104" href="#ln-104"></a><span class="w"> </span><span class="c">! =====================================================================</span>
<a id="ln-105" name="ln-105" href="#ln-105"></a><span class="w"> </span><span class="c">! Intrinsic Functions </span>
<a id="ln-106" name="ln-106" href="#ln-106"></a><span class="w"> </span><span class="k">intrinsic</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="nb">len_trim</span>
<a id="ln-107" name="ln-107" href="#ln-107"></a><span class="w"> </span><span class="c">! Executable Statements </span>
<a id="ln-108" name="ln-108" href="#ln-108"></a><span class="w"> </span><span class="mi">9999</span><span class="w"> </span><span class="k">format</span><span class="p">(</span><span class="w"> </span><span class="s1">' ** ON ENTRY TO '</span><span class="p">,</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="s1">' PARAMETER NUMBER '</span><span class="p">,</span><span class="w"> </span><span class="n">i2</span><span class="p">,</span><span class="w"> </span><span class="s1">' HAD '</span><span class="p">,</span><span class="s1">'AN ILLEGAL VALUE'</span><span class="w"> </span><span class="p">)</span>
<a id="ln-109" name="ln-109" href="#ln-109"></a><span class="w"> </span>
<a id="ln-110" name="ln-110" href="#ln-110"></a><span class="w"> </span><span class="k">end subroutine </span><span class="n">stdlib$</span><span class="err">{</span><span class="n">ii</span><span class="err">}$_</span><span class="n">xerbla</span>
<a id="ln-111" name="ln-111" href="#ln-111"></a>
<a id="ln-112" name="ln-112" href="#ln-112"></a>
<a id="ln-113" name="ln-113" href="#ln-113"></a><span class="w"> </span><span class="k">pure subroutine </span><span class="n">stdlib$</span><span class="err">{</span><span class="n">ii</span><span class="err">}$_</span><span class="n">xerbla_array</span><span class="p">(</span><span class="n">srname_array</span><span class="p">,</span><span class="w"> </span><span class="n">srname_len</span><span class="p">,</span><span class="w"> </span><span class="n">info</span><span class="p">)</span>
<a id="ln-114" name="ln-114" href="#ln-114"></a><span class="w"> </span><span class="c">!! XERBLA_ARRAY assists other languages in calling XERBLA, the LAPACK</span>
<a id="ln-115" name="ln-115" href="#ln-115"></a><span class="w"> </span><span class="c">!! and BLAS error handler. Rather than taking a Fortran string argument</span>
<a id="ln-116" name="ln-116" href="#ln-116"></a><span class="w"> </span><span class="c">!! as the function's name, XERBLA_ARRAY takes an array of single</span>
<a id="ln-117" name="ln-117" href="#ln-117"></a><span class="w"> </span><span class="c">!! characters along with the array's length. XERBLA_ARRAY then copies</span>
<a id="ln-118" name="ln-118" href="#ln-118"></a><span class="w"> </span><span class="c">!! up to 32 characters of that array into a Fortran string and passes</span>
<a id="ln-119" name="ln-119" href="#ln-119"></a><span class="w"> </span><span class="c">!! that to XERBLA. If called with a non-positive SRNAME_LEN,</span>
<a id="ln-120" name="ln-120" href="#ln-120"></a><span class="w"> </span><span class="c">!! XERBLA_ARRAY will call XERBLA with a string of all blank characters.</span>
<a id="ln-121" name="ln-121" href="#ln-121"></a><span class="w"> </span><span class="c">!! Say some macro or other device makes XERBLA_ARRAY available to C99</span>
<a id="ln-122" name="ln-122" href="#ln-122"></a><span class="w"> </span><span class="c">!! by a name lapack_xerbla and with a common Fortran calling convention.</span>
<a id="ln-123" name="ln-123" href="#ln-123"></a><span class="w"> </span><span class="c">!! Then a C99 program could invoke XERBLA via:</span>
<a id="ln-124" name="ln-124" href="#ln-124"></a><span class="w"> </span><span class="c">!! {</span>
<a id="ln-125" name="ln-125" href="#ln-125"></a><span class="w"> </span><span class="c">!! int flen = strlen(__func__);</span>
<a id="ln-126" name="ln-126" href="#ln-126"></a><span class="w"> </span><span class="c">!! lapack_xerbla(__func__,</span>
<a id="ln-127" name="ln-127" href="#ln-127"></a><span class="w"> </span><span class="c">!! }</span>
<a id="ln-128" name="ln-128" href="#ln-128"></a><span class="w"> </span><span class="c">!! Providing XERBLA_ARRAY is not necessary for intercepting LAPACK</span>
<a id="ln-129" name="ln-129" href="#ln-129"></a><span class="w"> </span><span class="c">!! errors. XERBLA_ARRAY calls XERBLA.</span>
<a id="ln-130" name="ln-130" href="#ln-130"></a><span class="w"> </span><span class="c">! -- reference blas level1 routine --</span>
<a id="ln-131" name="ln-131" href="#ln-131"></a><span class="w"> </span><span class="c">! -- reference blas is a software package provided by univ. of tennessee, --</span>
<a id="ln-132" name="ln-132" href="#ln-132"></a><span class="w"> </span><span class="c">! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--</span>
<a id="ln-133" name="ln-133" href="#ln-133"></a><span class="w"> </span><span class="c">! Scalar Arguments </span>
<a id="ln-134" name="ln-134" href="#ln-134"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="err">${</span><span class="n">ik</span><span class="err">}$</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">srname_len</span><span class="p">,</span><span class="w"> </span><span class="n">info</span>
<a id="ln-135" name="ln-135" href="#ln-135"></a><span class="w"> </span><span class="c">! Array Arguments </span>
<a id="ln-136" name="ln-136" href="#ln-136"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">srname_array</span><span class="p">(</span><span class="n">srname_len</span><span class="p">)</span>
<a id="ln-137" name="ln-137" href="#ln-137"></a><span class="w"> </span><span class="c">! =====================================================================</span>
<a id="ln-138" name="ln-138" href="#ln-138"></a><span class="w"> </span><span class="c">! Local Scalars </span>
<a id="ln-139" name="ln-139" href="#ln-139"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="err">${</span><span class="n">ik</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">i</span>
<a id="ln-140" name="ln-140" href="#ln-140"></a><span class="w"> </span><span class="c">! Local Arrays </span>
<a id="ln-141" name="ln-141" href="#ln-141"></a><span class="w"> </span><span class="kt">character</span><span class="o">*</span><span class="mi">32</span><span class="w"> </span><span class="n">srname</span>
<a id="ln-142" name="ln-142" href="#ln-142"></a><span class="w"> </span><span class="c">! Intrinsic Functions </span>
<a id="ln-143" name="ln-143" href="#ln-143"></a><span class="w"> </span><span class="k">intrinsic</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="nb">min</span><span class="p">,</span><span class="nb">len</span>
<a id="ln-144" name="ln-144" href="#ln-144"></a><span class="w"> </span><span class="c">! Executable Statements </span>
<a id="ln-145" name="ln-145" href="#ln-145"></a><span class="w"> </span><span class="n">srname</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">''</span>
<a id="ln-146" name="ln-146" href="#ln-146"></a><span class="w"> </span><span class="k">do </span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="nb">min</span><span class="p">(</span><span class="w"> </span><span class="n">srname_len</span><span class="p">,</span><span class="w"> </span><span class="nb">len</span><span class="p">(</span><span class="w"> </span><span class="n">srname</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">)</span>
<a id="ln-147" name="ln-147" href="#ln-147"></a><span class="w"> </span><span class="n">srname</span><span class="p">(</span><span class="w"> </span><span class="n">i</span><span class="p">:</span><span class="n">i</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">srname_array</span><span class="p">(</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="p">)</span>
<a id="ln-148" name="ln-148" href="#ln-148"></a><span class="w"> </span><span class="k">end do</span>
<a id="ln-149" name="ln-149" href="#ln-149"></a><span class="k"> call </span><span class="n">stdlib$</span><span class="err">{</span><span class="n">ii</span><span class="err">}$_</span><span class="n">xerbla</span><span class="p">(</span><span class="w"> </span><span class="n">srname</span><span class="p">,</span><span class="w"> </span><span class="n">info</span><span class="w"> </span><span class="p">)</span>
<a id="ln-150" name="ln-150" href="#ln-150"></a><span class="w"> </span><span class="k">return</span>
<a id="ln-151" name="ln-151" href="#ln-151"></a><span class="k"> end subroutine </span><span class="n">stdlib$</span><span class="err">{</span><span class="n">ii</span><span class="err">}$_</span><span class="n">xerbla_array</span>
<a id="ln-152" name="ln-152" href="#ln-152"></a>
<a id="ln-153" name="ln-153" href="#ln-153"></a><span class="cp">#:for rk,rt,ri in REAL_KINDS_TYPES</span>
<a id="ln-154" name="ln-154" href="#ln-154"></a><span class="w"> </span><span class="k">pure </span><span class="kt">integer</span><span class="p">(</span><span class="err">${</span><span class="n">ik</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">stdlib$</span><span class="err">{</span><span class="n">ii</span><span class="err">}$_</span><span class="n">i$</span><span class="err">{</span><span class="n">ri</span><span class="err">}$</span><span class="nb">amax</span><span class="p">(</span><span class="n">n</span><span class="p">,</span><span class="n">dx</span><span class="p">,</span><span class="n">incx</span><span class="p">)</span><span class="w"> </span><span class="k">result</span><span class="p">(</span><span class="n">iamax</span><span class="p">)</span>
<a id="ln-155" name="ln-155" href="#ln-155"></a><span class="w"> </span><span class="c">!! IDAMAX: finds the index of the first element having maximum absolute value.</span>
<a id="ln-156" name="ln-156" href="#ln-156"></a><span class="w"> </span><span class="c">! -- reference blas level1 routine --</span>
<a id="ln-157" name="ln-157" href="#ln-157"></a><span class="w"> </span><span class="c">! -- reference blas is a software package provided by univ. of tennessee, --</span>
<a id="ln-158" name="ln-158" href="#ln-158"></a><span class="w"> </span><span class="c">! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--</span>
<a id="ln-159" name="ln-159" href="#ln-159"></a><span class="w"> </span><span class="c">! Scalar Arguments </span>
<a id="ln-160" name="ln-160" href="#ln-160"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="err">${</span><span class="n">ik</span><span class="err">}$</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">incx</span><span class="p">,</span><span class="w"> </span><span class="n">n</span>
<a id="ln-161" name="ln-161" href="#ln-161"></a><span class="w"> </span><span class="c">! Array Arguments </span>
<a id="ln-162" name="ln-162" href="#ln-162"></a><span class="w"> </span><span class="kt">real</span><span class="p">(</span><span class="err">${</span><span class="n">rk</span><span class="err">}$</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">dx</span><span class="p">(</span><span class="o">*</span><span class="p">)</span>
<a id="ln-163" name="ln-163" href="#ln-163"></a><span class="w"> </span><span class="c">! =====================================================================</span>
<a id="ln-164" name="ln-164" href="#ln-164"></a><span class="w"> </span><span class="c">! Local Scalars </span>
<a id="ln-165" name="ln-165" href="#ln-165"></a><span class="w"> </span><span class="kt">real</span><span class="p">(</span><span class="err">${</span><span class="n">rk</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="nb">dmax</span>
<a id="ln-166" name="ln-166" href="#ln-166"></a><span class="nb"> </span><span class="kt">integer</span><span class="p">(</span><span class="err">${</span><span class="n">ik</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="n">ix</span>
<a id="ln-167" name="ln-167" href="#ln-167"></a><span class="w"> </span><span class="c">! Intrinsic Functions </span>
<a id="ln-168" name="ln-168" href="#ln-168"></a><span class="w"> </span><span class="k">intrinsic</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="nb">abs</span>
<a id="ln-169" name="ln-169" href="#ln-169"></a><span class="nb"> </span><span class="n">iamax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span>
<a id="ln-170" name="ln-170" href="#ln-170"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">n</span><span class="o"><</span><span class="mi">1</span><span class="w"> </span><span class="p">.</span><span class="nb">or</span><span class="p">.</span><span class="w"> </span><span class="n">incx</span><span class="o"><=</span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="k">return</span>
<a id="ln-171" name="ln-171" href="#ln-171"></a><span class="k"> </span><span class="n">iamax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span>
<a id="ln-172" name="ln-172" href="#ln-172"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">n</span><span class="o">==</span><span class="mi">1</span><span class="p">)</span><span class="w"> </span><span class="k">return</span>
<a id="ln-173" name="ln-173" href="#ln-173"></a><span class="k"> if</span><span class="w"> </span><span class="p">(</span><span class="n">incx</span><span class="o">==</span><span class="mi">1</span><span class="p">)</span><span class="w"> </span><span class="k">then</span>
<a id="ln-174" name="ln-174" href="#ln-174"></a><span class="w"> </span><span class="c">! code for increment equal to 1</span>
<a id="ln-175" name="ln-175" href="#ln-175"></a><span class="w"> </span><span class="nb">dmax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">abs</span><span class="p">(</span><span class="n">dx</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span>
<a id="ln-176" name="ln-176" href="#ln-176"></a><span class="w"> </span><span class="k">do </span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="n">n</span>
<a id="ln-177" name="ln-177" href="#ln-177"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="nb">abs</span><span class="p">(</span><span class="n">dx</span><span class="p">(</span><span class="n">i</span><span class="p">))</span><span class="o">></span><span class="nb">dmax</span><span class="p">)</span><span class="w"> </span><span class="k">then</span>
<a id="ln-178" name="ln-178" href="#ln-178"></a><span class="k"> </span><span class="n">iamax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">i</span>
<a id="ln-179" name="ln-179" href="#ln-179"></a><span class="w"> </span><span class="nb">dmax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">abs</span><span class="p">(</span><span class="n">dx</span><span class="p">(</span><span class="n">i</span><span class="p">))</span>
<a id="ln-180" name="ln-180" href="#ln-180"></a><span class="w"> </span><span class="k">end if</span>
<a id="ln-181" name="ln-181" href="#ln-181"></a><span class="k"> end do</span>
<a id="ln-182" name="ln-182" href="#ln-182"></a><span class="k"> else</span>
<a id="ln-183" name="ln-183" href="#ln-183"></a><span class="w"> </span><span class="c">! code for increment not equal to 1</span>
<a id="ln-184" name="ln-184" href="#ln-184"></a><span class="w"> </span><span class="n">ix</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span>
<a id="ln-185" name="ln-185" href="#ln-185"></a><span class="w"> </span><span class="nb">dmax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">abs</span><span class="p">(</span><span class="n">dx</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span>
<a id="ln-186" name="ln-186" href="#ln-186"></a><span class="w"> </span><span class="n">ix</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ix</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">incx</span>
<a id="ln-187" name="ln-187" href="#ln-187"></a><span class="w"> </span><span class="k">do </span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="n">n</span>
<a id="ln-188" name="ln-188" href="#ln-188"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="nb">abs</span><span class="p">(</span><span class="n">dx</span><span class="p">(</span><span class="n">ix</span><span class="p">))</span><span class="o">></span><span class="nb">dmax</span><span class="p">)</span><span class="w"> </span><span class="k">then</span>
<a id="ln-189" name="ln-189" href="#ln-189"></a><span class="k"> </span><span class="n">iamax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">i</span>
<a id="ln-190" name="ln-190" href="#ln-190"></a><span class="w"> </span><span class="nb">dmax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">abs</span><span class="p">(</span><span class="n">dx</span><span class="p">(</span><span class="n">ix</span><span class="p">))</span>
<a id="ln-191" name="ln-191" href="#ln-191"></a><span class="w"> </span><span class="k">end if</span>
<a id="ln-192" name="ln-192" href="#ln-192"></a><span class="k"> </span><span class="n">ix</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ix</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">incx</span>
<a id="ln-193" name="ln-193" href="#ln-193"></a><span class="w"> </span><span class="k">end do</span>
<a id="ln-194" name="ln-194" href="#ln-194"></a><span class="k"> end if</span>
<a id="ln-195" name="ln-195" href="#ln-195"></a><span class="k"> return</span>
<a id="ln-196" name="ln-196" href="#ln-196"></a><span class="k"> end function </span><span class="n">stdlib$</span><span class="err">{</span><span class="n">ii</span><span class="err">}$_</span><span class="n">i$</span><span class="err">{</span><span class="n">ri</span><span class="err">}$</span><span class="nb">amax</span>
<a id="ln-197" name="ln-197" href="#ln-197"></a><span class="w"> </span>
<a id="ln-198" name="ln-198" href="#ln-198"></a><span class="cp">#:endfor</span>
<a id="ln-199" name="ln-199" href="#ln-199"></a><span class="cp">#:for ck,ct,ci in CMPLX_KINDS_TYPES</span>
<a id="ln-200" name="ln-200" href="#ln-200"></a><span class="w"> </span><span class="k">pure </span><span class="kt">integer</span><span class="p">(</span><span class="err">${</span><span class="n">ik</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">stdlib$</span><span class="err">{</span><span class="n">ii</span><span class="err">}$_</span><span class="n">i$</span><span class="err">{</span><span class="n">ci</span><span class="err">}$</span><span class="nb">amax</span><span class="p">(</span><span class="n">n</span><span class="p">,</span><span class="n">zx</span><span class="p">,</span><span class="n">incx</span><span class="p">)</span><span class="w"> </span><span class="k">result</span><span class="p">(</span><span class="n">iamax</span><span class="p">)</span>
<a id="ln-201" name="ln-201" href="#ln-201"></a><span class="w"> </span><span class="c">!! IZAMAX: finds the index of the first element having maximum |Re(.)| + |Im(.)|</span>
<a id="ln-202" name="ln-202" href="#ln-202"></a><span class="w"> </span><span class="c">! -- reference blas level1 routine --</span>
<a id="ln-203" name="ln-203" href="#ln-203"></a><span class="w"> </span><span class="c">! -- reference blas is a software package provided by univ. of tennessee, --</span>
<a id="ln-204" name="ln-204" href="#ln-204"></a><span class="w"> </span><span class="c">! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--</span>
<a id="ln-205" name="ln-205" href="#ln-205"></a><span class="w"> </span><span class="c">! Scalar Arguments </span>
<a id="ln-206" name="ln-206" href="#ln-206"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="err">${</span><span class="n">ik</span><span class="err">}$</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">incx</span><span class="p">,</span><span class="w"> </span><span class="n">n</span>
<a id="ln-207" name="ln-207" href="#ln-207"></a><span class="w"> </span><span class="c">! Array Arguments </span>
<a id="ln-208" name="ln-208" href="#ln-208"></a><span class="w"> </span><span class="kt">complex</span><span class="p">(</span><span class="err">${</span><span class="n">ck</span><span class="err">}$</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">zx</span><span class="p">(</span><span class="o">*</span><span class="p">)</span>
<a id="ln-209" name="ln-209" href="#ln-209"></a><span class="w"> </span><span class="c">! =====================================================================</span>
<a id="ln-210" name="ln-210" href="#ln-210"></a><span class="w"> </span><span class="c">! Local Scalars </span>
<a id="ln-211" name="ln-211" href="#ln-211"></a><span class="w"> </span><span class="kt">real</span><span class="p">(</span><span class="err">${</span><span class="n">ck</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="nb">dmax</span>
<a id="ln-212" name="ln-212" href="#ln-212"></a><span class="nb"> </span><span class="kt">integer</span><span class="p">(</span><span class="err">${</span><span class="n">ik</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="n">ix</span>
<a id="ln-213" name="ln-213" href="#ln-213"></a><span class="w"> </span><span class="n">iamax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span>
<a id="ln-214" name="ln-214" href="#ln-214"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">n</span><span class="o"><</span><span class="mi">1</span><span class="w"> </span><span class="p">.</span><span class="nb">or</span><span class="p">.</span><span class="w"> </span><span class="n">incx</span><span class="o"><=</span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="k">return</span>
<a id="ln-215" name="ln-215" href="#ln-215"></a><span class="k"> </span><span class="n">iamax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span>
<a id="ln-216" name="ln-216" href="#ln-216"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">n</span><span class="o">==</span><span class="mi">1</span><span class="p">)</span><span class="w"> </span><span class="k">return</span>
<a id="ln-217" name="ln-217" href="#ln-217"></a><span class="k"> if</span><span class="w"> </span><span class="p">(</span><span class="n">incx</span><span class="o">==</span><span class="mi">1</span><span class="p">)</span><span class="w"> </span><span class="k">then</span>
<a id="ln-218" name="ln-218" href="#ln-218"></a><span class="w"> </span><span class="c">! code for increment equal to 1</span>
<a id="ln-219" name="ln-219" href="#ln-219"></a><span class="w"> </span><span class="nb">dmax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">stdlib_cabs1</span><span class="p">(</span><span class="n">zx</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span>
<a id="ln-220" name="ln-220" href="#ln-220"></a><span class="w"> </span><span class="k">do </span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="n">n</span>
<a id="ln-221" name="ln-221" href="#ln-221"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">stdlib_cabs1</span><span class="p">(</span><span class="n">zx</span><span class="p">(</span><span class="n">i</span><span class="p">))</span><span class="o">></span><span class="nb">dmax</span><span class="p">)</span><span class="w"> </span><span class="k">then</span>
<a id="ln-222" name="ln-222" href="#ln-222"></a><span class="k"> </span><span class="n">iamax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">i</span>
<a id="ln-223" name="ln-223" href="#ln-223"></a><span class="w"> </span><span class="nb">dmax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">stdlib_cabs1</span><span class="p">(</span><span class="n">zx</span><span class="p">(</span><span class="n">i</span><span class="p">))</span>
<a id="ln-224" name="ln-224" href="#ln-224"></a><span class="w"> </span><span class="k">end if</span>
<a id="ln-225" name="ln-225" href="#ln-225"></a><span class="k"> end do</span>
<a id="ln-226" name="ln-226" href="#ln-226"></a><span class="k"> else</span>
<a id="ln-227" name="ln-227" href="#ln-227"></a><span class="w"> </span><span class="c">! code for increment not equal to 1</span>
<a id="ln-228" name="ln-228" href="#ln-228"></a><span class="w"> </span><span class="n">ix</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span>
<a id="ln-229" name="ln-229" href="#ln-229"></a><span class="w"> </span><span class="nb">dmax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">stdlib_cabs1</span><span class="p">(</span><span class="n">zx</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span>
<a id="ln-230" name="ln-230" href="#ln-230"></a><span class="w"> </span><span class="n">ix</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ix</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">incx</span>
<a id="ln-231" name="ln-231" href="#ln-231"></a><span class="w"> </span><span class="k">do </span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="n">n</span>
<a id="ln-232" name="ln-232" href="#ln-232"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">stdlib_cabs1</span><span class="p">(</span><span class="n">zx</span><span class="p">(</span><span class="n">ix</span><span class="p">))</span><span class="o">></span><span class="nb">dmax</span><span class="p">)</span><span class="w"> </span><span class="k">then</span>
<a id="ln-233" name="ln-233" href="#ln-233"></a><span class="k"> </span><span class="n">iamax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">i</span>
<a id="ln-234" name="ln-234" href="#ln-234"></a><span class="w"> </span><span class="nb">dmax</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">stdlib_cabs1</span><span class="p">(</span><span class="n">zx</span><span class="p">(</span><span class="n">ix</span><span class="p">))</span>
<a id="ln-235" name="ln-235" href="#ln-235"></a><span class="w"> </span><span class="k">end if</span>
<a id="ln-236" name="ln-236" href="#ln-236"></a><span class="k"> </span><span class="n">ix</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ix</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">incx</span>
<a id="ln-237" name="ln-237" href="#ln-237"></a><span class="w"> </span><span class="k">end do</span>
<a id="ln-238" name="ln-238" href="#ln-238"></a><span class="k"> end if</span>
<a id="ln-239" name="ln-239" href="#ln-239"></a><span class="k"> return</span>
<a id="ln-240" name="ln-240" href="#ln-240"></a><span class="k"> end function </span><span class="n">stdlib$</span><span class="err">{</span><span class="n">ii</span><span class="err">}$_</span><span class="n">i$</span><span class="err">{</span><span class="n">ci</span><span class="err">}$</span><span class="nb">amax</span>
<a id="ln-241" name="ln-241" href="#ln-241"></a><span class="w"> </span>
<a id="ln-242" name="ln-242" href="#ln-242"></a><span class="cp">#:endfor</span>
<a id="ln-243" name="ln-243" href="#ln-243"></a><span class="cp">#:endfor</span>
<a id="ln-244" name="ln-244" href="#ln-244"></a>
<a id="ln-245" name="ln-245" href="#ln-245"></a><span class="k">end module </span><span class="n">stdlib_linalg_blas_aux</span>
</pre></div>
</section>
</div>
</div>
<hr>
</div> <!-- /container -->
<footer>
<div class="container">
<div class="row justify-content-between">
<div class="col"><p>Fortran-lang/stdlib was developed by fortran-lang/stdlib contributors<br>© 2025 <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/80x15.png" /></a>
<br /><small>def840da</small></p>
</div>
<div class="col">
<p class="text-end">
Documentation generated by
<a href="https://github.com/Fortran-FOSS-Programmers/ford">FORD</a>
on 2025-04-03 06:18 </p>
</div>
</div>
<br>
</div> <!-- /container -->
</footer>
<!-- Bootstrap core JavaScript -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<!-- MathJax JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'AMS' } },
jax: ['input/TeX','input/MathML','output/HTML-CSS'],
extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script src="../tipuesearch/tipuesearch_content.js"></script>
<script src="../tipuesearch/tipuesearch_set.js"></script>
<script src="../tipuesearch/tipuesearch.js"></script>
</body>
</html>