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_zomatcopy.c 19 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  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. struct DATA_ZOMATCOPY {
  32. double a_test[DATASIZE * DATASIZE * 2];
  33. double b_test[DATASIZE * DATASIZE * 2];
  34. double b_verify[DATASIZE * DATASIZE * 2];
  35. };
  36. #ifdef BUILD_COMPLEX16
  37. static struct DATA_ZOMATCOPY data_zomatcopy;
  38. /**
  39. * Comapare results computed by zomatcopy and reference func
  40. *
  41. * param api specifies tested api (C or Fortran)
  42. * param order specifies row or column major order
  43. * param trans specifies op(A), the transposition operation
  44. * applied to the matrix A
  45. * param rows - number of rows of A
  46. * param cols - number of columns of A
  47. * param alpha - scaling factor for matrix B
  48. * param lda - leading dimension of the matrix A
  49. * param ldb - leading dimension of the matrix B
  50. * return norm of difference between openblas and reference func
  51. */
  52. static double check_zomatcopy(char api, char order, char trans, blasint rows, blasint cols, double* alpha,
  53. blasint lda, blasint ldb)
  54. {
  55. blasint b_rows, b_cols;
  56. blasint m, n;
  57. enum CBLAS_ORDER corder;
  58. enum CBLAS_TRANSPOSE ctrans;
  59. int conj = -1;
  60. if (order == 'C') {
  61. m = cols; n = rows;
  62. }
  63. else {
  64. m = rows; n = cols;
  65. }
  66. if(trans == 'T' || trans == 'C') {
  67. b_rows = n; b_cols = m*2;
  68. if (trans == 'C')
  69. conj = 1;
  70. }
  71. else {
  72. b_rows = m; b_cols = n*2;
  73. if (trans == 'R')
  74. conj = 1;
  75. }
  76. drand_generate(data_zomatcopy.a_test, lda*m*2);
  77. if (trans == 'T' || trans == 'C') {
  78. ztranspose(m, n, alpha, data_zomatcopy.a_test, lda, data_zomatcopy.b_verify, ldb, conj);
  79. }
  80. else {
  81. zcopy(m, n, alpha, data_zomatcopy.a_test, lda, data_zomatcopy.b_verify, ldb, conj);
  82. }
  83. if (api == 'F') {
  84. BLASFUNC(zomatcopy)(&order, &trans, &rows, &cols, alpha, data_zomatcopy.a_test,
  85. &lda, data_zomatcopy.b_test, &ldb);
  86. }
  87. else {
  88. if (order == 'C') corder = CblasColMajor;
  89. if (order == 'R') corder = CblasRowMajor;
  90. if (trans == 'T') ctrans = CblasTrans;
  91. if (trans == 'N') ctrans = CblasNoTrans;
  92. if (trans == 'C') ctrans = CblasConjTrans;
  93. if (trans == 'R') ctrans = CblasConjNoTrans;
  94. cblas_zomatcopy(corder, ctrans, rows, cols, alpha, data_zomatcopy.a_test,
  95. lda, data_zomatcopy.b_test, ldb);
  96. }
  97. return dmatrix_difference(data_zomatcopy.b_test, data_zomatcopy.b_verify, b_cols, b_rows, ldb*2);
  98. }
  99. /**
  100. * Check if error function was called with expected function name
  101. * and param info
  102. *
  103. * param order specifies row or column major order
  104. * param trans specifies op(A), the transposition operation
  105. * applied to the matrix A
  106. * param rows - number of rows of A
  107. * param cols - number of columns of A
  108. * param lda - leading dimension of the matrix A
  109. * param ldb - leading dimension of the matrix B
  110. * param expected_info - expected invalid parameter number
  111. * return TRUE if everything is ok, otherwise FALSE
  112. */
  113. static int check_badargs(char order, char trans, blasint rows, blasint cols,
  114. blasint lda, blasint ldb, int expected_info)
  115. {
  116. double alpha[] = {1.0, 1.0};
  117. set_xerbla("ZOMATCOPY", expected_info);
  118. BLASFUNC(zomatcopy)(&order, &trans, &rows, &cols, alpha, data_zomatcopy.a_test,
  119. &lda, data_zomatcopy.b_test, &ldb);
  120. return check_error();
  121. }
  122. /**
  123. * Fortran API specific test
  124. * Test zomatcopy by comparing it against refernce
  125. * with the following options:
  126. *
  127. * Column Major
  128. * Copy only
  129. * alpha_r = 1.0, alpha_i = 2.0
  130. */
  131. CTEST(zomatcopy, colmajor_notrans_col_50_row_100)
  132. {
  133. blasint m = 100, n = 50;
  134. blasint lda = 100, ldb = 100;
  135. char order = 'C';
  136. char trans = 'N';
  137. double alpha[] = {1.0, 2.0};
  138. double norm;
  139. norm = check_zomatcopy('F', order, trans, m, n, alpha, lda, ldb);
  140. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  141. }
  142. /**
  143. * Fortran API specific test
  144. * Test zomatcopy by comparing it against refernce
  145. * with the following options:
  146. *
  147. * Column Major
  148. * Transposition
  149. * alpha_r = -1.0, alpha_i = 2.0
  150. */
  151. CTEST(zomatcopy, colmajor_trans_col_50_row_100)
  152. {
  153. blasint m = 100, n = 50;
  154. blasint lda = 100, ldb = 50;
  155. char order = 'C';
  156. char trans = 'T';
  157. double alpha[] = {-1.0, 2.0};
  158. double norm;
  159. norm = check_zomatcopy('F', order, trans, m, n, alpha, lda, ldb);
  160. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  161. }
  162. /**
  163. * Fortran API specific test
  164. * Test zomatcopy by comparing it against refernce
  165. * with the following options:
  166. *
  167. * Column Major
  168. * Copy and conjugate
  169. * alpha_r = 1.0, alpha_i = 2.0
  170. */
  171. CTEST(zomatcopy, colmajor_conj_col_100_row_100)
  172. {
  173. blasint m = 100, n = 100;
  174. blasint lda = 100, ldb = 100;
  175. char order = 'C';
  176. char trans = 'R';
  177. double alpha[] = {1.0, 2.0};
  178. double norm;
  179. norm = check_zomatcopy('F', order, trans, m, n, alpha, lda, ldb);
  180. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  181. }
  182. /**
  183. * Fortran API specific test
  184. * Test zomatcopy by comparing it against refernce
  185. * with the following options:
  186. *
  187. * Column Major
  188. * Transposition and conjugate
  189. * alpha_r = 2.0, alpha_i = 1.0
  190. */
  191. CTEST(zomatcopy, colmajor_conjtrnas_col_100_row_100)
  192. {
  193. blasint m = 100, n = 100;
  194. blasint lda = 100, ldb = 100;
  195. char order = 'C';
  196. char trans = 'C';
  197. double alpha[] = {2.0, 1.0};
  198. double norm;
  199. norm = check_zomatcopy('F', order, trans, m, n, alpha, lda, ldb);
  200. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  201. }
  202. /**
  203. * Fortran API specific test
  204. * Fortran API specific test
  205. * Test zomatcopy by comparing it against refernce
  206. * with the following options:
  207. *
  208. * Row Major
  209. * Copy only
  210. * alpha_r = 1.5, alpha_i = -1.0
  211. */
  212. CTEST(zomatcopy, rowmajor_notrans_col_50_row_100)
  213. {
  214. blasint m = 100, n = 50;
  215. blasint lda = 50, ldb = 50;
  216. char order = 'R';
  217. char trans = 'N';
  218. double alpha[] = {1.5, -1.0};
  219. double norm;
  220. norm = check_zomatcopy('F', order, trans, m, n, alpha, lda, ldb);
  221. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  222. }
  223. /**
  224. * Fortran API specific test
  225. * Test zomatcopy by comparing it against refernce
  226. * with the following options:
  227. *
  228. * Row Major
  229. * Transposition
  230. * alpha_r = 1.5, alpha_i = -1.0
  231. */
  232. CTEST(zomatcopy, rowmajor_trans_col_100_row_50)
  233. {
  234. blasint m = 50, n = 100;
  235. blasint lda = 100, ldb = 50;
  236. char order = 'R';
  237. char trans = 'T';
  238. double alpha[] = {1.5, -1.0};
  239. double norm;
  240. norm = check_zomatcopy('F', order, trans, m, n, alpha, lda, ldb);
  241. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  242. }
  243. /**
  244. * Fortran API specific test
  245. * Test zomatcopy by comparing it against refernce
  246. * with the following options:
  247. *
  248. * Row Major
  249. * Copy and conjugate
  250. * alpha_r = 1.5, alpha_i = -1.0
  251. */
  252. CTEST(zomatcopy, rowmajor_conj_col_100_row_100)
  253. {
  254. blasint m = 100, n = 100;
  255. blasint lda = 100, ldb = 100;
  256. char order = 'R';
  257. char trans = 'R';
  258. double alpha[] = {1.5, -1.0};
  259. double norm;
  260. norm = check_zomatcopy('F', order, trans, m, n, alpha, lda, ldb);
  261. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  262. }
  263. /**
  264. * Fortran API specific test
  265. * Test zomatcopy by comparing it against refernce
  266. * with the following options:
  267. *
  268. * Row Major
  269. * Transposition and conjugate
  270. * alpha_r = 1.0, alpha_i = 2.0
  271. */
  272. CTEST(zomatcopy, rowmajor_conjtrans_col_100_row_100)
  273. {
  274. blasint m = 100, n = 100;
  275. blasint lda = 100, ldb = 100;
  276. char order = 'R';
  277. char trans = 'C';
  278. double alpha[] = {1.0, 2.0};
  279. double norm;
  280. norm = check_zomatcopy('F', order, trans, m, n, alpha, lda, ldb);
  281. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  282. }
  283. /**
  284. * C API specific test
  285. * Test zomatcopy by comparing it against refernce
  286. * with the following options:
  287. *
  288. * Column Major
  289. * Copy only
  290. * alpha_r = 1.0, alpha_i = 2.0
  291. */
  292. CTEST(zomatcopy, c_api_colmajor_notrans_col_50_row_100)
  293. {
  294. blasint m = 100, n = 50;
  295. blasint lda = 100, ldb = 100;
  296. char order = 'C';
  297. char trans = 'N';
  298. double alpha[] = {1.0, 2.0};
  299. double norm;
  300. norm = check_zomatcopy('C', order, trans, m, n, alpha, lda, ldb);
  301. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  302. }
  303. /**
  304. * C API specific test
  305. * Test zomatcopy by comparing it against refernce
  306. * with the following options:
  307. *
  308. * Column Major
  309. * Transposition
  310. * alpha_r = -1.0, alpha_i = 2.0
  311. */
  312. CTEST(zomatcopy, c_api_colmajor_trans_col_50_row_100)
  313. {
  314. blasint m = 100, n = 50;
  315. blasint lda = 100, ldb = 50;
  316. char order = 'C';
  317. char trans = 'T';
  318. double alpha[] = {-1.0, 2.0};
  319. double norm;
  320. norm = check_zomatcopy('C', order, trans, m, n, alpha, lda, ldb);
  321. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  322. }
  323. /**
  324. * C API specific test
  325. * Test zomatcopy by comparing it against refernce
  326. * with the following options:
  327. *
  328. * Column Major
  329. * Copy and conjugate
  330. * alpha_r = 1.0, alpha_i = 2.0
  331. */
  332. CTEST(zomatcopy, c_api_colmajor_conj_col_100_row_100)
  333. {
  334. blasint m = 100, n = 100;
  335. blasint lda = 100, ldb = 100;
  336. char order = 'C';
  337. char trans = 'R';
  338. double alpha[] = {1.0, 2.0};
  339. double norm;
  340. norm = check_zomatcopy('C', order, trans, m, n, alpha, lda, ldb);
  341. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  342. }
  343. /**
  344. * C API specific test
  345. * Test zomatcopy by comparing it against refernce
  346. * with the following options:
  347. *
  348. * Column Major
  349. * Transposition and conjugate
  350. * alpha_r = 2.0, alpha_i = 1.0
  351. */
  352. CTEST(zomatcopy, c_api_colmajor_conjtrnas_col_100_row_100)
  353. {
  354. blasint m = 100, n = 100;
  355. blasint lda = 100, ldb = 100;
  356. char order = 'C';
  357. char trans = 'C';
  358. double alpha[] = {2.0, 1.0};
  359. double norm;
  360. norm = check_zomatcopy('C', order, trans, m, n, alpha, lda, ldb);
  361. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  362. }
  363. /**
  364. * C API specific test
  365. * Test zomatcopy by comparing it against refernce
  366. * with the following options:
  367. *
  368. * Row Major
  369. * Copy only
  370. * alpha_r = 1.5, alpha_i = -1.0
  371. */
  372. CTEST(zomatcopy, c_api_rowmajor_notrans_col_50_row_100)
  373. {
  374. blasint m = 100, n = 50;
  375. blasint lda = 50, ldb = 50;
  376. char order = 'R';
  377. char trans = 'N';
  378. double alpha[] = {1.5, -1.0};
  379. double norm;
  380. norm = check_zomatcopy('C', order, trans, m, n, alpha, lda, ldb);
  381. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  382. }
  383. /**
  384. * C API specific test
  385. * Test zomatcopy by comparing it against refernce
  386. * with the following options:
  387. *
  388. * Row Major
  389. * Transposition
  390. * alpha_r = 1.5, alpha_i = -1.0
  391. */
  392. CTEST(zomatcopy, c_api_rowmajor_trans_col_100_row_50)
  393. {
  394. blasint m = 50, n = 100;
  395. blasint lda = 100, ldb = 50;
  396. char order = 'R';
  397. char trans = 'T';
  398. double alpha[] = {1.5, -1.0};
  399. double norm;
  400. norm = check_zomatcopy('C', order, trans, m, n, alpha, lda, ldb);
  401. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  402. }
  403. /**
  404. * C API specific test
  405. * Test zomatcopy by comparing it against refernce
  406. * with the following options:
  407. *
  408. * Row Major
  409. * Copy and conjugate
  410. * alpha_r = 1.5, alpha_i = -1.0
  411. */
  412. CTEST(zomatcopy, c_api_rowmajor_conj_col_100_row_100)
  413. {
  414. blasint m = 100, n = 100;
  415. blasint lda = 100, ldb = 100;
  416. char order = 'R';
  417. char trans = 'R';
  418. double alpha[] = {1.5, -1.0};
  419. double norm;
  420. norm = check_zomatcopy('C', order, trans, m, n, alpha, lda, ldb);
  421. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  422. }
  423. /**
  424. * C API specific test
  425. * Test zomatcopy by comparing it against refernce
  426. * with the following options:
  427. *
  428. * Row Major
  429. * Transposition and conjugate
  430. * alpha_r = 1.0, alpha_i = 2.0
  431. */
  432. CTEST(zomatcopy, c_api_rowmajor_conjtrans_col_100_row_100)
  433. {
  434. blasint m = 100, n = 100;
  435. blasint lda = 100, ldb = 100;
  436. char order = 'R';
  437. char trans = 'C';
  438. double alpha[] = {1.0, 2.0};
  439. double norm;
  440. norm = check_zomatcopy('C', order, trans, m, n, alpha, lda, ldb);
  441. ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
  442. }
  443. /**
  444. * Test error function for an invalid param order.
  445. * Must be column (C) or row major (R).
  446. */
  447. CTEST(zomatcopy, xerbla_invalid_order)
  448. {
  449. blasint m = 100, n = 100;
  450. blasint lda = 100, ldb = 100;
  451. char order = 'O';
  452. char trans = 'T';
  453. int expected_info = 1;
  454. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  455. ASSERT_EQUAL(TRUE, passed);
  456. }
  457. /**
  458. * Test error function for an invalid param trans.
  459. * Must be trans (T/C) or no-trans (N/R).
  460. */
  461. CTEST(zomatcopy, xerbla_invalid_trans)
  462. {
  463. blasint m = 100, n = 100;
  464. blasint lda = 100, ldb = 100;
  465. char order = 'C';
  466. char trans = 'O';
  467. int expected_info = 2;
  468. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  469. ASSERT_EQUAL(TRUE, passed);
  470. }
  471. /**
  472. * Test error function for an invalid param lda.
  473. * If matrices are stored using row major layout,
  474. * lda must be at least n.
  475. */
  476. CTEST(zomatcopy, xerbla_rowmajor_invalid_lda)
  477. {
  478. blasint m = 50, n = 100;
  479. blasint lda = 50, ldb = 100;
  480. char order = 'R';
  481. char trans = 'T';
  482. int expected_info = 7;
  483. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  484. ASSERT_EQUAL(TRUE, passed);
  485. }
  486. /**
  487. * Test error function for an invalid param lda.
  488. * If matrices are stored using column major layout,
  489. * lda must be at least m.
  490. */
  491. CTEST(zomatcopy, xerbla_colmajor_invalid_lda)
  492. {
  493. blasint m = 100, n = 50;
  494. blasint lda = 50, ldb = 100;
  495. char order = 'C';
  496. char trans = 'T';
  497. int expected_info = 7;
  498. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  499. ASSERT_EQUAL(TRUE, passed);
  500. }
  501. /**
  502. * Test error function for an invalid param ldb.
  503. * If matrices are stored using row major layout and
  504. * there is no transposition, ldb must be at least n.
  505. */
  506. CTEST(zomatcopy, xerbla_rowmajor_notrans_invalid_ldb)
  507. {
  508. blasint m = 50, n = 100;
  509. blasint lda = 100, ldb = 50;
  510. char order = 'R';
  511. char trans = 'N';
  512. int expected_info = 9;
  513. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  514. ASSERT_EQUAL(TRUE, passed);
  515. }
  516. /**
  517. * Test error function for an invalid param ldb.
  518. * If matrices are stored using row major layout and
  519. * there is transposition, ldb must be at least m.
  520. */
  521. CTEST(zomatcopy, xerbla_rowmajor_trans_invalid_ldb)
  522. {
  523. blasint m = 100, n = 50;
  524. blasint lda = 100, ldb = 50;
  525. char order = 'R';
  526. char trans = 'T';
  527. int expected_info = 9;
  528. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  529. ASSERT_EQUAL(TRUE, passed);
  530. }
  531. /**
  532. * Test error function for an invalid param ldb.
  533. * If matrices are stored using row major layout and
  534. * there is no transposition, ldb must be at least n.
  535. */
  536. CTEST(zomatcopy, xerbla_rowmajor_conj_invalid_ldb)
  537. {
  538. blasint m = 50, n = 100;
  539. blasint lda = 100, ldb = 50;
  540. char order = 'R';
  541. char trans = 'R';
  542. int expected_info = 9;
  543. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  544. ASSERT_EQUAL(TRUE, passed);
  545. }
  546. /**
  547. * Test error function for an invalid param ldb.
  548. * If matrices are stored using row major layout and
  549. * there is transposition, ldb must be at least m.
  550. */
  551. CTEST(zomatcopy, xerbla_rowmajor_transconj_invalid_ldb)
  552. {
  553. blasint m = 100, n = 50;
  554. blasint lda = 100, ldb = 50;
  555. char order = 'R';
  556. char trans = 'C';
  557. int expected_info = 9;
  558. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  559. ASSERT_EQUAL(TRUE, passed);
  560. }
  561. /**
  562. * Test error function for an invalid param ldb.
  563. * If matrices are stored using column major layout and
  564. * there is no transposition, ldb must be at least m.
  565. */
  566. CTEST(zomatcopy, xerbla_colmajor_notrans_invalid_ldb)
  567. {
  568. blasint m = 100, n = 50;
  569. blasint lda = 100, ldb = 50;
  570. char order = 'C';
  571. char trans = 'N';
  572. int expected_info = 9;
  573. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  574. ASSERT_EQUAL(TRUE, passed);
  575. }
  576. /**
  577. * Test error function for an invalid param ldb.
  578. * If matrices are stored using column major layout and
  579. * there is transposition, ldb must be at least n.
  580. */
  581. CTEST(zomatcopy, xerbla_colmajor_trans_invalid_ldb)
  582. {
  583. blasint m = 50, n = 100;
  584. blasint lda = 100, ldb = 50;
  585. char order = 'C';
  586. char trans = 'T';
  587. int expected_info = 9;
  588. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  589. ASSERT_EQUAL(TRUE, passed);
  590. }
  591. /**
  592. * Test error function for an invalid param ldb.
  593. * If matrices are stored using column major layout and
  594. * there is no transposition, ldb must be at least m.
  595. */
  596. CTEST(zomatcopy, xerbla_colmajor_conj_invalid_ldb)
  597. {
  598. blasint m = 100, n = 50;
  599. blasint lda = 100, ldb = 50;
  600. char order = 'C';
  601. char trans = 'R';
  602. int expected_info = 9;
  603. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  604. ASSERT_EQUAL(TRUE, passed);
  605. }
  606. /**
  607. * Test error function for an invalid param ldb.
  608. * If matrices are stored using column major layout and
  609. * there is transposition, ldb must be at least n.
  610. */
  611. CTEST(zomatcopy, xerbla_colmajor_transconj_invalid_ldb)
  612. {
  613. blasint m = 50, n = 100;
  614. blasint lda = 100, ldb = 50;
  615. char order = 'C';
  616. char trans = 'C';
  617. int expected_info = 9;
  618. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  619. ASSERT_EQUAL(TRUE, passed);
  620. }
  621. #endif