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

« back to all changes in this revision

Viewing changes to src/blas/level3/ATL_symm.c

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2002-04-13 10:07:52 UTC
  • Revision ID: james.westby@ubuntu.com-20020413100752-va9zm0rd4gpurdkq
Tags: upstream-3.2.1ln
ImportĀ upstreamĀ versionĀ 3.2.1ln

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
 * -- Suggestions,  comments,  bugs reports should be sent to the follo-
 
9
 *    wing e-mail address: atlas@cs.utk.edu
 
10
 *
 
11
 * Author         : Antoine P. Petitet
 
12
 * Contributor(s) : R. Clint Whaley
 
13
 * University of Tennessee - Innovative Computing Laboratory
 
14
 * Knoxville TN, 37996-1301, USA.
 
15
 *
 
16
 * ---------------------------------------------------------------------
 
17
 *
 
18
 * -- Copyright notice and Licensing terms:
 
19
 *
 
20
 *  Redistribution  and  use in  source and binary forms, with or without
 
21
 *  modification, are  permitted provided  that the following  conditions
 
22
 *  are met:
 
23
 *
 
24
 * 1. Redistributions  of  source  code  must retain the above copyright
 
25
 *    notice, this list of conditions and the following disclaimer.
 
26
 * 2. Redistributions in binary form must reproduce  the above copyright
 
27
 *    notice,  this list of conditions, and the  following disclaimer in
 
28
 *    the documentation and/or other materials provided with the distri-
 
29
 *    bution.
 
30
 * 3. The name of the University,  the ATLAS group,  or the names of its
 
31
 *    contributors  may not be used to endorse or promote products deri-
 
32
 *    ved from this software without specific written permission.
 
33
 *
 
34
 * -- Disclaimer:
 
35
 *
 
36
 * THIS  SOFTWARE  IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
37
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,  INCLUDING,  BUT NOT
 
38
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 
39
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY
 
40
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,  INDIRECT, INCIDENTAL, SPE-
 
41
 * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 
42
 * TO,  PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 
43
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEO-
 
44
 * RY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (IN-
 
45
 * CLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 
46
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
47
 *
 
48
 * ---------------------------------------------------------------------
 
49
 */
 
50
/*
 
51
 * Include files
 
52
 */
 
53
#include "atlas_rblas3.h"
 
54
#include "atlas_kernel3.h"
 
55
#include "atlas_lvl3.h"
 
56
 
 
57
#ifndef SYMM_NB
 
58
#define SYMM_NB      NB
 
59
#endif
 
60
 
 
61
void Mjoin( PATL, symm )
 
62
(
 
63
   const enum ATLAS_SIDE      SIDE,
 
64
   const enum ATLAS_UPLO      UPLO,
 
65
   const int                  M,
 
66
   const int                  N,
 
67
   const SCALAR               ALPHA,
 
68
   const TYPE                 * A,
 
69
   const int                  LDA,
 
70
   const TYPE                 * B,
 
71
   const int                  LDB,
 
72
   const SCALAR               BETA,
 
73
   TYPE                       * C,
 
74
   const int                  LDC
 
75
)
 
76
{
 
77
/*
 
78
 * Purpose
 
79
 * =======
 
80
 *
 
81
 * Mjoin( PATL, symm )  performs one of the matrix-matrix operations
 
82
 *
 
83
 *    C := alpha * A * B + beta * C,
 
84
 *
 
85
 * or
 
86
 *
 
87
 *    C := alpha * B * A + beta * C,
 
88
 *
 
89
 * where alpha and beta are scalars,  A  is a symmetric matrix and B and
 
90
 * C are m by n matrices.
 
91
 *
 
92
 * This is a  recursive  version of the  algorithm.  For a more detailed
 
93
 * description of  the arguments of this function, see the reference im-
 
94
 * plementation in the  ATLAS/src/blas/reference directory.
 
95
 *
 
96
 * ---------------------------------------------------------------------
 
97
 */
 
98
/*
 
99
 * .. Local Variables ..
 
100
 */
 
101
#ifdef TREAL
 
102
   TYPE                       alpha0 = (TYPE)(ALPHA), beta0 = (TYPE)(BETA);
 
103
   const TYPE                 one = ATL_rone;
 
104
#else
 
105
   TYPE                       one[2] = { ATL_rone, ATL_rzero };
 
106
#endif
 
107
   TYPE                       * alpha, * beta;
 
108
   RC3_FUN_SYMM_T             ATL_rsymm;
 
109
   RC3_SYMM_T                 type;
 
110
/* ..
 
111
 * .. Executable Statements ..
 
112
 *
 
113
 */
 
114
   if( ( M == 0 ) || ( N == 0 ) ||
 
115
       ( ( SCALAR_IS_ZERO( ALPHA ) ) && ( SCALAR_IS_ONE( BETA ) ) ) ) return;
 
116
 
 
117
   if( SCALAR_IS_ZERO( ALPHA ) )
 
118
   { Mjoin( PATL, gescal )( M, N, BETA, C, LDC ); return; }
 
119
#ifdef TREAL
 
120
   type.size    = sizeof( TYPE );           type.one = (void *)(&one);
 
121
   type.TgemmNN = Mjoin( PATL, gemmNN_RB );
 
122
   alpha        = &alpha0;                  beta     = &beta0;
 
123
#else
 
124
   type.size    = sizeof( TYPE[2] );        type.one = (void *)(one);
 
125
   type.TgemmNN = Mjoin( PATL, gemmNN_RB );
 
126
   alpha = (TYPE *)(ALPHA);                 beta     = (TYPE *)(BETA);
 
127
#endif
 
128
 
 
129
   if( SIDE == AtlasLeft )
 
130
   {
 
131
      type.Tgemm = Mjoin( PATL, gemmTN_RB );
 
132
      if( UPLO == AtlasUpper )
 
133
      { type.Tsymm = Mjoin( PATL, symmLU ); ATL_rsymm = ATL_rsymmLU; }
 
134
      else
 
135
      { type.Tsymm = Mjoin( PATL, symmLL ); ATL_rsymm = ATL_rsymmLL; }
 
136
   }
 
137
   else
 
138
   {
 
139
      type.Tgemm = Mjoin( PATL, gemmNT_RB );
 
140
      if( UPLO == AtlasUpper )
 
141
      { type.Tsymm = Mjoin( PATL, symmRU ); ATL_rsymm = ATL_rsymmRU; }
 
142
      else
 
143
      { type.Tsymm = Mjoin( PATL, symmRL ); ATL_rsymm = ATL_rsymmRL; }
 
144
   }
 
145
 
 
146
   ATL_rsymm( &type, M, N, ((void *)alpha), ((void *)A), LDA, ((void *)B),
 
147
              LDB, ((void *)beta), ((void *)C), LDC, SYMM_NB );
 
148
/*
 
149
 * End of Mjoin( PATL, symm )
 
150
 */
 
151
}