You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_amin.c 3.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*****************************************************************************
  2. Copyright (c) 2011-2024, The OpenBLAS Project
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  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
  12. distribution.
  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
  16. permission.
  17. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  18. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  21. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  23. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  24. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  25. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  26. USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. **********************************************************************************/
  28. #include "openblas_utest.h"
  29. #ifdef BUILD_SINGLE
  30. CTEST(amin, samin){
  31. blasint N = 3, inc = 1;
  32. float te_min = 0.0, tr_min = 0.0;
  33. float x[] = { -1.1, 2.2, -3.3, 4.4, -5.5, 6.6, -7.7, 8.8,
  34. -9.9 };
  35. te_min = BLASFUNC(samin)(&N, x, &inc);
  36. tr_min = 1.1;
  37. ASSERT_DBL_NEAR_TOL((double)(tr_min), (double)(te_min), SINGLE_EPS);
  38. }
  39. #endif
  40. #ifdef BUILD_DOUBLE
  41. CTEST(amin, damin){
  42. blasint N = 3, inc = 1;
  43. double te_min = 0.0, tr_min = 0.0;
  44. double x[] = { -1.1, 2.2, -3.3, 4.4, -5.5, 6.6, -7.7, 8.8,
  45. -9.9 };
  46. te_min = BLASFUNC(damin)(&N, x, &inc);
  47. tr_min = 1.1;
  48. ASSERT_DBL_NEAR_TOL((double)(tr_min), (double)(te_min), DOUBLE_EPS);
  49. }
  50. #endif
  51. #ifdef BUILD_COMPLEX
  52. CTEST(amin, scamin){
  53. blasint N = 9, inc = 1;
  54. float te_min = 0.0, tr_min = 0.0;
  55. float x[] = { -1.1, 2.2, -3.3, 4.4, -5.5, 6.6, -7.7, 8.8,
  56. -9.9, 10.10, -1.1, 2.2, -3.3, 4.4, -5.5, 6.6,
  57. -7.7, 8.8 };
  58. te_min = BLASFUNC(scamin)(&N, x, &inc);
  59. tr_min = 3.3;
  60. ASSERT_DBL_NEAR_TOL((double)(tr_min), (double)(te_min), SINGLE_EPS);
  61. }
  62. #endif
  63. #ifdef BUILD_COMPLEX16
  64. CTEST(amin, dzamin){
  65. blasint N = 9, inc = 1;
  66. double te_min = 0.0, tr_min = 0.0;
  67. double x[] = { -1.1, 2.2, -3.3, 4.4, -5.5, 6.6, -7.7, 8.8,
  68. -9.9, 10.10, -1.1, 2.2, -3.3, 4.4, -5.5, 6.6,
  69. -7.7, 8.8 };
  70. te_min = BLASFUNC(dzamin)(&N, x, &inc);
  71. tr_min = 3.3;
  72. ASSERT_DBL_NEAR_TOL((double)(tr_min), (double)(te_min), DOUBLE_EPS);
  73. }
  74. #endif