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_csbmv.c 18 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. /*****************************************************************************
  2. Copyright (c) 2023, 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 "utest/openblas_utest.h"
  29. #include "common.h"
  30. #define DATASIZE 100
  31. #define INCREMENT 2
  32. struct DATA_CSBMV {
  33. float sp_matrix[DATASIZE * (DATASIZE + 1)];
  34. float sb_matrix[DATASIZE * DATASIZE * 2];
  35. float b_test[DATASIZE * 2 * INCREMENT];
  36. float c_test[DATASIZE * 2 * INCREMENT];
  37. float c_verify[DATASIZE * 2 * INCREMENT];
  38. };
  39. // SINGLE_EPS_ZGEMV = MAX_VAL * NUMBER OF OPERATIONS * FLT_EPSILON
  40. // SINGLE_EPS_ZGEMV = 5.0 * O(100 * 100) * 1.19e-07 = 5*e-03
  41. #define SINGLE_EPS_ZGEMV 5e-03
  42. #ifdef BUILD_COMPLEX
  43. static struct DATA_CSBMV data_csbmv;
  44. /**
  45. * Transform full-storage symmetric band matrix A to upper (U) or lower (L)
  46. * band-packed storage mode.
  47. *
  48. * param uplo specifies whether matrix a is upper or lower band-packed.
  49. * param n - number of rows and columns of A
  50. * param k - number of super-diagonals of A
  51. * output param a - buffer for holding symmetric band-packed matrix
  52. * param lda - specifies the leading dimension of a
  53. * param sb_matrix - buffer holding full-storage symmetric band matrix A
  54. * param ldm - specifies the leading dimension of A
  55. */
  56. static void transform_to_band_storage(char uplo, blasint n, blasint k, float* a, blasint lda,
  57. float* sb_matrix, blasint ldm)
  58. {
  59. blasint i, j, m;
  60. if (uplo == 'L') {
  61. for (j = 0; j < n; j++)
  62. {
  63. m = -j;
  64. for (i = 2 * j; i < MIN(2 * n, 2 * (j + k + 1)); i += 2)
  65. {
  66. a[(2*m + i) + j * lda * 2] = sb_matrix[i + j * ldm * 2];
  67. a[(2*m + (i + 1)) + j * lda * 2] = sb_matrix[(i + 1) + j * ldm * 2];
  68. }
  69. }
  70. }
  71. else {
  72. for (j = 0; j < n; j++)
  73. {
  74. m = k - j;
  75. for (i = MAX(0, 2*(j - k)); i <= j*2; i += 2)
  76. {
  77. a[(2*m + i) + j * lda * 2] = sb_matrix[i + j * ldm * 2];
  78. a[(2*m + (i + 1)) + j * lda * 2] = sb_matrix[(i + 1) + j * ldm * 2];
  79. }
  80. }
  81. }
  82. }
  83. /**
  84. * Generate full-storage symmetric band matrix A with k - super-diagonals
  85. * from input symmetric packed matrix in lower packed mode (L)
  86. *
  87. * output param sb_matrix - buffer for holding full-storage symmetric band matrix.
  88. * param sp_matrix - buffer holding input symmetric packed matrix
  89. * param n - number of rows and columns of A
  90. * param k - number of super-diagonals of A
  91. */
  92. static void get_symmetric_band_matr(float *sb_matrix, float *sp_matrix, blasint n, blasint k)
  93. {
  94. blasint m;
  95. blasint i, j;
  96. m = 0;
  97. for (i = 0; i < n; i++)
  98. {
  99. for (j = 0; j < n * 2; j += 2)
  100. {
  101. // Make matrix band with k super-diagonals
  102. if (fabs((i+1) - ceil((j+1)/2.0f)) > k)
  103. {
  104. sb_matrix[i * n * 2 + j] = 0.0f;
  105. sb_matrix[i * n * 2 + j + 1] = 0.0f;
  106. continue;
  107. }
  108. if (j / 2 < i)
  109. {
  110. sb_matrix[i * n * 2 + j] =
  111. sb_matrix[j * n + i * 2];
  112. sb_matrix[i * n * 2 + j + 1] =
  113. sb_matrix[j * n + i * 2 + 1];
  114. }
  115. else
  116. {
  117. sb_matrix[i * n * 2 + j] = sp_matrix[m++];
  118. sb_matrix[i * n * 2 + j + 1] = sp_matrix[m++];
  119. }
  120. }
  121. }
  122. }
  123. /**
  124. * Check if error function was called with expected function name
  125. * and param info
  126. *
  127. * param uplo specifies whether matrix a is upper or lower band-packed.
  128. * param n - number of rows and columns of A
  129. * param k - number of super-diagonals of A
  130. * param lda - specifies the leading dimension of a
  131. * param inc_b - stride of vector b_test
  132. * param inc_c - stride of vector c_test
  133. * param expected_info - expected invalid parameter number in csbmv
  134. * return TRUE if everything is ok, otherwise FALSE
  135. */
  136. static int check_badargs(char uplo, blasint n, blasint k, blasint lda, blasint inc_b,
  137. blasint inc_c, int expected_info)
  138. {
  139. float alpha[] = {1.0f, 1.0f};
  140. float beta[] = {0.0f, 0.0f};
  141. float a[2];
  142. srand_generate(a, 2);
  143. set_xerbla("CSBMV ", expected_info);
  144. BLASFUNC(csbmv)(&uplo, &n, &k, alpha, a, &lda, data_csbmv.b_test,
  145. &inc_b, beta, data_csbmv.c_test, &inc_c);
  146. return check_error();
  147. }
  148. /**
  149. * Comapare results computed by csbmv and cgemv
  150. * since csbmv is cgemv for symmetric band matrix
  151. *
  152. * param uplo specifies whether matrix A is upper or lower triangular
  153. * param n - number of rows and columns of A
  154. * param k - number of super-diagonals of A
  155. * param alpha - scaling factor for the matrix-vector product
  156. * param lda - specifies the leading dimension of a
  157. * param inc_b - stride of vector b_test
  158. * param beta - scaling factor for vector c_test
  159. * param inc_c - stride of vector c_test
  160. * param lda - specifies the leading dimension of a
  161. * return norm of differences
  162. */
  163. static float check_csbmv(char uplo, blasint n, blasint k, float *alpha, blasint lda,
  164. blasint inc_b, float *beta, blasint inc_c, blasint ldm)
  165. {
  166. blasint i;
  167. // Trans param for gemv (can use any, since the input matrix is symmetric)
  168. char trans = 'N';
  169. // Symmetric band packed matrix for sbmv
  170. float a[lda * n * 2];
  171. // Fill symmetric packed matrix sp_matrix, vector b_test, vector c_test
  172. srand_generate(data_csbmv.sp_matrix, n * (n + 1));
  173. srand_generate(data_csbmv.b_test, n * inc_b * 2);
  174. srand_generate(data_csbmv.c_test, n * inc_c * 2);
  175. // Copy vector c_test for cgemv
  176. for (i = 0; i < n * inc_c * 2; i++)
  177. data_csbmv.c_verify[i] = data_csbmv.c_test[i];
  178. // Generate full-storage symmetric band matrix
  179. // with k super-diagonals from symmetric packed matrix
  180. get_symmetric_band_matr(data_csbmv.sb_matrix, data_csbmv.sp_matrix, n, k);
  181. // Transform symmetric band matrix from conventional
  182. // full matrix storage to band storage for csbmv
  183. transform_to_band_storage(uplo, n, k, a, lda, data_csbmv.sb_matrix, ldm);
  184. BLASFUNC(cgemv)(&trans, &n, &n, alpha, data_csbmv.sb_matrix, &ldm, data_csbmv.b_test,
  185. &inc_b, beta, data_csbmv.c_verify, &inc_c);
  186. BLASFUNC(csbmv)(&uplo, &n, &k, alpha, a, &lda,
  187. data_csbmv.b_test, &inc_b, beta, data_csbmv.c_test, &inc_c);
  188. // Find the differences between output vector caculated by csbmv and cgemv
  189. for (i = 0; i < n * inc_c * 2; i++)
  190. data_csbmv.c_test[i] -= data_csbmv.c_verify[i];
  191. // Find the norm of differences
  192. return BLASFUNC(scnrm2)(&n, data_csbmv.c_test, &inc_c);
  193. }
  194. /**
  195. * Test csbmv by comparing it against cgemv
  196. * with the following options:
  197. *
  198. * a is upper-band-packed symmetric matrix
  199. * Number of rows and columns of A is 100
  200. * Stride of vector b_test is 1
  201. * Stride of vector c_test is 1
  202. * Number of super-diagonals k is 0
  203. */
  204. CTEST(csbmv, upper_k_0_inc_b_1_inc_c_1_n_100)
  205. {
  206. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  207. blasint k = 0;
  208. blasint lda = k + 1;
  209. blasint ldm = n;
  210. char uplo = 'U';
  211. float alpha[] = {1.0f, 1.0f};
  212. float beta[] = {1.0f, 1.0f};
  213. float norm = check_csbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  214. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS_ZGEMV);
  215. }
  216. /**
  217. * Test csbmv by comparing it against cgemv
  218. * with the following options:
  219. *
  220. * a is upper-band-packed symmetric matrix
  221. * Number of rows and columns of A is 100
  222. * Stride of vector b_test is 1
  223. * Stride of vector c_test is 1
  224. * Number of super-diagonals k is 1
  225. */
  226. CTEST(csbmv, upper_k_1_inc_b_1_inc_c_1_n_100)
  227. {
  228. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  229. blasint k = 1;
  230. blasint lda = k + 1;
  231. blasint ldm = n;
  232. char uplo = 'U';
  233. float alpha[] = {1.0f, 1.0f};
  234. float beta[] = {1.0f, 1.0f};
  235. float norm = check_csbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  236. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS_ZGEMV);
  237. }
  238. /**
  239. * Test csbmv by comparing it against cgemv
  240. * with the following options:
  241. *
  242. * a is upper-band-packed symmetric matrix
  243. * Number of rows and columns of A is 100
  244. * Stride of vector b_test is 1
  245. * Stride of vector c_test is 1
  246. * Number of super-diagonals k is 2
  247. */
  248. CTEST(csbmv, upper_k_2_inc_b_1_inc_c_1_n_100)
  249. {
  250. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  251. blasint k = 2;
  252. blasint lda = k + 1;
  253. blasint ldm = n;
  254. char uplo = 'U';
  255. float alpha[] = {1.0f, 1.0f};
  256. float beta[] = {1.0f, 1.0f};
  257. float norm = check_csbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  258. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS_ZGEMV);
  259. }
  260. /**
  261. * Test csbmv by comparing it against cgemv
  262. * with the following options:
  263. *
  264. * a is upper-band-packed symmetric matrix
  265. * Number of rows and columns of A is 100
  266. * Stride of vector b_test is 2
  267. * Stride of vector c_test is 1
  268. * Number of super-diagonals k is 2
  269. */
  270. CTEST(csbmv, upper_k_2_inc_b_2_inc_c_1_n_100)
  271. {
  272. blasint n = DATASIZE, inc_b = 2, inc_c = 1;
  273. blasint k = 2;
  274. blasint lda = k + 1;
  275. blasint ldm = n;
  276. char uplo = 'U';
  277. float alpha[] = {2.0f, 1.0f};
  278. float beta[] = {2.0f, 1.0f};
  279. float norm = check_csbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  280. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS_ZGEMV);
  281. }
  282. /**
  283. * Test csbmv by comparing it against cgemv
  284. * with the following options:
  285. *
  286. * a is upper-band-packed symmetric matrix
  287. * Number of rows and columns of A is 100
  288. * Stride of vector b_test is 2
  289. * Stride of vector c_test is 2
  290. * Number of super-diagonals k is 2
  291. */
  292. CTEST(csbmv, upper_k_2_inc_b_2_inc_c_2_n_100)
  293. {
  294. blasint n = DATASIZE, inc_b = 2, inc_c = 2;
  295. blasint k = 2;
  296. blasint lda = k + 1;
  297. blasint ldm = n;
  298. char uplo = 'U';
  299. float alpha[] = {2.0f, 1.0f};
  300. float beta[] = {2.0f, 1.0f};
  301. float norm = check_csbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  302. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS_ZGEMV);
  303. }
  304. /**
  305. * Test csbmv by comparing it against cgemv
  306. * with the following options:
  307. *
  308. * a is lower-band-packed symmetric matrix
  309. * Number of rows and columns of A is 100
  310. * Stride of vector b_test is 1
  311. * Stride of vector c_test is 1
  312. * Number of super-diagonals k is 0
  313. */
  314. CTEST(csbmv, lower_k_0_inc_b_1_inc_c_1_n_100)
  315. {
  316. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  317. blasint k = 0;
  318. blasint lda = k + 1;
  319. blasint ldm = n;
  320. char uplo = 'L';
  321. float alpha[] = {1.0f, 1.0f};
  322. float beta[] = {1.0f, 1.0f};
  323. float norm = check_csbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  324. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS_ZGEMV);
  325. }
  326. /**
  327. * Test csbmv by comparing it against cgemv
  328. * with the following options:
  329. *
  330. * a is lower-band-packed symmetric matrix
  331. * Number of rows and columns of A is 100
  332. * Stride of vector b_test is 1
  333. * Stride of vector c_test is 1
  334. * Number of super-diagonals k is 1
  335. */
  336. CTEST(csbmv, lower_k_1_inc_b_1_inc_c_1_n_100)
  337. {
  338. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  339. blasint k = 1;
  340. blasint lda = k + 1;
  341. blasint ldm = n;
  342. char uplo = 'L';
  343. float alpha[] = {1.0f, 1.0f};
  344. float beta[] = {1.0f, 1.0f};
  345. float norm = check_csbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  346. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS_ZGEMV);
  347. }
  348. /**
  349. * Test csbmv by comparing it against cgemv
  350. * with the following options:
  351. *
  352. * a is lower-band-packed symmetric matrix
  353. * Number of rows and columns of A is 100
  354. * Stride of vector b_test is 1
  355. * Stride of vector c_test is 1
  356. * Number of super-diagonals k is 2
  357. */
  358. CTEST(csbmv, lower_k_2_inc_b_1_inc_c_1_n_100)
  359. {
  360. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  361. blasint k = 2;
  362. blasint lda = k + 1;
  363. blasint ldm = n;
  364. char uplo = 'L';
  365. float alpha[] = {1.0f, 1.0f};
  366. float beta[] = {1.0f, 1.0f};
  367. float norm = check_csbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  368. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS_ZGEMV);
  369. }
  370. /**
  371. * Test csbmv by comparing it against cgemv
  372. * with the following options:
  373. *
  374. * a is lower-band-packed symmetric matrix
  375. * Number of rows and columns of A is 100
  376. * Stride of vector b_test is 2
  377. * Stride of vector c_test is 1
  378. * Number of super-diagonals k is 2
  379. */
  380. CTEST(csbmv, lower_k_2_inc_b_2_inc_c_1_n_100)
  381. {
  382. blasint n = DATASIZE, inc_b = 2, inc_c = 1;
  383. blasint k = 2;
  384. blasint lda = k + 1;
  385. blasint ldm = n;
  386. char uplo = 'L';
  387. float alpha[] = {2.0f, 1.0f};
  388. float beta[] = {2.0f, 1.0f};
  389. float norm = check_csbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  390. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS_ZGEMV);
  391. }
  392. /**
  393. * Test csbmv by comparing it against cgemv
  394. * with the following options:
  395. *
  396. * a is lower-band-packed symmetric matrix
  397. * Number of rows and columns of A is 100
  398. * Stride of vector b_test is 2
  399. * Stride of vector c_test is 2
  400. * Number of super-diagonals k is 2
  401. */
  402. CTEST(csbmv, lower_k_2_inc_b_2_inc_c_2_n_100)
  403. {
  404. blasint n = DATASIZE, inc_b = 2, inc_c = 2;
  405. blasint k = 2;
  406. blasint lda = k + 1;
  407. blasint ldm = n;
  408. char uplo = 'L';
  409. float alpha[] = {2.0f, 1.0f};
  410. float beta[] = {2.0f, 1.0f};
  411. float norm = check_csbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  412. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS_ZGEMV);
  413. }
  414. /**
  415. * Check if output matrix a contains any NaNs
  416. */
  417. CTEST(csbmv, check_for_NaN)
  418. {
  419. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  420. blasint k = 0;
  421. blasint lda = k + 1;
  422. blasint ldm = n;
  423. char uplo = 'U';
  424. float alpha[] = {1.0f, 1.0f};
  425. float beta[] = {1.0f, 1.0f};
  426. float norm = check_csbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  427. ASSERT_TRUE(norm == norm); /* NaN == NaN is false */
  428. }
  429. /**
  430. * Test error function for an invalid param uplo.
  431. * Uplo specifies whether a is in upper (U) or lower (L) band-packed storage mode.
  432. */
  433. CTEST(csbmv, xerbla_uplo_invalid)
  434. {
  435. blasint n = 1, inc_b = 1, inc_c = 1;
  436. char uplo = 'O';
  437. blasint k = 0;
  438. blasint lda = k + 1;
  439. int expected_info = 1;
  440. int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info);
  441. ASSERT_EQUAL(TRUE, passed);
  442. }
  443. /**
  444. * Test error function for an invalid param N -
  445. * number of rows and columns of A. Must be at least zero.
  446. */
  447. CTEST(csbmv, xerbla_n_invalid)
  448. {
  449. blasint n = INVALID, inc_b = 1, inc_c = 1;
  450. char uplo = 'U';
  451. blasint k = 0;
  452. blasint lda = k + 1;
  453. int expected_info = 2;
  454. int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info);
  455. ASSERT_EQUAL(TRUE, passed);
  456. }
  457. /**
  458. * Check if n - number of rows and columns of A equal zero.
  459. */
  460. CTEST(csbmv, check_n_zero)
  461. {
  462. blasint n = 0, inc_b = 1, inc_c = 1;
  463. blasint k = 0;
  464. blasint lda = k + 1;
  465. blasint ldm = 1;
  466. char uplo = 'U';
  467. float alpha[] = {1.0f, 1.0f};
  468. float beta[] = {0.0f, 0.0f};
  469. float norm = check_csbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  470. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS_ZGEMV);
  471. }
  472. /**
  473. * Test error function for an invalid param inc_b -
  474. * stride of vector b_test. Can't be zero.
  475. */
  476. CTEST(csbmv, xerbla_inc_b_zero)
  477. {
  478. blasint n = 1, inc_b = 0, inc_c = 1;
  479. char uplo = 'U';
  480. blasint k = 0;
  481. blasint lda = k + 1;
  482. int expected_info = 8;
  483. int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info);
  484. ASSERT_EQUAL(TRUE, passed);
  485. }
  486. /**
  487. * Test error function for an invalid param inc_c -
  488. * stride of vector c_test. Can't be zero.
  489. */
  490. CTEST(csbmv, xerbla_inc_c_zero)
  491. {
  492. blasint n = 1, inc_b = 1, inc_c = 0;
  493. char uplo = 'U';
  494. blasint k = 0;
  495. blasint lda = k + 1;
  496. int expected_info = 11;
  497. int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info);
  498. ASSERT_EQUAL(TRUE, passed);
  499. }
  500. /**
  501. * Test error function for an invalid param k -
  502. * number of super-diagonals of A. Must be at least zero.
  503. */
  504. CTEST(csbmv, xerbla_k_invalid)
  505. {
  506. blasint n = 1, inc_b = 1, inc_c = 1;
  507. char uplo = 'U';
  508. blasint k = INVALID;
  509. blasint lda = 1;
  510. int expected_info = 3;
  511. int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info);
  512. ASSERT_EQUAL(TRUE, passed);
  513. }
  514. /**
  515. * Test error function for an invalid param lda -
  516. * specifies the leading dimension of a. Must be at least (k+1).
  517. */
  518. CTEST(csbmv, xerbla_lda_invalid)
  519. {
  520. blasint n = 1, inc_b = 1, inc_c = 1;
  521. char uplo = 'U';
  522. blasint k = 0;
  523. blasint lda = INVALID;
  524. int expected_info = 6;
  525. int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info);
  526. ASSERT_EQUAL(TRUE, passed);
  527. }
  528. #endif