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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  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_ZSBMV {
  33. double sp_matrix[DATASIZE * (DATASIZE + 1)];
  34. double sb_matrix[DATASIZE * DATASIZE * 2];
  35. double b_test[DATASIZE * 2 * INCREMENT];
  36. double c_test[DATASIZE * 2 * INCREMENT];
  37. double c_verify[DATASIZE * 2 * INCREMENT];
  38. };
  39. // DOUBLE_EPS_ZGEMV = MAX_VAL * NUMBER OF OPERATIONS * DBL_EPSILON
  40. // DOUBLE_EPS_ZGEMV = 5.0 * O(100 * 100) * 2.2e-16 = 1e-11
  41. #define DOUBLE_EPS_ZGEMV 1e-11
  42. #ifdef BUILD_COMPLEX16
  43. static struct DATA_ZSBMV data_zsbmv;
  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, double* a, blasint lda,
  57. double* 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(double *sb_matrix, double *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.0)) > k)
  103. {
  104. sb_matrix[i * n * 2 + j] = 0.0;
  105. sb_matrix[i * n * 2 + j + 1] = 0.0;
  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 zsbmv
  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. double alpha[] = {1.0, 1.0};
  140. double beta[] = {0.0, 0.0};
  141. double a[2];
  142. drand_generate(a, 2);
  143. set_xerbla("ZSBMV ", expected_info);
  144. BLASFUNC(zsbmv)(&uplo, &n, &k, alpha, a, &lda, data_zsbmv.b_test,
  145. &inc_b, beta, data_zsbmv.c_test, &inc_c);
  146. return check_error();
  147. }
  148. /**
  149. * Comapare results computed by zsbmv and zgemv
  150. * since zsbmv is zgemv 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 double check_zsbmv(char uplo, blasint n, blasint k, double *alpha, blasint lda,
  164. blasint inc_b, double *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. double *a = (double*) malloc(lda * n * 2 * sizeof(double));
  171. // Fill symmetric packed matrix sp_matrix, vector b_test, vector c_test
  172. drand_generate(data_zsbmv.sp_matrix, n * (n + 1));
  173. drand_generate(data_zsbmv.b_test, n * inc_b * 2);
  174. drand_generate(data_zsbmv.c_test, n * inc_c * 2);
  175. // Copy vector c_test for zgemv
  176. for (i = 0; i < n * inc_c * 2; i++)
  177. data_zsbmv.c_verify[i] = data_zsbmv.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_zsbmv.sb_matrix, data_zsbmv.sp_matrix, n, k);
  181. // Transform symmetric band matrix from conventional
  182. // full matrix storage to band storage for zsbmv
  183. transform_to_band_storage(uplo, n, k, a, lda, data_zsbmv.sb_matrix, ldm);
  184. BLASFUNC(zgemv)(&trans, &n, &n, alpha, data_zsbmv.sb_matrix, &ldm, data_zsbmv.b_test,
  185. &inc_b, beta, data_zsbmv.c_verify, &inc_c);
  186. BLASFUNC(zsbmv)(&uplo, &n, &k, alpha, a, &lda,
  187. data_zsbmv.b_test, &inc_b, beta, data_zsbmv.c_test, &inc_c);
  188. free(a);
  189. // Find the differences between output vector caculated by zsbmv and zgemv
  190. for (i = 0; i < n * inc_c * 2; i++)
  191. data_zsbmv.c_test[i] -= data_zsbmv.c_verify[i];
  192. // Find the norm of differences
  193. return BLASFUNC(dznrm2)(&n, data_zsbmv.c_test, &inc_c);
  194. }
  195. /**
  196. * Test zsbmv by comparing it against zgemv
  197. * with the following options:
  198. *
  199. * a is upper-band-packed symmetric matrix
  200. * Number of rows and columns of A is 100
  201. * Stride of vector b_test is 1
  202. * Stride of vector c_test is 1
  203. * Number of super-diagonals k is 0
  204. */
  205. CTEST(zsbmv, upper_k_0_inc_b_1_inc_c_1_n_100)
  206. {
  207. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  208. blasint k = 0;
  209. blasint lda = k + 1;
  210. blasint ldm = n;
  211. char uplo = 'U';
  212. double alpha[] = {1.0, 1.0};
  213. double beta[] = {1.0, 1.0};
  214. double norm = check_zsbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  215. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS_ZGEMV);
  216. }
  217. /**
  218. * Test zsbmv by comparing it against zgemv
  219. * with the following options:
  220. *
  221. * a is upper-band-packed symmetric matrix
  222. * Number of rows and columns of A is 100
  223. * Stride of vector b_test is 1
  224. * Stride of vector c_test is 1
  225. * Number of super-diagonals k is 1
  226. */
  227. CTEST(zsbmv, upper_k_1_inc_b_1_inc_c_1_n_100)
  228. {
  229. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  230. blasint k = 1;
  231. blasint lda = k + 1;
  232. blasint ldm = n;
  233. char uplo = 'U';
  234. double alpha[] = {1.0, 1.0};
  235. double beta[] = {1.0, 1.0};
  236. double norm = check_zsbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  237. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS_ZGEMV);
  238. }
  239. /**
  240. * Test zsbmv by comparing it against zgemv
  241. * with the following options:
  242. *
  243. * a is upper-band-packed symmetric matrix
  244. * Number of rows and columns of A is 100
  245. * Stride of vector b_test is 1
  246. * Stride of vector c_test is 1
  247. * Number of super-diagonals k is 2
  248. */
  249. CTEST(zsbmv, upper_k_2_inc_b_1_inc_c_1_n_100)
  250. {
  251. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  252. blasint k = 2;
  253. blasint lda = k + 1;
  254. blasint ldm = n;
  255. char uplo = 'U';
  256. double alpha[] = {1.0, 1.0};
  257. double beta[] = {1.0, 1.0};
  258. double norm = check_zsbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  259. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS_ZGEMV);
  260. }
  261. /**
  262. * Test zsbmv by comparing it against zgemv
  263. * with the following options:
  264. *
  265. * a is upper-band-packed symmetric matrix
  266. * Number of rows and columns of A is 100
  267. * Stride of vector b_test is 2
  268. * Stride of vector c_test is 1
  269. * Number of super-diagonals k is 2
  270. */
  271. CTEST(zsbmv, upper_k_2_inc_b_2_inc_c_1_n_100)
  272. {
  273. blasint n = DATASIZE, inc_b = 2, inc_c = 1;
  274. blasint k = 2;
  275. blasint lda = k + 1;
  276. blasint ldm = n;
  277. char uplo = 'U';
  278. double alpha[] = {2.0, 1.0};
  279. double beta[] = {2.0, 1.0};
  280. double norm = check_zsbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  281. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS_ZGEMV);
  282. }
  283. /**
  284. * Test zsbmv by comparing it against zgemv
  285. * with the following options:
  286. *
  287. * a is upper-band-packed symmetric matrix
  288. * Number of rows and columns of A is 100
  289. * Stride of vector b_test is 2
  290. * Stride of vector c_test is 2
  291. * Number of super-diagonals k is 2
  292. */
  293. CTEST(zsbmv, upper_k_2_inc_b_2_inc_c_2_n_100)
  294. {
  295. blasint n = DATASIZE, inc_b = 2, inc_c = 2;
  296. blasint k = 2;
  297. blasint lda = k + 1;
  298. blasint ldm = n;
  299. char uplo = 'U';
  300. double alpha[] = {2.0, 1.0};
  301. double beta[] = {2.0, 1.0};
  302. double norm = check_zsbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  303. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS_ZGEMV);
  304. }
  305. /**
  306. * Test zsbmv by comparing it against zgemv
  307. * with the following options:
  308. *
  309. * a is lower-band-packed symmetric matrix
  310. * Number of rows and columns of A is 100
  311. * Stride of vector b_test is 1
  312. * Stride of vector c_test is 1
  313. * Number of super-diagonals k is 0
  314. */
  315. CTEST(zsbmv, lower_k_0_inc_b_1_inc_c_1_n_100)
  316. {
  317. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  318. blasint k = 0;
  319. blasint lda = k + 1;
  320. blasint ldm = n;
  321. char uplo = 'L';
  322. double alpha[] = {1.0, 1.0};
  323. double beta[] = {1.0, 1.0};
  324. double norm = check_zsbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  325. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS_ZGEMV);
  326. }
  327. /**
  328. * Test zsbmv by comparing it against zgemv
  329. * with the following options:
  330. *
  331. * a is lower-band-packed symmetric matrix
  332. * Number of rows and columns of A is 100
  333. * Stride of vector b_test is 1
  334. * Stride of vector c_test is 1
  335. * Number of super-diagonals k is 1
  336. */
  337. CTEST(zsbmv, lower_k_1_inc_b_1_inc_c_1_n_100)
  338. {
  339. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  340. blasint k = 1;
  341. blasint lda = k + 1;
  342. blasint ldm = n;
  343. char uplo = 'L';
  344. double alpha[] = {1.0, 1.0};
  345. double beta[] = {1.0, 1.0};
  346. double norm = check_zsbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  347. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS_ZGEMV);
  348. }
  349. /**
  350. * Test zsbmv by comparing it against zgemv
  351. * with the following options:
  352. *
  353. * a is lower-band-packed symmetric matrix
  354. * Number of rows and columns of A is 100
  355. * Stride of vector b_test is 1
  356. * Stride of vector c_test is 1
  357. * Number of super-diagonals k is 2
  358. */
  359. CTEST(zsbmv, lower_k_2_inc_b_1_inc_c_1_n_100)
  360. {
  361. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  362. blasint k = 2;
  363. blasint lda = k + 1;
  364. blasint ldm = n;
  365. char uplo = 'L';
  366. double alpha[] = {1.0, 1.0};
  367. double beta[] = {1.0, 1.0};
  368. double norm = check_zsbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  369. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS_ZGEMV);
  370. }
  371. /**
  372. * Test zsbmv by comparing it against zgemv
  373. * with the following options:
  374. *
  375. * a is lower-band-packed symmetric matrix
  376. * Number of rows and columns of A is 100
  377. * Stride of vector b_test is 2
  378. * Stride of vector c_test is 1
  379. * Number of super-diagonals k is 2
  380. */
  381. CTEST(zsbmv, lower_k_2_inc_b_2_inc_c_1_n_100)
  382. {
  383. blasint n = DATASIZE, inc_b = 2, inc_c = 1;
  384. blasint k = 2;
  385. blasint lda = k + 1;
  386. blasint ldm = n;
  387. char uplo = 'L';
  388. double alpha[] = {2.0, 1.0};
  389. double beta[] = {2.0, 1.0};
  390. double norm = check_zsbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  391. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS_ZGEMV);
  392. }
  393. /**
  394. * Test zsbmv by comparing it against zgemv
  395. * with the following options:
  396. *
  397. * a is lower-band-packed symmetric matrix
  398. * Number of rows and columns of A is 100
  399. * Stride of vector b_test is 2
  400. * Stride of vector c_test is 2
  401. * Number of super-diagonals k is 2
  402. */
  403. CTEST(zsbmv, lower_k_2_inc_b_2_inc_c_2_n_100)
  404. {
  405. blasint n = DATASIZE, inc_b = 2, inc_c = 2;
  406. blasint k = 2;
  407. blasint lda = k + 1;
  408. blasint ldm = n;
  409. char uplo = 'L';
  410. double alpha[] = {2.0, 1.0};
  411. double beta[] = {2.0, 1.0};
  412. double norm = check_zsbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  413. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS_ZGEMV);
  414. }
  415. /**
  416. * Check if output matrix a contains any NaNs
  417. */
  418. CTEST(zsbmv, check_for_NaN)
  419. {
  420. blasint n = DATASIZE, inc_b = 1, inc_c = 1;
  421. blasint k = 0;
  422. blasint lda = k + 1;
  423. blasint ldm = n;
  424. char uplo = 'U';
  425. double alpha[] = {1.0, 1.0};
  426. double beta[] = {1.0, 1.0};
  427. double norm = check_zsbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  428. ASSERT_TRUE(norm == norm); /* NaN == NaN is false */
  429. }
  430. /**
  431. * Test error function for an invalid param uplo.
  432. * Uplo specifies whether a is in upper (U) or lower (L) band-packed storage mode.
  433. */
  434. CTEST(zsbmv, xerbla_uplo_invalid)
  435. {
  436. blasint n = 1, inc_b = 1, inc_c = 1;
  437. char uplo = 'O';
  438. blasint k = 0;
  439. blasint lda = k + 1;
  440. int expected_info = 1;
  441. int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info);
  442. ASSERT_EQUAL(TRUE, passed);
  443. }
  444. /**
  445. * Test error function for an invalid param N -
  446. * number of rows and columns of A. Must be at least zero.
  447. */
  448. CTEST(zsbmv, xerbla_n_invalid)
  449. {
  450. blasint n = INVALID, inc_b = 1, inc_c = 1;
  451. char uplo = 'U';
  452. blasint k = 0;
  453. blasint lda = k + 1;
  454. int expected_info = 2;
  455. int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info);
  456. ASSERT_EQUAL(TRUE, passed);
  457. }
  458. /**
  459. * Check if n - number of rows and columns of A equal zero.
  460. */
  461. CTEST(zsbmv, check_n_zero)
  462. {
  463. blasint n = 0, inc_b = 1, inc_c = 1;
  464. blasint k = 0;
  465. blasint lda = k + 1;
  466. blasint ldm = 1;
  467. char uplo = 'U';
  468. double alpha[] = {1.0, 1.0};
  469. double beta[] = {0.0, 0.0};
  470. double norm = check_zsbmv(uplo, n, k, alpha, lda, inc_b, beta, inc_c, ldm);
  471. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS_ZGEMV);
  472. }
  473. /**
  474. * Test error function for an invalid param inc_b -
  475. * stride of vector b_test. Can't be zero.
  476. */
  477. CTEST(zsbmv, xerbla_inc_b_zero)
  478. {
  479. blasint n = 1, inc_b = 0, inc_c = 1;
  480. char uplo = 'U';
  481. blasint k = 0;
  482. blasint lda = k + 1;
  483. int expected_info = 8;
  484. int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info);
  485. ASSERT_EQUAL(TRUE, passed);
  486. }
  487. /**
  488. * Test error function for an invalid param inc_c -
  489. * stride of vector c_test. Can't be zero.
  490. */
  491. CTEST(zsbmv, xerbla_inc_c_zero)
  492. {
  493. blasint n = 1, inc_b = 1, inc_c = 0;
  494. char uplo = 'U';
  495. blasint k = 0;
  496. blasint lda = k + 1;
  497. int expected_info = 11;
  498. int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info);
  499. ASSERT_EQUAL(TRUE, passed);
  500. }
  501. /**
  502. * Test error function for an invalid param k -
  503. * number of super-diagonals of A. Must be at least zero.
  504. */
  505. CTEST(zsbmv, xerbla_k_invalid)
  506. {
  507. blasint n = 1, inc_b = 1, inc_c = 1;
  508. char uplo = 'U';
  509. blasint k = INVALID;
  510. blasint lda = 1;
  511. int expected_info = 3;
  512. int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info);
  513. ASSERT_EQUAL(TRUE, passed);
  514. }
  515. /**
  516. * Test error function for an invalid param lda -
  517. * specifies the leading dimension of a. Must be at least (k+1).
  518. */
  519. CTEST(zsbmv, xerbla_lda_invalid)
  520. {
  521. blasint n = 1, inc_b = 1, inc_c = 1;
  522. char uplo = 'U';
  523. blasint k = 0;
  524. blasint lda = INVALID;
  525. int expected_info = 6;
  526. int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info);
  527. ASSERT_EQUAL(TRUE, passed);
  528. }
  529. #endif