File: zlasr.c

package info (click to toggle)
libflame 5.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 162,052 kB
  • sloc: ansic: 750,080; fortran: 404,344; makefile: 8,133; sh: 5,458; python: 937; pascal: 144; perl: 66
file content (827 lines) | stat: -rw-r--r-- 32,869 bytes parent folder | download | duplicates (3)
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
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
/* ../netlib/zlasr.f -- translated by f2c (version 20100827). You must link the resulting object file with libf2c: on Microsoft Windows system, link with libf2c.lib;
 on Linux or Unix systems, link with .../path/to/libf2c.a -lm or, if you install libf2c.a in a standard place, with -lf2c -lm -- in that order, at the end of the command line, as in cc *.o -lf2c -lm Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., http://www.netlib.org/f2c/libf2c.zip */
#include "FLA_f2c.h" /* > \brief \b ZLASR applies a sequence of plane rotations to a general rectangular matrix. */
/* =========== DOCUMENTATION =========== */
/* Online html documentation available at */
/* http://www.netlib.org/lapack/explore-html/ */
/* > \htmlonly */
/* > Download ZLASR + dependencies */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlasr.f "> */
/* > [TGZ]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlasr.f "> */
/* > [ZIP]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlasr.f "> */
/* > [TXT]</a> */
/* > \endhtmlonly */
/* Definition: */
/* =========== */
/* SUBROUTINE ZLASR( SIDE, PIVOT, DIRECT, M, N, C, S, A, LDA ) */
/* .. Scalar Arguments .. */
/* CHARACTER DIRECT, PIVOT, SIDE */
/* INTEGER LDA, M, N */
/* .. */
/* .. Array Arguments .. */
/* DOUBLE PRECISION C( * ), S( * ) */
/* COMPLEX*16 A( LDA, * ) */
/* .. */
/* > \par Purpose: */
/* ============= */
/* > */
/* > \verbatim */
/* > */
/* > ZLASR applies a sequence of real plane rotations to a complex matrix */
/* > A, from either the left or the right. */
/* > */
/* > When SIDE = 'L', the transformation takes the form */
/* > */
/* > A := P*A */
/* > */
/* > and when SIDE = 'R', the transformation takes the form */
/* > */
/* > A := A*P**T */
/* > */
/* > where P is an orthogonal matrix consisting of a sequence of z plane */
/* > rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R', */
/* > and P**T is the transpose of P. */
/* > */
/* > When DIRECT = 'F' (Forward sequence), then */
/* > */
/* > P = P(z-1) * ... * P(2) * P(1) */
/* > */
/* > and when DIRECT = 'B' (Backward sequence), then */
/* > */
/* > P = P(1) * P(2) * ... * P(z-1) */
/* > */
/* > where P(k) is a plane rotation matrix defined by the 2-by-2 rotation */
/* > */
/* > R(k) = ( c(k) s(k) ) */
/* > = ( -s(k) c(k) ). */
/* > */
/* > When PIVOT = 'V' (Variable pivot), the rotation is performed */
/* > for the plane (k,k+1), i.e., P(k) has the form */
/* > */
/* > P(k) = ( 1 ) */
/* > ( ... ) */
/* > ( 1 ) */
/* > ( c(k) s(k) ) */
/* > ( -s(k) c(k) ) */
/* > ( 1 ) */
/* > ( ... ) */
/* > ( 1 ) */
/* > */
/* > where R(k) appears as a rank-2 modification to the identity matrix in */
/* > rows and columns k and k+1. */
/* > */
/* > When PIVOT = 'T' (Top pivot), the rotation is performed for the */
/* > plane (1,k+1), so P(k) has the form */
/* > */
/* > P(k) = ( c(k) s(k) ) */
/* > ( 1 ) */
/* > ( ... ) */
/* > ( 1 ) */
/* > ( -s(k) c(k) ) */
/* > ( 1 ) */
/* > ( ... ) */
/* > ( 1 ) */
/* > */
/* > where R(k) appears in rows and columns 1 and k+1. */
/* > */
/* > Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is */
/* > performed for the plane (k,z), giving P(k) the form */
/* > */
/* > P(k) = ( 1 ) */
/* > ( ... ) */
/* > ( 1 ) */
/* > ( c(k) s(k) ) */
/* > ( 1 ) */
/* > ( ... ) */
/* > ( 1 ) */
/* > ( -s(k) c(k) ) */
/* > */
/* > where R(k) appears in rows and columns k and z. The rotations are */
/* > performed without ever forming P(k) explicitly. */
/* > \endverbatim */
/* Arguments: */
/* ========== */
/* > \param[in] SIDE */
/* > \verbatim */
/* > SIDE is CHARACTER*1 */
/* > Specifies whether the plane rotation matrix P is applied to */
/* > A on the left or the right. */
/* > = 'L': Left, compute A := P*A */
/* > = 'R': Right, compute A:= A*P**T */
/* > \endverbatim */
/* > */
/* > \param[in] PIVOT */
/* > \verbatim */
/* > PIVOT is CHARACTER*1 */
/* > Specifies the plane for which P(k) is a plane rotation */
/* > matrix. */
/* > = 'V': Variable pivot, the plane (k,k+1) */
/* > = 'T': Top pivot, the plane (1,k+1) */
/* > = 'B': Bottom pivot, the plane (k,z) */
/* > \endverbatim */
/* > */
/* > \param[in] DIRECT */
/* > \verbatim */
/* > DIRECT is CHARACTER*1 */
/* > Specifies whether P is a forward or backward sequence of */
/* > plane rotations. */
/* > = 'F': Forward, P = P(z-1)*...*P(2)*P(1) */
/* > = 'B': Backward, P = P(1)*P(2)*...*P(z-1) */
/* > \endverbatim */
/* > */
/* > \param[in] M */
/* > \verbatim */
/* > M is INTEGER */
/* > The number of rows of the matrix A. If m <= 1, an immediate */
/* > return is effected. */
/* > \endverbatim */
/* > */
/* > \param[in] N */
/* > \verbatim */
/* > N is INTEGER */
/* > The number of columns of the matrix A. If n <= 1, an */
/* > immediate return is effected. */
/* > \endverbatim */
/* > */
/* > \param[in] C */
/* > \verbatim */
/* > C is DOUBLE PRECISION array, dimension */
/* > (M-1) if SIDE = 'L' */
/* > (N-1) if SIDE = 'R' */
/* > The cosines c(k) of the plane rotations. */
/* > \endverbatim */
/* > */
/* > \param[in] S */
/* > \verbatim */
/* > S is DOUBLE PRECISION array, dimension */
/* > (M-1) if SIDE = 'L' */
/* > (N-1) if SIDE = 'R' */
/* > The sines s(k) of the plane rotations. The 2-by-2 plane */
/* > rotation part of the matrix P(k), R(k), has the form */
/* > R(k) = ( c(k) s(k) ) */
/* > ( -s(k) c(k) ). */
/* > \endverbatim */
/* > */
/* > \param[in,out] A */
/* > \verbatim */
/* > A is COMPLEX*16 array, dimension (LDA,N) */
/* > The M-by-N matrix A. On exit, A is overwritten by P*A if */
/* > SIDE = 'R' or by A*P**T if SIDE = 'L'. */
/* > \endverbatim */
/* > */
/* > \param[in] LDA */
/* > \verbatim */
/* > LDA is INTEGER */
/* > The leading dimension of the array A. LDA >= max(1,M). */
/* > \endverbatim */
/* Authors: */
/* ======== */
/* > \author Univ. of Tennessee */
/* > \author Univ. of California Berkeley */
/* > \author Univ. of Colorado Denver */
/* > \author NAG Ltd. */
/* > \date September 2012 */
/* > \ingroup complex16OTHERauxiliary */
/* ===================================================================== */
/* Subroutine */
int zlasr_(char *side, char *pivot, char *direct, integer *m, integer *n, doublereal *c__, doublereal *s, doublecomplex *a, integer *lda)
{
    /* System generated locals */
    integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
    doublecomplex z__1, z__2, z__3;
    /* Local variables */
    integer i__, j, info;
    doublecomplex temp;
    extern logical lsame_(char *, char *);
    doublereal ctemp, stemp;
    extern /* Subroutine */
    int xerbla_(char *, integer *);
    /* -- LAPACK auxiliary routine (version 3.4.2) -- */
    /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
    /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
    /* September 2012 */
    /* .. Scalar Arguments .. */
    /* .. */
    /* .. Array Arguments .. */
    /* .. */
    /* ===================================================================== */
    /* .. Parameters .. */
    /* .. */
    /* .. Local Scalars .. */
    /* .. */
    /* .. Intrinsic Functions .. */
    /* .. */
    /* .. External Functions .. */
    /* .. */
    /* .. External Subroutines .. */
    /* .. */
    /* .. Executable Statements .. */
    /* Test the input parameters */
    /* Parameter adjustments */
    --c__;
    --s;
    a_dim1 = *lda;
    a_offset = 1 + a_dim1;
    a -= a_offset;
    /* Function Body */
    info = 0;
    if (! (lsame_(side, "L") || lsame_(side, "R")))
    {
        info = 1;
    }
    else if (! (lsame_(pivot, "V") || lsame_(pivot, "T") || lsame_(pivot, "B")))
    {
        info = 2;
    }
    else if (! (lsame_(direct, "F") || lsame_(direct, "B")))
    {
        info = 3;
    }
    else if (*m < 0)
    {
        info = 4;
    }
    else if (*n < 0)
    {
        info = 5;
    }
    else if (*lda < max(1,*m))
    {
        info = 9;
    }
    if (info != 0)
    {
        xerbla_("ZLASR ", &info);
        return 0;
    }
    /* Quick return if possible */
    if (*m == 0 || *n == 0)
    {
        return 0;
    }
    if (lsame_(side, "L"))
    {
        /* Form P * A */
        if (lsame_(pivot, "V"))
        {
            if (lsame_(direct, "F"))
            {
                i__1 = *m - 1;
                for (j = 1;
                        j <= i__1;
                        ++j)
                {
                    ctemp = c__[j];
                    stemp = s[j];
                    if (ctemp != 1. || stemp != 0.)
                    {
                        i__2 = *n;
                        for (i__ = 1;
                                i__ <= i__2;
                                ++i__)
                        {
                            i__3 = j + 1 + i__ * a_dim1;
                            temp.r = a[i__3].r;
                            temp.i = a[i__3].i; // , expr subst
                            i__3 = j + 1 + i__ * a_dim1;
                            z__2.r = ctemp * temp.r;
                            z__2.i = ctemp * temp.i; // , expr subst
                            i__4 = j + i__ * a_dim1;
                            z__3.r = stemp * a[i__4].r;
                            z__3.i = stemp * a[ i__4].i; // , expr subst
                            z__1.r = z__2.r - z__3.r;
                            z__1.i = z__2.i - z__3.i; // , expr subst
                            a[i__3].r = z__1.r;
                            a[i__3].i = z__1.i; // , expr subst
                            i__3 = j + i__ * a_dim1;
                            z__2.r = stemp * temp.r;
                            z__2.i = stemp * temp.i; // , expr subst
                            i__4 = j + i__ * a_dim1;
                            z__3.r = ctemp * a[i__4].r;
                            z__3.i = ctemp * a[ i__4].i; // , expr subst
                            z__1.r = z__2.r + z__3.r;
                            z__1.i = z__2.i + z__3.i; // , expr subst
                            a[i__3].r = z__1.r;
                            a[i__3].i = z__1.i; // , expr subst
                            /* L10: */
                        }
                    }
                    /* L20: */
                }
            }
            else if (lsame_(direct, "B"))
            {
                for (j = *m - 1;
                        j >= 1;
                        --j)
                {
                    ctemp = c__[j];
                    stemp = s[j];
                    if (ctemp != 1. || stemp != 0.)
                    {
                        i__1 = *n;
                        for (i__ = 1;
                                i__ <= i__1;
                                ++i__)
                        {
                            i__2 = j + 1 + i__ * a_dim1;
                            temp.r = a[i__2].r;
                            temp.i = a[i__2].i; // , expr subst
                            i__2 = j + 1 + i__ * a_dim1;
                            z__2.r = ctemp * temp.r;
                            z__2.i = ctemp * temp.i; // , expr subst
                            i__3 = j + i__ * a_dim1;
                            z__3.r = stemp * a[i__3].r;
                            z__3.i = stemp * a[ i__3].i; // , expr subst
                            z__1.r = z__2.r - z__3.r;
                            z__1.i = z__2.i - z__3.i; // , expr subst
                            a[i__2].r = z__1.r;
                            a[i__2].i = z__1.i; // , expr subst
                            i__2 = j + i__ * a_dim1;
                            z__2.r = stemp * temp.r;
                            z__2.i = stemp * temp.i; // , expr subst
                            i__3 = j + i__ * a_dim1;
                            z__3.r = ctemp * a[i__3].r;
                            z__3.i = ctemp * a[ i__3].i; // , expr subst
                            z__1.r = z__2.r + z__3.r;
                            z__1.i = z__2.i + z__3.i; // , expr subst
                            a[i__2].r = z__1.r;
                            a[i__2].i = z__1.i; // , expr subst
                            /* L30: */
                        }
                    }
                    /* L40: */
                }
            }
        }
        else if (lsame_(pivot, "T"))
        {
            if (lsame_(direct, "F"))
            {
                i__1 = *m;
                for (j = 2;
                        j <= i__1;
                        ++j)
                {
                    ctemp = c__[j - 1];
                    stemp = s[j - 1];
                    if (ctemp != 1. || stemp != 0.)
                    {
                        i__2 = *n;
                        for (i__ = 1;
                                i__ <= i__2;
                                ++i__)
                        {
                            i__3 = j + i__ * a_dim1;
                            temp.r = a[i__3].r;
                            temp.i = a[i__3].i; // , expr subst
                            i__3 = j + i__ * a_dim1;
                            z__2.r = ctemp * temp.r;
                            z__2.i = ctemp * temp.i; // , expr subst
                            i__4 = i__ * a_dim1 + 1;
                            z__3.r = stemp * a[i__4].r;
                            z__3.i = stemp * a[ i__4].i; // , expr subst
                            z__1.r = z__2.r - z__3.r;
                            z__1.i = z__2.i - z__3.i; // , expr subst
                            a[i__3].r = z__1.r;
                            a[i__3].i = z__1.i; // , expr subst
                            i__3 = i__ * a_dim1 + 1;
                            z__2.r = stemp * temp.r;
                            z__2.i = stemp * temp.i; // , expr subst
                            i__4 = i__ * a_dim1 + 1;
                            z__3.r = ctemp * a[i__4].r;
                            z__3.i = ctemp * a[ i__4].i; // , expr subst
                            z__1.r = z__2.r + z__3.r;
                            z__1.i = z__2.i + z__3.i; // , expr subst
                            a[i__3].r = z__1.r;
                            a[i__3].i = z__1.i; // , expr subst
                            /* L50: */
                        }
                    }
                    /* L60: */
                }
            }
            else if (lsame_(direct, "B"))
            {
                for (j = *m;
                        j >= 2;
                        --j)
                {
                    ctemp = c__[j - 1];
                    stemp = s[j - 1];
                    if (ctemp != 1. || stemp != 0.)
                    {
                        i__1 = *n;
                        for (i__ = 1;
                                i__ <= i__1;
                                ++i__)
                        {
                            i__2 = j + i__ * a_dim1;
                            temp.r = a[i__2].r;
                            temp.i = a[i__2].i; // , expr subst
                            i__2 = j + i__ * a_dim1;
                            z__2.r = ctemp * temp.r;
                            z__2.i = ctemp * temp.i; // , expr subst
                            i__3 = i__ * a_dim1 + 1;
                            z__3.r = stemp * a[i__3].r;
                            z__3.i = stemp * a[ i__3].i; // , expr subst
                            z__1.r = z__2.r - z__3.r;
                            z__1.i = z__2.i - z__3.i; // , expr subst
                            a[i__2].r = z__1.r;
                            a[i__2].i = z__1.i; // , expr subst
                            i__2 = i__ * a_dim1 + 1;
                            z__2.r = stemp * temp.r;
                            z__2.i = stemp * temp.i; // , expr subst
                            i__3 = i__ * a_dim1 + 1;
                            z__3.r = ctemp * a[i__3].r;
                            z__3.i = ctemp * a[ i__3].i; // , expr subst
                            z__1.r = z__2.r + z__3.r;
                            z__1.i = z__2.i + z__3.i; // , expr subst
                            a[i__2].r = z__1.r;
                            a[i__2].i = z__1.i; // , expr subst
                            /* L70: */
                        }
                    }
                    /* L80: */
                }
            }
        }
        else if (lsame_(pivot, "B"))
        {
            if (lsame_(direct, "F"))
            {
                i__1 = *m - 1;
                for (j = 1;
                        j <= i__1;
                        ++j)
                {
                    ctemp = c__[j];
                    stemp = s[j];
                    if (ctemp != 1. || stemp != 0.)
                    {
                        i__2 = *n;
                        for (i__ = 1;
                                i__ <= i__2;
                                ++i__)
                        {
                            i__3 = j + i__ * a_dim1;
                            temp.r = a[i__3].r;
                            temp.i = a[i__3].i; // , expr subst
                            i__3 = j + i__ * a_dim1;
                            i__4 = *m + i__ * a_dim1;
                            z__2.r = stemp * a[i__4].r;
                            z__2.i = stemp * a[ i__4].i; // , expr subst
                            z__3.r = ctemp * temp.r;
                            z__3.i = ctemp * temp.i; // , expr subst
                            z__1.r = z__2.r + z__3.r;
                            z__1.i = z__2.i + z__3.i; // , expr subst
                            a[i__3].r = z__1.r;
                            a[i__3].i = z__1.i; // , expr subst
                            i__3 = *m + i__ * a_dim1;
                            i__4 = *m + i__ * a_dim1;
                            z__2.r = ctemp * a[i__4].r;
                            z__2.i = ctemp * a[ i__4].i; // , expr subst
                            z__3.r = stemp * temp.r;
                            z__3.i = stemp * temp.i; // , expr subst
                            z__1.r = z__2.r - z__3.r;
                            z__1.i = z__2.i - z__3.i; // , expr subst
                            a[i__3].r = z__1.r;
                            a[i__3].i = z__1.i; // , expr subst
                            /* L90: */
                        }
                    }
                    /* L100: */
                }
            }
            else if (lsame_(direct, "B"))
            {
                for (j = *m - 1;
                        j >= 1;
                        --j)
                {
                    ctemp = c__[j];
                    stemp = s[j];
                    if (ctemp != 1. || stemp != 0.)
                    {
                        i__1 = *n;
                        for (i__ = 1;
                                i__ <= i__1;
                                ++i__)
                        {
                            i__2 = j + i__ * a_dim1;
                            temp.r = a[i__2].r;
                            temp.i = a[i__2].i; // , expr subst
                            i__2 = j + i__ * a_dim1;
                            i__3 = *m + i__ * a_dim1;
                            z__2.r = stemp * a[i__3].r;
                            z__2.i = stemp * a[ i__3].i; // , expr subst
                            z__3.r = ctemp * temp.r;
                            z__3.i = ctemp * temp.i; // , expr subst
                            z__1.r = z__2.r + z__3.r;
                            z__1.i = z__2.i + z__3.i; // , expr subst
                            a[i__2].r = z__1.r;
                            a[i__2].i = z__1.i; // , expr subst
                            i__2 = *m + i__ * a_dim1;
                            i__3 = *m + i__ * a_dim1;
                            z__2.r = ctemp * a[i__3].r;
                            z__2.i = ctemp * a[ i__3].i; // , expr subst
                            z__3.r = stemp * temp.r;
                            z__3.i = stemp * temp.i; // , expr subst
                            z__1.r = z__2.r - z__3.r;
                            z__1.i = z__2.i - z__3.i; // , expr subst
                            a[i__2].r = z__1.r;
                            a[i__2].i = z__1.i; // , expr subst
                            /* L110: */
                        }
                    }
                    /* L120: */
                }
            }
        }
    }
    else if (lsame_(side, "R"))
    {
        /* Form A * P**T */
        if (lsame_(pivot, "V"))
        {
            if (lsame_(direct, "F"))
            {
                i__1 = *n - 1;
                for (j = 1;
                        j <= i__1;
                        ++j)
                {
                    ctemp = c__[j];
                    stemp = s[j];
                    if (ctemp != 1. || stemp != 0.)
                    {
                        i__2 = *m;
                        for (i__ = 1;
                                i__ <= i__2;
                                ++i__)
                        {
                            i__3 = i__ + (j + 1) * a_dim1;
                            temp.r = a[i__3].r;
                            temp.i = a[i__3].i; // , expr subst
                            i__3 = i__ + (j + 1) * a_dim1;
                            z__2.r = ctemp * temp.r;
                            z__2.i = ctemp * temp.i; // , expr subst
                            i__4 = i__ + j * a_dim1;
                            z__3.r = stemp * a[i__4].r;
                            z__3.i = stemp * a[ i__4].i; // , expr subst
                            z__1.r = z__2.r - z__3.r;
                            z__1.i = z__2.i - z__3.i; // , expr subst
                            a[i__3].r = z__1.r;
                            a[i__3].i = z__1.i; // , expr subst
                            i__3 = i__ + j * a_dim1;
                            z__2.r = stemp * temp.r;
                            z__2.i = stemp * temp.i; // , expr subst
                            i__4 = i__ + j * a_dim1;
                            z__3.r = ctemp * a[i__4].r;
                            z__3.i = ctemp * a[ i__4].i; // , expr subst
                            z__1.r = z__2.r + z__3.r;
                            z__1.i = z__2.i + z__3.i; // , expr subst
                            a[i__3].r = z__1.r;
                            a[i__3].i = z__1.i; // , expr subst
                            /* L130: */
                        }
                    }
                    /* L140: */
                }
            }
            else if (lsame_(direct, "B"))
            {
                for (j = *n - 1;
                        j >= 1;
                        --j)
                {
                    ctemp = c__[j];
                    stemp = s[j];
                    if (ctemp != 1. || stemp != 0.)
                    {
                        i__1 = *m;
                        for (i__ = 1;
                                i__ <= i__1;
                                ++i__)
                        {
                            i__2 = i__ + (j + 1) * a_dim1;
                            temp.r = a[i__2].r;
                            temp.i = a[i__2].i; // , expr subst
                            i__2 = i__ + (j + 1) * a_dim1;
                            z__2.r = ctemp * temp.r;
                            z__2.i = ctemp * temp.i; // , expr subst
                            i__3 = i__ + j * a_dim1;
                            z__3.r = stemp * a[i__3].r;
                            z__3.i = stemp * a[ i__3].i; // , expr subst
                            z__1.r = z__2.r - z__3.r;
                            z__1.i = z__2.i - z__3.i; // , expr subst
                            a[i__2].r = z__1.r;
                            a[i__2].i = z__1.i; // , expr subst
                            i__2 = i__ + j * a_dim1;
                            z__2.r = stemp * temp.r;
                            z__2.i = stemp * temp.i; // , expr subst
                            i__3 = i__ + j * a_dim1;
                            z__3.r = ctemp * a[i__3].r;
                            z__3.i = ctemp * a[ i__3].i; // , expr subst
                            z__1.r = z__2.r + z__3.r;
                            z__1.i = z__2.i + z__3.i; // , expr subst
                            a[i__2].r = z__1.r;
                            a[i__2].i = z__1.i; // , expr subst
                            /* L150: */
                        }
                    }
                    /* L160: */
                }
            }
        }
        else if (lsame_(pivot, "T"))
        {
            if (lsame_(direct, "F"))
            {
                i__1 = *n;
                for (j = 2;
                        j <= i__1;
                        ++j)
                {
                    ctemp = c__[j - 1];
                    stemp = s[j - 1];
                    if (ctemp != 1. || stemp != 0.)
                    {
                        i__2 = *m;
                        for (i__ = 1;
                                i__ <= i__2;
                                ++i__)
                        {
                            i__3 = i__ + j * a_dim1;
                            temp.r = a[i__3].r;
                            temp.i = a[i__3].i; // , expr subst
                            i__3 = i__ + j * a_dim1;
                            z__2.r = ctemp * temp.r;
                            z__2.i = ctemp * temp.i; // , expr subst
                            i__4 = i__ + a_dim1;
                            z__3.r = stemp * a[i__4].r;
                            z__3.i = stemp * a[ i__4].i; // , expr subst
                            z__1.r = z__2.r - z__3.r;
                            z__1.i = z__2.i - z__3.i; // , expr subst
                            a[i__3].r = z__1.r;
                            a[i__3].i = z__1.i; // , expr subst
                            i__3 = i__ + a_dim1;
                            z__2.r = stemp * temp.r;
                            z__2.i = stemp * temp.i; // , expr subst
                            i__4 = i__ + a_dim1;
                            z__3.r = ctemp * a[i__4].r;
                            z__3.i = ctemp * a[ i__4].i; // , expr subst
                            z__1.r = z__2.r + z__3.r;
                            z__1.i = z__2.i + z__3.i; // , expr subst
                            a[i__3].r = z__1.r;
                            a[i__3].i = z__1.i; // , expr subst
                            /* L170: */
                        }
                    }
                    /* L180: */
                }
            }
            else if (lsame_(direct, "B"))
            {
                for (j = *n;
                        j >= 2;
                        --j)
                {
                    ctemp = c__[j - 1];
                    stemp = s[j - 1];
                    if (ctemp != 1. || stemp != 0.)
                    {
                        i__1 = *m;
                        for (i__ = 1;
                                i__ <= i__1;
                                ++i__)
                        {
                            i__2 = i__ + j * a_dim1;
                            temp.r = a[i__2].r;
                            temp.i = a[i__2].i; // , expr subst
                            i__2 = i__ + j * a_dim1;
                            z__2.r = ctemp * temp.r;
                            z__2.i = ctemp * temp.i; // , expr subst
                            i__3 = i__ + a_dim1;
                            z__3.r = stemp * a[i__3].r;
                            z__3.i = stemp * a[ i__3].i; // , expr subst
                            z__1.r = z__2.r - z__3.r;
                            z__1.i = z__2.i - z__3.i; // , expr subst
                            a[i__2].r = z__1.r;
                            a[i__2].i = z__1.i; // , expr subst
                            i__2 = i__ + a_dim1;
                            z__2.r = stemp * temp.r;
                            z__2.i = stemp * temp.i; // , expr subst
                            i__3 = i__ + a_dim1;
                            z__3.r = ctemp * a[i__3].r;
                            z__3.i = ctemp * a[ i__3].i; // , expr subst
                            z__1.r = z__2.r + z__3.r;
                            z__1.i = z__2.i + z__3.i; // , expr subst
                            a[i__2].r = z__1.r;
                            a[i__2].i = z__1.i; // , expr subst
                            /* L190: */
                        }
                    }
                    /* L200: */
                }
            }
        }
        else if (lsame_(pivot, "B"))
        {
            if (lsame_(direct, "F"))
            {
                i__1 = *n - 1;
                for (j = 1;
                        j <= i__1;
                        ++j)
                {
                    ctemp = c__[j];
                    stemp = s[j];
                    if (ctemp != 1. || stemp != 0.)
                    {
                        i__2 = *m;
                        for (i__ = 1;
                                i__ <= i__2;
                                ++i__)
                        {
                            i__3 = i__ + j * a_dim1;
                            temp.r = a[i__3].r;
                            temp.i = a[i__3].i; // , expr subst
                            i__3 = i__ + j * a_dim1;
                            i__4 = i__ + *n * a_dim1;
                            z__2.r = stemp * a[i__4].r;
                            z__2.i = stemp * a[ i__4].i; // , expr subst
                            z__3.r = ctemp * temp.r;
                            z__3.i = ctemp * temp.i; // , expr subst
                            z__1.r = z__2.r + z__3.r;
                            z__1.i = z__2.i + z__3.i; // , expr subst
                            a[i__3].r = z__1.r;
                            a[i__3].i = z__1.i; // , expr subst
                            i__3 = i__ + *n * a_dim1;
                            i__4 = i__ + *n * a_dim1;
                            z__2.r = ctemp * a[i__4].r;
                            z__2.i = ctemp * a[ i__4].i; // , expr subst
                            z__3.r = stemp * temp.r;
                            z__3.i = stemp * temp.i; // , expr subst
                            z__1.r = z__2.r - z__3.r;
                            z__1.i = z__2.i - z__3.i; // , expr subst
                            a[i__3].r = z__1.r;
                            a[i__3].i = z__1.i; // , expr subst
                            /* L210: */
                        }
                    }
                    /* L220: */
                }
            }
            else if (lsame_(direct, "B"))
            {
                for (j = *n - 1;
                        j >= 1;
                        --j)
                {
                    ctemp = c__[j];
                    stemp = s[j];
                    if (ctemp != 1. || stemp != 0.)
                    {
                        i__1 = *m;
                        for (i__ = 1;
                                i__ <= i__1;
                                ++i__)
                        {
                            i__2 = i__ + j * a_dim1;
                            temp.r = a[i__2].r;
                            temp.i = a[i__2].i; // , expr subst
                            i__2 = i__ + j * a_dim1;
                            i__3 = i__ + *n * a_dim1;
                            z__2.r = stemp * a[i__3].r;
                            z__2.i = stemp * a[ i__3].i; // , expr subst
                            z__3.r = ctemp * temp.r;
                            z__3.i = ctemp * temp.i; // , expr subst
                            z__1.r = z__2.r + z__3.r;
                            z__1.i = z__2.i + z__3.i; // , expr subst
                            a[i__2].r = z__1.r;
                            a[i__2].i = z__1.i; // , expr subst
                            i__2 = i__ + *n * a_dim1;
                            i__3 = i__ + *n * a_dim1;
                            z__2.r = ctemp * a[i__3].r;
                            z__2.i = ctemp * a[ i__3].i; // , expr subst
                            z__3.r = stemp * temp.r;
                            z__3.i = stemp * temp.i; // , expr subst
                            z__1.r = z__2.r - z__3.r;
                            z__1.i = z__2.i - z__3.i; // , expr subst
                            a[i__2].r = z__1.r;
                            a[i__2].i = z__1.i; // , expr subst
                            /* L230: */
                        }
                    }
                    /* L240: */
                }
            }
        }
    }
    return 0;
    /* End of ZLASR */
}
/* zlasr_ */