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

« back to all changes in this revision

Viewing changes to interfaces/blas/C/src/cblas_zhpmv.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
 *             Automatically Tuned Linear Algebra Software v3.2
 
3
 *                    (C) Copyright 1999 R. Clint Whaley                     
 
4
 *
 
5
 * Redistribution and use in source and binary forms, with or without
 
6
 * modification, are permitted provided that the following conditions
 
7
 * are met:
 
8
 *   1. Redistributions of source code must retain the above copyright
 
9
 *      notice, this list of conditions and the following disclaimer.
 
10
 *   2. Redistributions in binary form must reproduce the above copyright
 
11
 *      notice, this list of conditions, and the following disclaimer in the
 
12
 *      documentation and/or other materials provided with the distribution.
 
13
 *   3. The name of the University of Tennessee, the ATLAS group,
 
14
 *      or the names of its contributers may not be used to endorse
 
15
 *      or promote products derived from this software without specific
 
16
 *      written permission.
 
17
 *
 
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 
19
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 
20
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 
21
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE
 
22
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 
23
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
24
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
25
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 
26
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 
27
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
28
 * POSSIBILITY OF SUCH DAMAGE. 
 
29
 *
 
30
 */
 
31
 
 
32
#define DCPLX
 
33
#include "atlas_misc.h"
 
34
#include "cblas.h"
 
35
#ifdef ATL_USEPTHREADS
 
36
   #include "atlas_ptalias2.h"
 
37
#endif
 
38
#include "atlas_level2.h"
 
39
 
 
40
void cblas_zhpmv(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, 
 
41
                 const int N, const void *alpha, const void *A,
 
42
                 const void *X, const int incX, 
 
43
                 const void *beta, void *Y, const int incY)
 
44
{
 
45
   int info = 2000;
 
46
   const enum CBLAS_UPLO ruplo = (Uplo == CblasUpper) ? CblasLower : CblasUpper;
 
47
   void *vx;
 
48
   double *X0, *x = (double*) X;
 
49
   double *y = Y;
 
50
   const double *alp=alpha;
 
51
   const double *bet=beta;
 
52
   double calpha[2], cbeta[2];
 
53
   const double one[2] = {ATL_rone, ATL_rzero};
 
54
   calpha[0] = *alp;
 
55
   calpha[1] = -alp[1];
 
56
   cbeta[0] = *bet;
 
57
   cbeta[1] = -bet[1];
 
58
 
 
59
#ifndef NoCblasErrorChecks
 
60
   if (Order != CblasColMajor && Order != CblasRowMajor)
 
61
      info = cblas_errprn(1, info, "Order must be %d or %d, but is set to %d",
 
62
                          CblasRowMajor, CblasColMajor, Order);
 
63
   if (Uplo != CblasUpper && Uplo != CblasLower)
 
64
      info = cblas_errprn(2, info, 
 
65
                          "Uplo must be %d or %d, but is set to %d",
 
66
                          CblasUpper, CblasLower, Uplo);
 
67
 
 
68
   if (N < 0) info = cblas_errprn(3, info, 
 
69
                        "N cannot be less than zero; is set to %d.", N);
 
70
   if (!incX) info = cblas_errprn(7, info,
 
71
                                  "incX cannot be zero; is set to %d.", incX);
 
72
   if (!incY) info = cblas_errprn(10, info,
 
73
                                  "incY cannot be zero; is set to %d.", incY);
 
74
   if (info != 2000)
 
75
   {
 
76
      cblas_xerbla(info, "cblas_zhpmv", "");
 
77
      return;
 
78
   }
 
79
#endif
 
80
 
 
81
   if (incX < 0) x += (1-N)*incX<<1;
 
82
   if (incY < 0) y += (1-N)*incY<<1;
 
83
   if (Order == CblasColMajor)
 
84
      ATL_zhpmv(Uplo, N, alpha, A, x, incX, beta, y, incY);
 
85
   else
 
86
   {
 
87
      vx = malloc(ATL_Cachelen + 2*N*sizeof(double));
 
88
      ATL_assert(vx);
 
89
      X0 = x;
 
90
      x = ATL_AlignPtr(vx);
 
91
      ATL_zmoveConj(N, calpha, X0, incX, x, 1);
 
92
      if (*bet != ATL_rzero || bet[1] != ATL_rzero)
 
93
      {
 
94
         ATL_zscalConj(N, cbeta, y, incY); 
 
95
         ATL_zhpmv(ruplo, N, one, A, x, 1, one, y, incY);
 
96
      }
 
97
      else ATL_zhpmv(ruplo, N, one, A, x, 1, beta, y, incY);
 
98
      free(vx);
 
99
      ATL_zscalConj(N, one, y, incY); 
 
100
   }
 
101
}