]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - dense-linear-algebra-libraries/linalg.git/blob - blis/frame/include/level0/old/bli_scalcjs.h
TI Linear Algebra Library (LINALG) Rlease 1.0.0
[dense-linear-algebra-libraries/linalg.git] / blis / frame / include / level0 / old / bli_scalcjs.h
1 /*
3    BLIS    
4    An object-based framework for developing high-performance BLAS-like
5    libraries.
7    Copyright (C) 2014, The University of Texas at Austin
9    Redistribution and use in source and binary forms, with or without
10    modification, are permitted provided that the following conditions are
11    met:
12     - Redistributions of source code must retain the above copyright
13       notice, this list of conditions and the following disclaimer.
14     - Redistributions in binary form must reproduce the above copyright
15       notice, this list of conditions and the following disclaimer in the
16       documentation and/or other materials provided with the distribution.
17     - Neither the name of The University of Texas at Austin nor the names
18       of its contributors may be used to endorse or promote products
19       derived from this software without specific prior written permission.
21    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25    HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
35 #ifndef BLIS_SCALCJS_H
36 #define BLIS_SCALCJS_H
38 // scalcjs
40 // Notes:
41 // - The first char encodes the type of a.
42 // - The second char encodes the type of x.
43 // - a is (conditionally) used in conjugated form.
45 #define bli_ssscalcjs( conj, a, x ) \
46 { \
47         (x) *= ( float  ) (a); \
48 }
49 #define bli_dsscalcjs( conj, a, x ) \
50 { \
51         (x) *= ( float  ) (a); \
52 }
53 #define bli_csscalcjs( conj, a, x ) \
54 { \
55         (x) *= ( float  ) (a).real; \
56 }
57 #define bli_zsscalcjs( conj, a, x ) \
58 { \
59         (x) *= ( float  ) (a).real; \
60 }
62 #define bli_sdscalcjs( conj, a, x ) \
63 { \
64         (x) *= ( double ) (a); \
65 }
66 #define bli_ddscalcjs( conj, a, x ) \
67 { \
68         (x) *= ( double ) (a); \
69 }
70 #define bli_cdscalcjs( conj, a, x ) \
71 { \
72         (x) *= ( double ) (a).real; \
73 }
74 #define bli_zdscalcjs( conj, a, x ) \
75 { \
76         (x) *= ( double ) (a).real; \
77 }
79 #define bli_scscalcjs( conj, a, x ) \
80 { \
81         (x).real *= ( float  ) (a); \
82         (x).imag *= ( float  ) (a); \
83 }
84 #define bli_dcscalcjs( conj, a, x ) \
85 { \
86         (x).real *= ( float  ) (a); \
87         (x).imag *= ( float  ) (a); \
88 }
89 #define bli_ccscalcjs( conj, a, x ) \
90 { \
91         float  aimag = ( bli_is_conj( conj ) ? ( float  ) -(a).imag : \
92                                                ( float  )  (a).imag ); \
93         float  tempr = ( float  ) (a).real * (x).real - ( float  ) aimag * (x).imag; \
94         float  tempi = ( float  ) (a).real * (x).imag + ( float  ) aimag * (x).real; \
95         (x).real = tempr; \
96         (x).imag = tempi; \
97 }
98 #define bli_zcscalcjs( conj, a, x ) \
99 { \
100         float  aimag = ( bli_is_conj( conj ) ? ( float  ) -(a).imag : \
101                                                ( float  )  (a).imag ); \
102         float  tempr = ( float  ) (a).real * (x).real - ( float  ) aimag * (x).imag; \
103         float  tempi = ( float  ) (a).real * (x).imag + ( float  ) aimag * (x).real; \
104         (x).real = tempr; \
105         (x).imag = tempi; \
108 #define bli_szscalcjs( conj, a, x ) \
109 { \
110         (x).real *= ( double ) (a); \
111         (x).imag *= ( double ) (a); \
113 #define bli_dzscalcjs( conj, a, x ) \
114 { \
115         (x).real *= ( double ) (a); \
116         (x).imag *= ( double ) (a); \
118 #define bli_czscalcjs( conj, a, x ) \
119 { \
120         double aimag = ( bli_is_conj( conj ) ? ( double ) -(a).imag : \
121                                                ( double )  (a).imag ); \
122         double tempr = ( double ) (a).real * (x).real - ( double ) aimag * (x).imag; \
123         double tempi = ( double ) (a).real * (x).imag + ( double ) aimag * (x).real; \
124         (x).real = tempr; \
125         (x).imag = tempi; \
127 #define bli_zzscalcjs( conj, a, x ) \
128 { \
129         double aimag = ( bli_is_conj( conj ) ? ( double ) -(a).imag : \
130                                                ( double )  (a).imag ); \
131         double tempr = ( double ) (a).real * (x).real - ( double ) aimag * (x).imag; \
132         double tempi = ( double ) (a).real * (x).imag + ( double ) aimag * (x).real; \
133         (x).real = tempr; \
134         (x).imag = tempi; \
138 #define bli_sscalcjs( conj, a, x ) \
139 { \
140         bli_ssscalcjs( conj, a, x ); \
142 #define bli_dscalcjs( conj, a, x ) \
143 { \
144         bli_ddscalcjs( conj, a, x ); \
146 #define bli_cscalcjs( conj, a, x ) \
147 { \
148         bli_ccscalcjs( conj, a, x ); \
150 #define bli_zscalcjs( conj, a, x ) \
151 { \
152         bli_zzscalcjs( conj, a, x ); \
156 #endif