1/* ---------------------------------------------------------------------
2 *
3 * -- <s>Automatically Tuned Linear Algebra Software (ATLAS)
4 *    (C) Copyright 2000 All Rights Reserved</s>
5 *
6 * -- ATLAS routine -- Version 3.2 -- December 25, 2000
7 *
8 * Author         : Antoine P. Petitet
9 * Originally developed at the University of Tennessee,
10 * Innovative Computing Laboratory, Knoxville TN, 37996-1301, USA.
11 *
12 * ---------------------------------------------------------------------
13 *
14 * -- Copyright notice and Licensing terms:
15 *
16 *  Redistribution  and  use in  source and binary forms, with or without
17 *  modification, are  permitted provided  that the following  conditions
18 *  are met:
19 *
20 * 1. Redistributions  of  source  code  must retain the above copyright
21 *    notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce  the above copyright
23 *    notice,  this list of conditions, and the  following disclaimer in
24 *    the documentation and/or other materials provided with the distri-
25 *    bution.
26 * 3. The name of the University,  the ATLAS group,  or the names of its
27 *    contributors  may not be used to endorse or promote products deri-
28 *    ved from this software without specific written permission.
29 *
30 * -- Disclaimer:
31 *
32 * THIS  SOFTWARE  IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,  INCLUDING,  BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY
36 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,  INDIRECT, INCIDENTAL, SPE-
37 * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
38 * TO,  PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
39 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEO-
40 * RY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (IN-
41 * CLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
42 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 *
44 * ---------------------------------------------------------------------
45 */
46/*
47 * Include files
48 */
49#include "atlas_refmisc.h"
50#include "atlas_reflvl3.h"
51#include "atlas_reflevel3.h"
52
53void ATL_zrefhemmRU
54(
55   const int                  M,
56   const int                  N,
57   const double               * ALPHA,
58   const double               * A,
59   const int                  LDA,
60   const double               * B,
61   const int                  LDB,
62   const double               * BETA,
63   double                     * C,
64   const int                  LDC
65)
66{
67/*
68 * Purpose
69 * =======
70 *
71 * ATL_zrefhemmRU( ... )
72 *
73 * <=>
74 *
75 * ATL_zrefhemm( AtlasRight, AtlasUpper, ... )
76 *
77 * See ATL_zrefhemm for details.
78 *
79 * ---------------------------------------------------------------------
80 */
81/*
82 * .. Local Variables ..
83 */
84   register double            t0_i, t0_r;
85   int                        i, iaj, iajk, iakj, ibij, ibik, icij, j,
86                              jaj, jbj, jbk, jcj, k, lda2 = ( LDA << 1 ),
87                              ldb2 = ( LDB << 1 ), ldc2 = ( LDC << 1 );
88/* ..
89 * .. Executable Statements ..
90 *
91 */
92   for( j = 0,      iaj  = 0, jaj  = 0,    jbj  = 0,    jcj  = 0;
93        j < N; j++, iaj += 2, jaj += lda2, jbj += ldb2, jcj += ldc2 )
94   {
95      i = ( j << 1 ) + jaj;
96      Mset( ALPHA[0] * A[i], ALPHA[1] * A[i], t0_r, t0_i );
97      for( i = 0, ibij = jbj, icij = jcj; i < M; i++, ibij += 2, icij += 2 )
98      {
99         Mzelscal( BETA[0], BETA[1], C[icij], C[icij+1] );
100         Mmla( t0_r, t0_i, B[ibij], B[ibij+1], C[icij], C[icij+1] );
101      }
102      for( k = 0, iakj = jaj, jbk = 0; k < j; k++, iakj += 2, jbk += ldb2 )
103      {
104         Mmul( ALPHA[0], ALPHA[1], A[iakj], A[iakj+1], t0_r, t0_i );
105         for( i = 0,      ibik  = jbk, icij  = jcj;
106              i < M; i++, ibik += 2,   icij += 2 )
107         { Mmla( t0_r, t0_i, B[ibik], B[ibik+1], C[icij], C[icij+1] ); }
108      }
109      for( k = j+1,    iajk  = iaj+(j+1)*lda2, jbk  = (j+1)*ldb2;
110           k < N; k++, iajk += lda2,           jbk += ldb2 )
111      {
112         Mmul( ALPHA[0], ALPHA[1], A[iajk], -A[iajk+1], t0_r, t0_i );
113         for( i = 0, ibik = jbk, icij = jcj; i < M; i++, ibik += 2, icij += 2 )
114         { Mmla( t0_r, t0_i, B[ibik], B[ibik+1], C[icij], C[icij+1] ); }
115      }
116   }
117/*
118 * End of ATL_zrefhemmRU
119 */
120}
121