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

« back to all changes in this revision

Viewing changes to interfaces/blas/C/src/cblas_dger2.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
 *             Automatically Tuned Linear Algebra Software v3.10.1
 
3
 * Copyright (C) 2010 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 ATLAS group or the names of its contributers may
 
14
 *      not be used to endorse or promote products derived from this
 
15
 *      software without specific written permission.
 
16
 *
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
18
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 
19
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 
20
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ATLAS GROUP OR ITS CONTRIBUTORS
 
21
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 
22
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
23
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
24
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 
25
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 
26
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
27
 * POSSIBILITY OF SUCH DAMAGE.
 
28
 *
 
29
 */
 
30
 
 
31
#define DREAL
 
32
#include "atlas_misc.h"
 
33
#include "cblas.h"
 
34
#ifdef ATL_USEPTHREADS
 
35
   #include "atlas_ptalias2.h"
 
36
#endif
 
37
#include "atlas_level2.h"
 
38
 
 
39
void cblas_dger2(const enum CBLAS_ORDER Order, ATL_CINT M, ATL_CINT N,
 
40
                 const double alpha, const double *X, ATL_CINT incX,
 
41
                 const double *Y, ATL_CINT incY, const double beta,
 
42
                 const double *W, ATL_CINT incW,
 
43
                 const double *Z, ATL_CINT incZ, double *A, ATL_CINT lda)
 
44
{
 
45
   int info = 2000;
 
46
   #define x X
 
47
   #define y Y
 
48
   #define w W
 
49
   #define z Z
 
50
 
 
51
#ifndef NoCblasErrorChecks
 
52
   if (M < 0) info = cblas_errprn(2, info,
 
53
                        "M cannot be less than zero; is set to %d.", M);
 
54
   if (N < 0) info = cblas_errprn(3, info,
 
55
                        "N cannot be less than zero; is set to %d.", N);
 
56
   if (!incX) info = cblas_errprn(6, info,
 
57
                                  "incX cannot be zero; is set to %d.", incX);
 
58
   if (!incY) info = cblas_errprn(8, info,
 
59
                                  "incY cannot be zero; is set to %d.", incY);
 
60
   if (!incW) info = cblas_errprn(11, info,
 
61
                                  "incW cannot be zero; is set to %d.", incW);
 
62
   if (!incZ) info = cblas_errprn(13, info,
 
63
                                  "incZ cannot be zero; is set to %d.", incZ);
 
64
   if (Order == CblasColMajor)
 
65
   {
 
66
      if (lda < M || lda < 1)
 
67
         info = cblas_errprn(15, info, "lda must be >= MAX(M,1): lda=%d M=%d",
 
68
                             lda, M);
 
69
   }
 
70
   else if (Order == CblasRowMajor)
 
71
   {
 
72
      if (lda < N || lda < 1)
 
73
         info = cblas_errprn(15, info, "lda must be >= MAX(N,1): lda=%d M=%d",
 
74
                             lda, N);
 
75
   }
 
76
   else
 
77
      info = cblas_errprn(1, info, "Order must be %d or %d, but is set to %d",
 
78
                          CblasRowMajor, CblasColMajor, Order);
 
79
   if (info != 2000)
 
80
   {
 
81
      cblas_xerbla(info, "cblas_dger2", "");
 
82
      return;
 
83
   }
 
84
#endif
 
85
 
 
86
   if (incX < 0) x += (1-M)*incX;
 
87
   if (incY < 0) y += (1-N)*incY;
 
88
   if (incW < 0) w += (1-M)*incW;
 
89
   if (incZ < 0) z += (1-N)*incZ;
 
90
 
 
91
   if (Order == CblasColMajor)
 
92
      ATL_dger2(M, N, alpha, x, incX, y, incY, beta, w, incW, z, incZ, A, lda);
 
93
   else
 
94
      ATL_dger2(N, M, alpha, y, incY, x, incX, beta, w, incW, z, incZ, A, lda);
 
95
}