]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - dense-linear-algebra-libraries/linalg.git/blob - blis/frame/include/level0/rih/bli_setrihs_mxn_diag.h
Consolidate all git repos of linalg into one.
[dense-linear-algebra-libraries/linalg.git] / blis / frame / include / level0 / rih / bli_setrihs_mxn_diag.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_SETRIHS_MXN_DIAG_H
36 #define BLIS_SETRIHS_MXN_DIAG_H
38 // setrihs_mxn_diag
40 #define bli_csetrihs_mxn_diag( schema, m, n, a, y_r, rs_y, cs_y ) \
41 { \
42         const float  a_r     = bli_zreal( *a ); \
43         const float  a_i     = bli_zimag( *a ); \
44         dim_t        min_m_n = bli_min( m, n ); \
45         dim_t        i; \
46 \
47         /* Handle ro, io, and rpi separately. */ \
48         if ( bli_is_ro_packed( schema ) ) \
49         { \
50                 for ( i = 0; i < min_m_n; ++i ) \
51                 { \
52                         bli_scopys(  (a_r), \
53                                     *(y_r + i*rs_y + i*cs_y) ); \
54                 } \
55         } \
56         else if ( bli_is_io_packed( schema ) ) \
57         { \
58                 for ( i = 0; i < min_m_n; ++i ) \
59                 { \
60                         bli_scopys(  (a_i), \
61                                     *(y_r + i*rs_y + i*cs_y) ); \
62                 } \
63         } \
64         else /* if ( bli_is_rpi_packed( schema ) ) */ \
65         { \
66                 for ( i = 0; i < min_m_n; ++i ) \
67                 { \
68                         bli_sadd3s(  (a_r), \
69                                      (a_i), \
70                                     *(y_r + i*rs_y + i*cs_y) ); \
71                 } \
72         } \
73 }
75 #define bli_zsetrihs_mxn_diag( schema, m, n, a, y_r, rs_y, cs_y ) \
76 { \
77         const double a_r     = bli_zreal( *a ); \
78         const double a_i     = bli_zimag( *a ); \
79         dim_t        min_m_n = bli_min( m, n ); \
80         dim_t        i; \
81 \
82         /* Handle ro, io, and rpi separately. */ \
83         if ( bli_is_ro_packed( schema ) ) \
84         { \
85                 for ( i = 0; i < min_m_n; ++i ) \
86                 { \
87                         bli_dcopys(  (a_r), \
88                                     *(y_r + i*rs_y + i*cs_y) ); \
89                 } \
90         } \
91         else if ( bli_is_io_packed( schema ) ) \
92         { \
93                 for ( i = 0; i < min_m_n; ++i ) \
94                 { \
95                         bli_dcopys(  (a_i), \
96                                     *(y_r + i*rs_y + i*cs_y) ); \
97                 } \
98         } \
99         else /* if ( bli_is_rpi_packed( schema ) ) */ \
100         { \
101                 for ( i = 0; i < min_m_n; ++i ) \
102                 { \
103                         bli_dadd3s(  (a_r), \
104                                      (a_i), \
105                                     *(y_r + i*rs_y + i*cs_y) ); \
106                 } \
107         } \
110 #endif