Update dgemm_kernel_4x8_haswell.S
[platform/upstream/openblas.git] / utest / test_dotu.c
1 /*****************************************************************************
2 Copyright (c) 2011-2014, The OpenBLAS Project
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8
9    1. Redistributions of source code must retain the above copyright
10       notice, this list of conditions and the following disclaimer.
11
12    2. Redistributions in binary form must reproduce the above copyright
13       notice, this list of conditions and the following disclaimer in
14       the documentation and/or other materials provided with the
15       distribution.
16    3. Neither the name of the OpenBLAS project nor the names of 
17       its contributors may be used to endorse or promote products 
18       derived from this software without specific prior written 
19       permission.
20
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
30 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 **********************************************************************************/
33
34 #include "openblas_utest.h"
35
36 CTEST( zdotu,zdotu_n_1)
37 {
38         blasint N=1,incX=1,incY=1;
39         double x1[]={1.0,1.0};
40         double y1[]={1.0,2.0};
41         
42         openblas_complex_double result1=openblas_make_complex_double(0.0,0.0);
43         openblas_complex_double result2=openblas_make_complex_double(-1.0000,3.0000);
44 #ifdef RETURN_BY_STACK
45         BLASFUNC(zdotu)(&result1,&N,x1,&incX,y1,&incY);
46 #else
47         result1=BLASFUNC(zdotu)(&N,x1,&incX,y1,&incY);
48 #endif
49         
50 #ifdef OPENBLAS_COMPLEX_STRUCT
51         ASSERT_DBL_NEAR_TOL(result2.real, result1.real, DOUBLE_EPS);
52         ASSERT_DBL_NEAR_TOL(result2.imag, result1.imag, DOUBLE_EPS);
53 #else
54         ASSERT_DBL_NEAR_TOL(creal(result2), creal(result1), DOUBLE_EPS);
55         ASSERT_DBL_NEAR_TOL(cimag(result2), cimag(result1), DOUBLE_EPS);
56 #endif
57         
58 }
59
60 CTEST(zdotu, zdotu_offset_1)
61 {
62         blasint N=1,incX=1,incY=1;
63         double x1[]={1.0,2.0,3.0,4.0};
64         double y1[]={5.0,6.0,7.0,8.0};
65         
66         openblas_complex_double result1=openblas_make_complex_double(0.0,0.0);
67         openblas_complex_double result2=openblas_make_complex_double(-9.0,32.0);
68 #ifdef RETURN_BY_STACK
69         BLASFUNC(zdotu)(&result1,&N,x1+1,&incX,y1+1,&incY);
70 #else
71         result1=BLASFUNC(zdotu)(&N,x1+1,&incX,y1+1,&incY);
72 #endif
73         
74 #ifdef OPENBLAS_COMPLEX_STRUCT
75         ASSERT_DBL_NEAR_TOL(result2.real, result1.real, DOUBLE_EPS);
76         ASSERT_DBL_NEAR_TOL(result2.imag, result1.imag, DOUBLE_EPS);
77 #else
78         ASSERT_DBL_NEAR_TOL(creal(result2), creal(result1), DOUBLE_EPS);
79         ASSERT_DBL_NEAR_TOL(cimag(result2), cimag(result1), DOUBLE_EPS);
80 #endif
81
82 }