~ubuntu-branches/ubuntu/vivid/atlas/vivid

« back to all changes in this revision

Viewing changes to src/blas/level2/kernel/ATL_hbmvU.c

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-06-11 15:58:16 UTC
  • mfrom: (1.1.3 upstream)
  • mto: (2.2.21 experimental)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: package-import@ubuntu.com-20130611155816-b72z8f621tuhbzn0
Tags: upstream-3.10.1
Import upstream version 3.10.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ---------------------------------------------------------------------
2
 
 *
3
 
 * -- Automatically Tuned Linear Algebra Software (ATLAS)
4
 
 *    (C) Copyright 2000 All Rights Reserved
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_misc.h"
50
 
#include "atlas_mv.h"
51
 
#include "atlas_r1.h"
52
 
#include "atlas_level1.h"
53
 
#include "atlas_kernel2.h"
54
 
#include "atlas_reflvl2.h"
55
 
#include "atlas_lvl2.h"
56
 
 
57
 
void Mjoin( PATL, hbmvU )
58
 
(
59
 
   const int                  N,
60
 
   const int                  K,
61
 
   const TYPE                 * A,
62
 
   const int                  LDA,
63
 
   const TYPE                 * X,
64
 
   const SCALAR               BETA,
65
 
   TYPE                       * Y
66
 
)
67
 
{
68
 
/*
69
 
 * Purpose
70
 
 * =======
71
 
 *
72
 
 * Mjoin( PATL, hbmvU ) performs the matrix-vector operation
73
 
 *
74
 
 *    y := alpha * A * x + beta * y,
75
 
 *
76
 
 * where alpha and beta are scalars, x and y are n-element vectors and A
77
 
 * is an n by n Hermitian band matrix, with k super-diagonals.
78
 
 *
79
 
 * This is a  recursive  version of the  algorithm.  For a more detailed
80
 
 * description of  the arguments of this function, see the reference im-
81
 
 * plementation in the  ATLAS/src/blas/reference directory.
82
 
 *
83
 
 * ---------------------------------------------------------------------
84
 
 */
85
 
/*
86
 
 * .. Local Variables ..
87
 
 */
88
 
   void                       (*gbmvT)( const int, const int, const int,
89
 
                              const int, const SCALAR, const TYPE *, const int,
90
 
                              const TYPE *, const int, const SCALAR, TYPE *,
91
 
                              const int );
92
 
   void                       (*gbmvN)( const int, const int, const int,
93
 
                              const int, const SCALAR, const TYPE *, const int,
94
 
                              const TYPE *, const int, const SCALAR, TYPE *,
95
 
                              const int );
96
 
#ifdef TREAL
97
 
#define    one                ATL_rone
98
 
#define    lda2               LDA
99
 
   TYPE                       beta0;
100
 
#else
101
 
   const TYPE                 * beta0, one[2] = { ATL_rone, ATL_rzero };
102
 
   const int                  lda2 = (LDA << 1);
103
 
#endif
104
 
   int                        ia, ian, jb, kl, ku, ma, mb, na, nb;
105
 
/* ..
106
 
 * .. Executable Statements ..
107
 
 *
108
 
 */
109
 
   ATL_GetPartSBMV( A, LDA, &mb, &nb );
110
 
 
111
 
   beta0 = BETA;
112
 
 
113
 
   if(      SCALAR_IS_ZERO( beta0 ) )
114
 
   {
115
 
      gbmvN = Mjoin( PATL, gbmvN_a1_x1_b0_y1 );
116
 
      gbmvT = Mjoin( PATL, gbmvC_a1_x1_b0_y1 );
117
 
   }
118
 
   else if( SCALAR_IS_ONE ( beta0 ) )
119
 
   {
120
 
      gbmvN = Mjoin( PATL, gbmvN_a1_x1_b1_y1 );
121
 
      gbmvT = Mjoin( PATL, gbmvC_a1_x1_b1_y1 );
122
 
   }
123
 
   else
124
 
   {
125
 
      gbmvN = Mjoin( PATL, gbmvN_a1_x1_bX_y1 );
126
 
      gbmvT = Mjoin( PATL, gbmvC_a1_x1_bX_y1 );
127
 
   }
128
 
 
129
 
   for( ian = ( ( N - 1 ) / nb ) * nb; ian >= 0; ian -= nb )
130
 
   {
131
 
      jb = N - ian; jb = Mmin( jb, nb );
132
 
 
133
 
      if( ian != 0 )
134
 
      {
135
 
         ia = ian - K; ia = Mmax( ia, 0 ); ma = ian - ia; na = Mmin( jb, K );
136
 
         kl = ma  - 1; kl = Mmax( kl, 0 ); ku = K - 1 - kl; ku = Mmax( ku, 0 );
137
 
         gbmvT( na, ma, kl, ku, one, A+ian*lda2, LDA, X+(ia  SHIFT), 1, beta0,
138
 
                Y+(ian SHIFT), 1 );
139
 
         gbmvN( ma, na, kl, ku, one, A+ian*lda2, LDA, X+(ian SHIFT), 1, beta0,
140
 
                Y+(ia  SHIFT), 1 );
141
 
         if( !( SCALAR_IS_ONE( beta0 ) ) )
142
 
         {
143
 
            if( jb > na )
144
 
               Mjoin( PATL, scal )( jb-na, beta0, Y+((ian+na) SHIFT), 1 );
145
 
            if( ia > 0  ) Mjoin( PATL, scal )( ia, beta0, Y, 1 );
146
 
         }
147
 
         beta0 = one;
148
 
      }
149
 
      Mjoin( PATL, refhbmvU )( jb, K, one, A+ian*lda2, LDA, X+(ian SHIFT), 1,
150
 
                               beta0, Y+(ian SHIFT), 1 );
151
 
      gbmvN = Mjoin( PATL, gbmvN_a1_x1_b1_y1 );
152
 
      gbmvT = Mjoin( PATL, gbmvC_a1_x1_b1_y1 );
153
 
      beta0 = one;
154
 
   }
155
 
/*
156
 
 * End of Mjoin( PATL, hbmvU )
157
 
 */
158
 
}