File size: 14,152 Bytes
9375c9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<html><!-- Created using the cpp_pretty_printer from the dlib C++ library.  See http://dlib.net for updates. --><head><title>dlib C++ Library - cblas_ctpmv.c</title></head><body bgcolor='white'><pre>
<font color='#009900'>/*
 * cblas_ctpmv.c
 * The program is a C interface to ctpmv.
 * 
 * Keita Teranishi  5/20/98
 *
 */</font>
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='cblas.h.html'>cblas.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='cblas_f77.h.html'>cblas_f77.h</a>"
<font color='#0000FF'><u>void</u></font> <b><a name='cblas_ctpmv'></a>cblas_ctpmv</b><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> <font color='#0000FF'>enum</font> CBLAS_ORDER order, <font color='#0000FF'>const</font> <font color='#0000FF'>enum</font> CBLAS_UPLO Uplo,
                 <font color='#0000FF'>const</font> <font color='#0000FF'>enum</font> CBLAS_TRANSPOSE TransA, <font color='#0000FF'>const</font> <font color='#0000FF'>enum</font> CBLAS_DIAG Diag,
                 <font color='#0000FF'>const</font> CBLAS_INT_TYPE N, <font color='#0000FF'>const</font> <font color='#0000FF'><u>void</u></font>  <font color='#5555FF'>*</font>Ap, <font color='#0000FF'><u>void</u></font>  <font color='#5555FF'>*</font>X, <font color='#0000FF'>const</font> CBLAS_INT_TYPE incX<font face='Lucida Console'>)</font>
