1 /***************************************************************************
2 Copyright (c) 2014, The OpenBLAS Project
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are
7 1. Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 2. Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in
11 the documentation and/or other materials provided with the
13 3. Neither the name of the OpenBLAS project nor the names of
14 its contributors may be used to endorse or promote products
15 derived from this software without specific prior written permission.
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE
20 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *****************************************************************************/
28 /***********************************************************
30 ***********************************************************/
35 #ifdef FUNCTION_PROFILE
36 #include "functable.h"
40 #define ERROR_NAME "ZOMATCOPY"
42 #define ERROR_NAME "COMATCOPY"
45 #define BlasRowMajor 0
46 #define BlasColMajor 1
49 #define BlasTransConj 2
53 void NAME( char* ORDER, char* TRANS, blasint *rows, blasint *cols, FLOAT *alpha, FLOAT *a, blasint *lda, FLOAT *b, blasint *ldb)
57 int order=-1,trans=-1;
66 if ( Order == 'C' ) order = BlasColMajor;
67 if ( Order == 'R' ) order = BlasRowMajor;
68 if ( Trans == 'N' ) trans = BlasNoTrans;
69 if ( Trans == 'T' ) trans = BlasTrans;
70 if ( Trans == 'C' ) trans = BlasTransConj;
71 if ( Trans == 'R' ) trans = BlasConj;
74 void CNAME(enum CBLAS_ORDER CORDER, enum CBLAS_TRANSPOSE CTRANS, blasint crows, blasint ccols, FLOAT *alpha, FLOAT *a, blasint clda, FLOAT*b, blasint cldb)
76 blasint *rows, *cols, *lda, *ldb;
77 int order=-1,trans=-1;
80 if ( CORDER == CblasColMajor ) order = BlasColMajor;
81 if ( CORDER == CblasRowMajor ) order = BlasRowMajor;
83 if ( CTRANS == CblasNoTrans) trans = BlasNoTrans;
84 if ( CTRANS == CblasConjNoTrans ) trans = BlasConj;
85 if ( CTRANS == CblasTrans) trans = BlasTrans;
86 if ( CTRANS == CblasConjTrans) trans = BlasTransConj;
93 if ( order == BlasColMajor)
95 if ( trans == BlasNoTrans && *ldb < *rows ) info = 9;
96 if ( trans == BlasConj && *ldb < *rows ) info = 9;
97 if ( trans == BlasTrans && *ldb < *cols ) info = 9;
98 if ( trans == BlasTransConj && *ldb < *cols ) info = 9;
100 if ( order == BlasRowMajor)
102 if ( trans == BlasNoTrans && *ldb < *cols ) info = 9;
103 if ( trans == BlasConj && *ldb < *cols ) info = 9;
104 if ( trans == BlasTrans && *ldb < *rows ) info = 9;
105 if ( trans == BlasTransConj && *ldb < *rows ) info = 9;
108 if ( order == BlasColMajor && *lda < *rows ) info = 7;
109 if ( order == BlasRowMajor && *lda < *cols ) info = 7;
110 if ( *cols <= 0 ) info = 4;
111 if ( *rows <= 0 ) info = 3;
112 if ( trans < 0 ) info = 2;
113 if ( order < 0 ) info = 1;
116 BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
120 if ( order == BlasColMajor )
123 if ( trans == BlasNoTrans )
125 OMATCOPY_K_CN(*rows, *cols, alpha[0], alpha[1], a, *lda, b, *ldb );
128 if ( trans == BlasConj )
130 OMATCOPY_K_CNC(*rows, *cols, alpha[0], alpha[1], a, *lda, b, *ldb );
133 if ( trans == BlasTrans )
135 OMATCOPY_K_CT(*rows, *cols, alpha[0], alpha[1], a, *lda, b, *ldb );
138 if ( trans == BlasTransConj )
140 OMATCOPY_K_CTC(*rows, *cols, alpha[0], alpha[1], a, *lda, b, *ldb );
148 if ( trans == BlasNoTrans )
150 OMATCOPY_K_RN(*rows, *cols, alpha[0], alpha[1], a, *lda, b, *ldb );
153 if ( trans == BlasConj )
155 OMATCOPY_K_RNC(*rows, *cols, alpha[0], alpha[1], a, *lda, b, *ldb );
158 if ( trans == BlasTrans )
160 OMATCOPY_K_RT(*rows, *cols, alpha[0], alpha[1], a, *lda, b, *ldb );
163 if ( trans == BlasTransConj )
165 OMATCOPY_K_RTC(*rows, *cols, alpha[0], alpha[1], a, *lda, b, *ldb );