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

« back to all changes in this revision

Viewing changes to src/testing/ATL_f77gemm.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
#include "atlas_misc.h"
 
32
#include "atlas_tst.h"
 
33
#include "atlas_f77blas.h"
 
34
 
 
35
#define F77GEMM F77gemm
 
36
#define f77gemm Mjoin(PATL,f77gemm)
 
37
 
 
38
void f77gemm(const enum ATLAS_TRANS TA, const enum ATLAS_TRANS TB,
 
39
             const int M, const int N, const int K, const SCALAR alpha,
 
40
             const TYPE *A, const int lda, const TYPE *B, const int ldb,
 
41
             const SCALAR beta, TYPE *C, const int ldc)
 
42
{
 
43
   #if defined(StringSunStyle)
 
44
      #if defined(ATL_FunkyInts)
 
45
         F77_INTEGER ONE=1;
 
46
      #else
 
47
         int ONE=1;
 
48
      #endif
 
49
   #elif defined(StringStructVal) || defined(StringStructPtr) || defined(StringCrayStyle)
 
50
      F77_CHAR fta;
 
51
      F77_CHAR ftb;
 
52
   #endif
 
53
   #ifdef ATL_FunkyInts
 
54
      const F77_INTEGER F77M=M, F77N=N, F77K=K, F77lda=lda, F77ldb=ldb, 
 
55
                        F77ldc=ldc;
 
56
   #else
 
57
      #define F77M M
 
58
      #define F77N N
 
59
      #define F77K K
 
60
      #define F77lda lda
 
61
      #define F77ldb ldb
 
62
      #define F77ldc ldc
 
63
   #endif
 
64
   char cta, ctb;
 
65
   if (TA == AtlasNoTrans) cta = 'N';
 
66
   else if (TA == AtlasTrans) cta = 'T';
 
67
   else if (TA == AtlasConjTrans) cta = 'C';
 
68
   if (TB == AtlasNoTrans) ctb = 'N';
 
69
   else if (TB == AtlasTrans) ctb = 'T';
 
70
   else if (TB == AtlasConjTrans) ctb = 'C';
 
71
 
 
72
   #if defined(StringSunStyle)
 
73
      F77GEMM(&cta, &ctb, &F77M, &F77N, &F77K, SADD alpha, A, &lda, B, &F77ldb, 
 
74
              SADD beta, C, &F77ldc, ONE, ONE);
 
75
   #elif defined(StringCrayStyle)
 
76
      fta = ATL_C2F_TransChar(cta);
 
77
      ftb = ATL_C2F_TransChar(ctb);
 
78
      F77GEMM(fta, ftb, &F77M, &F77N, &F77K, SADD alpha, A, &lda, B, &F77ldb, 
 
79
              SADD beta, C, &F77ldc);
 
80
   #elif defined(StringStructVal)
 
81
      fta.len = ftb.len = 1;
 
82
      fta.cp = &cta; ftb.cp = &ctb;
 
83
      F77GEMM(fta, ftb, &F77M, &F77N, &F77K, SADD alpha, A, &lda, B, &F77ldb, 
 
84
              SADD beta, C, &F77ldc);
 
85
   #elif defined(StringStructPtr)
 
86
      fta.len = ftb.len = 1;
 
87
      fta.cp = &cta; ftb.cp = &ctb;
 
88
      F77GEMM(&fta, &ftb, &F77M, &F77N, &F77K, SADD alpha, A, &lda, B, &F77ldb, 
 
89
              SADD beta, C, &F77ldc);
 
90
   #else
 
91
      fprintf(stderr, "\n\nF77/C interface not defined!!\n\n");
 
92
      exit(-1);
 
93
   #endif
 
94
}