<b>{</b>
   <font color='#0000FF'><u>char</u></font> TA;
   <font color='#0000FF'><u>char</u></font> UL;
   <font color='#0000FF'><u>char</u></font> DI;
<font color='#0000FF'>#ifdef</font> F77_CHAR
   F77_CHAR F77_TA, F77_UL, F77_DI;
<font color='#0000FF'>#else</font>
   <font color='#0000FF'>#define</font> F77_TA <font color='#5555FF'>&amp;</font>TA
   <font color='#0000FF'>#define</font> F77_UL <font color='#5555FF'>&amp;</font>UL
   <font color='#0000FF'>#define</font> F77_DI <font color='#5555FF'>&amp;</font>DI   
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#ifdef</font> F77_INT
   F77_INT F77_N<font color='#5555FF'>=</font>N, F77_incX<font color='#5555FF'>=</font>incX;
<font color='#0000FF'>#else</font>
   <font color='#0000FF'>#define</font> F77_N N
   <font color='#0000FF'>#define</font> F77_incX incX
<font color='#0000FF'>#endif</font>
   CBLAS_INT_TYPE n, i<font color='#5555FF'>=</font><font color='#979000'>0</font>, tincX; 
   <font color='#0000FF'><u>float</u></font> <font color='#5555FF'>*</font>st<font color='#5555FF'>=</font><font color='#979000'>0</font>,<font color='#5555FF'>*</font>x<font color='#5555FF'>=</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>float</u></font> <font color='#5555FF'>*</font><font face='Lucida Console'>)</font>X;

   <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>order <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasColMajor<font face='Lucida Console'>)</font>
   <b>{</b>
      <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>Uplo <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasUpper<font face='Lucida Console'>)</font> UL <font color='#5555FF'>=</font> '<font color='#FF0000'>U</font>';
      <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>Uplo <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasLower<font face='Lucida Console'>)</font> UL <font color='#5555FF'>=</font> '<font color='#FF0000'>L</font>';
      <font color='#0000FF'>else</font> 
      <b>{</b>
         <font color='#BB00BB'>cblas_xerbla</font><font face='Lucida Console'>(</font><font color='#979000'>2</font>, "<font color='#CC0000'>cblas_ctpmv</font>","<font color='#CC0000'>Illegal Uplo setting, %d\n</font>", Uplo<font face='Lucida Console'>)</font>;
         <font color='#0000FF'>return</font>;
      <b>}</b>
      <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>TransA <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasNoTrans<font face='Lucida Console'>)</font> TA <font color='#5555FF'>=</font> '<font color='#FF0000'>N</font>';
      <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>TransA <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasTrans<font face='Lucida Console'>)</font> TA <font color='#5555FF'>=</font> '<font color='#FF0000'>T</font>';
      <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>TransA <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasConjTrans<font face='Lucida Console'>)</font> TA <font color='#5555FF'>=</font> '<font color='#FF0000'>C</font>';
      <font color='#0000FF'>else</font> 
      <b>{</b>
         <font color='#BB00BB'>cblas_xerbla</font><font face='Lucida Console'>(</font><font color='#979000'>3</font>, "<font color='#CC0000'>cblas_ctpmv</font>","<font color='#CC0000'>Illegal TransA setting, %d\n</font>", TransA<font face='Lucida Console'>)</font>;
         <font color='#0000FF'>return</font>;
      <b>}</b>
      <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>Diag <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasUnit<font face='Lucida Console'>)</font> DI <font color='#5555FF'>=</font> '<font color='#FF0000'>U</font>';
      <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>Diag <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasNonUnit<font face='Lucida Console'>)</font> DI <font color='#5555FF'>=</font> '<font color='#FF0000'>N</font>';
      <font color='#0000FF'>else</font> 
      <b>{</b>
         <font color='#BB00BB'>cblas_xerbla</font><font face='Lucida Console'>(</font><font color='#979000'>4</font>, "<font color='#CC0000'>cblas_ctpmv</font>","<font color='#CC0000'>Illegal Diag setting, %d\n</font>", Diag<font face='Lucida Console'>)</font>;
         <font color='#0000FF'>return</font>;
      <b>}</b>
      <font color='#0000FF'>#ifdef</font> F77_CHAR
         F77_UL <font color='#5555FF'>=</font> <font color='#BB00BB'>C2F_CHAR</font><font face='Lucida Console'>(</font><font color='#5555FF'>&amp;</font>UL<font face='Lucida Console'>)</font>;
         F77_TA <font color='#5555FF'>=</font> <font color='#BB00BB'>C2F_CHAR</font><font face='Lucida Console'>(</font><font color='#5555FF'>&amp;</font>TA<font face='Lucida Console'>)</font>;
         F77_DI <font color='#5555FF'>=</font> <font color='#BB00BB'>C2F_CHAR</font><font face='Lucida Console'>(</font><font color='#5555FF'>&amp;</font>DI<font face='Lucida Console'>)</font>;
      <font color='#0000FF'>#endif</font>
      <font color='#BB00BB'>F77_ctpmv</font><font face='Lucida Console'>(</font> F77_UL, F77_TA, F77_DI, <font color='#5555FF'>&amp;</font>F77_N, Ap, X, <font color='#5555FF'>&amp;</font>F77_incX<font face='Lucida Console'>)</font>;
   <b>}</b>
   <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>order <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasRowMajor<font face='Lucida Console'>)</font>
   <b>{</b>
      <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>Uplo <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasUpper<font face='Lucida Console'>)</font> UL <font color='#5555FF'>=</font> '<font color='#FF0000'>L</font>';
      <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>Uplo <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasLower<font face='Lucida Console'>)</font> UL <font color='#5555FF'>=</font> '<font color='#FF0000'>U</font>';
      <font color='#0000FF'>else</font> 
      <b>{</b>
         <font color='#BB00BB'>cblas_xerbla</font><font face='Lucida Console'>(</font><font color='#979000'>2</font>, "<font color='#CC0000'>cblas_ctpmv</font>","<font color='#CC0000'>Illegal Uplo setting, %d\n</font>", Uplo<font face='Lucida Console'>)</font>;
         <font color='#0000FF'>return</font>;
      <b>}</b>

      <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>TransA <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasNoTrans<font face='Lucida Console'>)</font> TA <font color='#5555FF'>=</font> '<font color='#FF0000'>T</font>';
      <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>TransA <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasTrans<font face='Lucida Console'>)</font> TA <font color='#5555FF'>=</font> '<font color='#FF0000'>N</font>';
      <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>TransA <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasConjTrans<font face='Lucida Console'>)</font>
      <b>{</b>
         TA <font color='#5555FF'>=</font> '<font color='#FF0000'>N</font>';
         <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font> N <font color='#5555FF'>&gt;</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
         <b>{</b>
            <font color='#0000FF'>if</font><font face='Lucida Console'>(</font>incX <font color='#5555FF'>&gt;</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
               tincX <font color='#5555FF'>=</font> incX;
            <font color='#0000FF'>else</font>
               tincX <font color='#5555FF'>=</font> <font color='#5555FF'>-</font>incX;
            i <font color='#5555FF'>=</font> tincX <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> <font color='#979000'>1</font>;
            n <font color='#5555FF'>=</font> i <font color='#5555FF'>*</font> N;
            x<font color='#5555FF'>+</font><font color='#5555FF'>+</font>;
            st <font color='#5555FF'>=</font> x <font color='#5555FF'>+</font> n;
            <font color='#0000FF'>do</font>
            <b>{</b>
               <font color='#5555FF'>*</font>x <font color='#5555FF'>=</font> <font color='#5555FF'>-</font><font face='Lucida Console'>(</font><font color='#5555FF'>*</font>x<font face='Lucida Console'>)</font>;
               x <font color='#5555FF'>+</font><font color='#5555FF'>=</font> i;
            <b>}</b>
            <font color='#0000FF'>while</font> <font face='Lucida Console'>(</font>x <font color='#5555FF'>!</font><font color='#5555FF'>=</font> st<font face='Lucida Console'>)</font>;
            x <font color='#5555FF'>-</font><font color='#5555FF'>=</font> n;
         <b>}</b>
      <b>}</b>
      <font color='#0000FF'>else</font> 
      <b>{</b>
         <font color='#BB00BB'>cblas_xerbla</font><font face='Lucida Console'>(</font><font color='#979000'>3</font>, "<font color='#CC0000'>cblas_ctpmv</font>","<font color='#CC0000'>Illegal TransA setting, %d\n</font>", TransA<font face='Lucida Console'>)</font>;
         <font color='#0000FF'>return</font>;
      <b>}</b>

      <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>Diag <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasUnit<font face='Lucida Console'>)</font> DI <font color='#5555FF'>=</font> '<font color='#FF0000'>U</font>';
      <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>Diag <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasNonUnit<font face='Lucida Console'>)</font> DI <font color='#5555FF'>=</font> '<font color='#FF0000'>N</font>';
      <font color='#0000FF'>else</font> 
      <b>{</b>
         <font color='#BB00BB'>cblas_xerbla</font><font face='Lucida Console'>(</font><font color='#979000'>4</font>, "<font color='#CC0000'>cblas_ctpmv</font>","<font color='#CC0000'>Illegal Diag setting, %d\n</font>", Diag<font face='Lucida Console'>)</font>;
         <font color='#0000FF'>return</font>;
      <b>}</b>
      <font color='#0000FF'>#ifdef</font> F77_CHAR
         F77_UL <font color='#5555FF'>=</font> <font color='#BB00BB'>C2F_CHAR</font><font face='Lucida Console'>(</font><font color='#5555FF'>&amp;</font>UL<font face='Lucida Console'>)</font>;
         F77_TA <font color='#5555FF'>=</font> <font color='#BB00BB'>C2F_CHAR</font><font face='Lucida Console'>(</font><font color='#5555FF'>&amp;</font>TA<font face='Lucida Console'>)</font>;
         F77_DI <font color='#5555FF'>=</font> <font color='#BB00BB'>C2F_CHAR</font><font face='Lucida Console'>(</font><font color='#5555FF'>&amp;</font>DI<font face='Lucida Console'>)</font>;
      <font color='#0000FF'>#endif</font>

      <font color='#BB00BB'>F77_ctpmv</font><font face='Lucida Console'>(</font> F77_UL, F77_TA, F77_DI, <font color='#5555FF'>&amp;</font>F77_N, Ap, X,<font color='#5555FF'>&amp;</font>F77_incX<font face='Lucida Console'>)</font>;
      <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>TransA <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasConjTrans<font face='Lucida Console'>)</font>
      <b>{</b>
         <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>N <font color='#5555FF'>&gt;</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
         <b>{</b>
            <font color='#0000FF'>do</font>
            <b>{</b>
               <font color='#5555FF'>*</font>x <font color='#5555FF'>=</font> <font color='#5555FF'>-</font><font face='Lucida Console'>(</font><font color='#5555FF'>*</font>x<font face='Lucida Console'>)</font>;
               x <font color='#5555FF'>+</font><font color='#5555FF'>=</font> i;
            <b>}</b>
            <font color='#0000FF'>while</font> <font face='Lucida Console'>(</font>x <font color='#5555FF'>!</font><font color='#5555FF'>=</font> st<font face='Lucida Console'>)</font>;
         <b>}</b>
      <b>}</b>
   <b>}</b>
   <font color='#0000FF'>else</font> <font color='#BB00BB'>cblas_xerbla</font><font face='Lucida Console'>(</font><font color='#979000'>1</font>, "<font color='#CC0000'>cblas_ctpmv</font>", "<font color='#CC0000'>Illegal Order setting, %d\n</font>", order<font face='Lucida Console'>)</font>;
   <font color='#0000FF'>return</font>;
<b>}</b>

</pre></body></html>