|
| 1 | +/***************************************************************************** |
| 2 | +Copyright (c) 2011-2024, 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 | +#ifdef BUILD_SINGLE |
| 37 | +CTEST(amin, samin){ |
| 38 | + blasint N = 3, inc = 1; |
| 39 | + float te_min = 0.0, tr_min = 0.0; |
| 40 | + float x[] = { -1.1, 2.2, -3.3, 4.4, -5.5, 6.6, -7.7, 8.8, |
| 41 | + -9.9 }; |
| 42 | + |
| 43 | + te_min = BLASFUNC(samin)(&N, x, &inc); |
| 44 | + tr_min = 1.1; |
| 45 | + |
| 46 | + ASSERT_DBL_NEAR_TOL((double)(tr_min), (double)(te_min), SINGLE_EPS); |
| 47 | +} |
| 48 | +#endif |
| 49 | +#ifdef BUILD_DOUBLE |
| 50 | +CTEST(amin, damin){ |
| 51 | + blasint N = 3, inc = 1; |
| 52 | + double te_min = 0.0, tr_min = 0.0; |
| 53 | + double x[] = { -1.1, 2.2, -3.3, 4.4, -5.5, 6.6, -7.7, 8.8, |
| 54 | + -9.9 }; |
| 55 | + |
| 56 | + te_min = BLASFUNC(damin)(&N, x, &inc); |
| 57 | + tr_min = 1.1; |
| 58 | + |
| 59 | + ASSERT_DBL_NEAR_TOL((double)(tr_min), (double)(te_min), DOUBLE_EPS); |
| 60 | +} |
| 61 | +#endif |
| 62 | +#ifdef BUILD_COMPLEX |
| 63 | +CTEST(amin, scamin){ |
| 64 | + blasint N = 9, inc = 1; |
| 65 | + float te_min = 0.0, tr_min = 0.0; |
| 66 | + float x[] = { -1.1, 2.2, -3.3, 4.4, -5.5, 6.6, -7.7, 8.8, |
| 67 | + -9.9, 10.10, -1.1, 2.2, -3.3, 4.4, -5.5, 6.6, |
| 68 | + -7.7, 8.8 }; |
| 69 | + |
| 70 | + te_min = BLASFUNC(scamin)(&N, x, &inc); |
| 71 | + tr_min = 3.3; |
| 72 | + |
| 73 | + ASSERT_DBL_NEAR_TOL((double)(tr_min), (double)(te_min), SINGLE_EPS); |
| 74 | +} |
| 75 | +#endif |
| 76 | +#ifdef BUILD_COMPLEX16 |
| 77 | +CTEST(amin, dzamin){ |
| 78 | + blasint N = 9, inc = 1; |
| 79 | + double te_min = 0.0, tr_min = 0.0; |
| 80 | + double x[] = { -1.1, 2.2, -3.3, 4.4, -5.5, 6.6, -7.7, 8.8, |
| 81 | + -9.9, 10.10, -1.1, 2.2, -3.3, 4.4, -5.5, 6.6, |
| 82 | + -7.7, 8.8 }; |
| 83 | + |
| 84 | + te_min = BLASFUNC(dzamin)(&N, x, &inc); |
| 85 | + tr_min = 3.3; |
| 86 | + |
| 87 | + ASSERT_DBL_NEAR_TOL((double)(tr_min), (double)(te_min), DOUBLE_EPS); |
| 88 | +} |
| 89 | +#endif |
0 commit comments