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

« back to all changes in this revision

Viewing changes to src/blas/level2/kernel/ATL_sprL.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
 
#ifdef TREAL
58
 
#define    MinN_sprL    16
59
 
#else
60
 
#define    MinN_sprL     8
61
 
#endif
62
 
 
63
 
void Mjoin( PATL, sprL )
64
 
(
65
 
   const int                  N,
66
 
   const TYPE                 * X,
67
 
   const TYPE                 * Y,
68
 
   const int                  INCY,
69
 
   TYPE                       * A,
70
 
   const int                  LDA
71
 
)
72
 
{
73
 
/*
74
 
 * Purpose
75
 
 * =======
76
 
 *
77
 
 * Mjoin( PATL, sprL ) performs the symmetric rank 1 operation
78
 
 *
79
 
 *    A := alpha * x * x' + A,
80
 
 *
81
 
 * where  alpha is a scalar, x is an n-element vector and A is an n by n
82
 
 * symmetric matrix, supplied in packed form.
83
 
 *
84
 
 * This is a  recursive  version of the  algorithm.  For a more detailed
85
 
 * description of  the arguments of this function, see the reference im-
86
 
 * plementation in the  ATLAS/src/blas/reference directory.
87
 
 *
88
 
 * ---------------------------------------------------------------------
89
 
 */
90
 
/*
91
 
 * .. Local Variables ..
92
 
 */
93
 
#ifdef TREAL
94
 
#define    one                ATL_rone
95
 
   register TYPE              t0;
96
 
   int                        i, iaij, j, jaj, jy, lda = LDA, n1, n1s, n2;
97
 
#else
98
 
   const TYPE                 one[2] = { ATL_rone, ATL_rzero };
99
 
   register TYPE              t0_i, t0_r;
100
 
   const int                  incy2 = 2 * INCY;
101
 
   int                        i, iaij, ix, j, jaj, jy, lda = LDA,
102
 
                              lda2 = (LDA << 1), n1, n1s, n2;
103
 
#endif
104
 
#ifdef TREAL
105
 
#define   gpr      Mjoin( PATL, gpr1L_a1_x1_yX  )
106
 
#else
107
 
#define   gpr      Mjoin( PATL, gpr1uL_a1_x1_yX )
108
 
#endif
109
 
/* ..
110
 
 * .. Executable Statements ..
111
 
 *
112
 
 */
113
 
   if( N <= MinN_sprL )
114
 
   {
115
 
#ifdef TREAL
116
 
      for( j = 0, jaj = 0, jy = 0; j < N; j++, jy += INCY )
117
 
      {
118
 
         t0 = Y[jy];
119
 
         for( i = j, iaij = jaj; i < N; i++, iaij++ ) { A[iaij] += X[i] * t0; }
120
 
         jaj += lda; lda -= 1;
121
 
      }
122
 
#else
123
 
      for( j = 0, jaj = 0, jy = 0; j < N; j++, jy += incy2, X += 2 )
124
 
      {
125
 
         t0_r = Y[jy]; t0_i = Y[jy+1];
126
 
         for( i = j, iaij = jaj, ix = 0; i < N; i++, iaij += 2, ix += 2 )
127
 
         {
128
 
            A[iaij  ] += X[ix] * t0_r - X[ix+1] * t0_i;
129
 
            A[iaij+1] += X[ix] * t0_i + X[ix+1] * t0_r;
130
 
         }
131
 
         jaj += lda2; lda2 -= 2;
132
 
      }
133
 
#endif
134
 
   }
135
 
   else
136
 
   {
137
 
      n2 = N - ( n1 = ( N >> 1 ) ); n1s = (n1 SHIFT);
138
 
      Mjoin( PATL, sprL )( n1, X, Y, INCY, A, lda ); X += n1s;
139
 
      gpr(  n2, n1, one, X, 1, Y, INCY, A + n1s, lda ); Y += n1s * INCY;
140
 
      MLpnext( n1, A, lda ); Mjoin( PATL, sprL )( n2, X, Y, INCY, A, lda );
141
 
   }
142
 
/*
143
 
 * End of Mjoin( PATL, sprL )
144
 
 */
145
 
}