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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  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_COMATCOPY {
  32. float a_test[DATASIZE * DATASIZE * 2];
  33. float b_test[DATASIZE * DATASIZE * 2];
  34. float b_verify[DATASIZE * DATASIZE * 2];
  35. };
  36. #ifdef BUILD_COMPLEX
  37. static struct DATA_COMATCOPY data_comatcopy;
  38. /**
  39. * Comapare results computed by comatcopy 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 float check_comatcopy(char api, char order, char trans, blasint rows, blasint cols, float* 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. srand_generate(data_comatcopy.a_test, lda*m*2);
  77. if (trans == 'T' || trans == 'C') {
  78. ctranspose(m, n, alpha, data_comatcopy.a_test, lda, data_comatcopy.b_verify, ldb, conj);
  79. }
  80. else {
  81. ccopy(m, n, alpha, data_comatcopy.a_test, lda, data_comatcopy.b_verify, ldb, conj);
  82. }
  83. if (api == 'F') {
  84. BLASFUNC(comatcopy)(&order, &trans, &rows, &cols, alpha, data_comatcopy.a_test,
  85. &lda, data_comatcopy.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_comatcopy(corder, ctrans, rows, cols, alpha, data_comatcopy.a_test,
  95. lda, data_comatcopy.b_test, ldb);
  96. }
  97. return smatrix_difference(data_comatcopy.b_test, data_comatcopy.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. float alpha[] = {1.0f, 1.0f};
  117. set_xerbla("COMATCOPY", expected_info);
  118. BLASFUNC(comatcopy)(&order, &trans, &rows, &cols, alpha, data_comatcopy.a_test,
  119. &lda, data_comatcopy.b_test, &ldb);
  120. return check_error();
  121. }
  122. /**
  123. * Fortran API specific test
  124. * Test comatcopy 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(comatcopy, 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. float alpha[] = {1.0f, 2.0f};
  138. float norm = check_comatcopy('F', order, trans, m, n, alpha, lda, ldb);
  139. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  140. }
  141. /**
  142. * Fortran API specific test
  143. * Test comatcopy by comparing it against refernce
  144. * with the following options:
  145. *
  146. * Column Major
  147. * Transposition
  148. * alpha_r = -1.0, alpha_i = 2.0
  149. */
  150. CTEST(comatcopy, colmajor_trans_col_50_row_100)
  151. {
  152. blasint m = 100, n = 50;
  153. blasint lda = 100, ldb = 50;
  154. char order = 'C';
  155. char trans = 'T';
  156. float alpha[] = {-1.0f, 2.0f};
  157. float norm = check_comatcopy('F', order, trans, m, n, alpha, lda, ldb);
  158. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  159. }
  160. /**
  161. * Fortran API specific test
  162. * Test comatcopy by comparing it against refernce
  163. * with the following options:
  164. *
  165. * Column Major
  166. * Copy and conjugate
  167. * alpha_r = 1.0, alpha_i = 2.0
  168. */
  169. CTEST(comatcopy, colmajor_conj_col_100_row_100)
  170. {
  171. blasint m = 100, n = 100;
  172. blasint lda = 100, ldb = 100;
  173. char order = 'C';
  174. char trans = 'R';
  175. float alpha[] = {1.0f, 2.0f};
  176. float norm = check_comatcopy('F', order, trans, m, n, alpha, lda, ldb);
  177. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  178. }
  179. /**
  180. * Fortran API specific test
  181. * Test comatcopy by comparing it against refernce
  182. * with the following options:
  183. *
  184. * Column Major
  185. * Transposition and conjugate
  186. * alpha_r = 2.0, alpha_i = 1.0
  187. */
  188. CTEST(comatcopy, colmajor_conjtrnas_col_100_row_100)
  189. {
  190. blasint m = 100, n = 100;
  191. blasint lda = 100, ldb = 100;
  192. char order = 'C';
  193. char trans = 'C';
  194. float alpha[] = {2.0f, 1.0f};
  195. float norm = check_comatcopy('F', order, trans, m, n, alpha, lda, ldb);
  196. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  197. }
  198. /**
  199. * Fortran API specific test
  200. * Test comatcopy by comparing it against refernce
  201. * with the following options:
  202. *
  203. * Row Major
  204. * Copy only
  205. * alpha_r = 1.5, alpha_i = -1.0
  206. */
  207. CTEST(comatcopy, rowmajor_notrans_col_50_row_100)
  208. {
  209. blasint m = 100, n = 50;
  210. blasint lda = 50, ldb = 50;
  211. char order = 'R';
  212. char trans = 'N';
  213. float alpha[] = {1.5f, -1.0f};
  214. float norm = check_comatcopy('F', order, trans, m, n, alpha, lda, ldb);
  215. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  216. }
  217. /**
  218. * Fortran API specific test
  219. * Test comatcopy by comparing it against refernce
  220. * with the following options:
  221. *
  222. * Row Major
  223. * Transposition
  224. * alpha_r = 1.5, alpha_i = -1.0
  225. */
  226. CTEST(comatcopy, rowmajor_trans_col_100_row_50)
  227. {
  228. blasint m = 50, n = 100;
  229. blasint lda = 100, ldb = 50;
  230. char order = 'R';
  231. char trans = 'T';
  232. float alpha[] = {1.5f, -1.0f};
  233. float norm = check_comatcopy('F', order, trans, m, n, alpha, lda, ldb);
  234. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  235. }
  236. /**
  237. * Fortran API specific test
  238. * Test comatcopy by comparing it against refernce
  239. * with the following options:
  240. *
  241. * Row Major
  242. * Copy and conjugate
  243. * alpha_r = 1.5, alpha_i = -1.0
  244. */
  245. CTEST(comatcopy, rowmajor_conj_col_100_row_100)
  246. {
  247. blasint m = 100, n = 100;
  248. blasint lda = 100, ldb = 100;
  249. char order = 'R';
  250. char trans = 'R';
  251. float alpha[] = {1.5f, -1.0f};
  252. float norm = check_comatcopy('F', order, trans, m, n, alpha, lda, ldb);
  253. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  254. }
  255. /**
  256. * Fortran API specific test
  257. * Test comatcopy by comparing it against refernce
  258. * with the following options:
  259. *
  260. * Row Major
  261. * Transposition and conjugate
  262. * alpha_r = 1.0, alpha_i = 2.0
  263. */
  264. CTEST(comatcopy, rowmajor_conjtrans_col_100_row_100)
  265. {
  266. blasint m = 100, n = 100;
  267. blasint lda = 100, ldb = 100;
  268. char order = 'R';
  269. char trans = 'C';
  270. float alpha[] = {1.0f, 2.0f};
  271. float norm = check_comatcopy('F', order, trans, m, n, alpha, lda, ldb);
  272. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  273. }
  274. /**
  275. * C API specific test
  276. * Test comatcopy by comparing it against refernce
  277. * with the following options:
  278. *
  279. * Column Major
  280. * Copy only
  281. * alpha_r = 1.0, alpha_i = 2.0
  282. */
  283. CTEST(comatcopy, c_api_colmajor_notrans_col_50_row_100)
  284. {
  285. blasint m = 100, n = 50;
  286. blasint lda = 100, ldb = 100;
  287. char order = 'C';
  288. char trans = 'N';
  289. float alpha[] = {1.0f, 2.0f};
  290. float norm = check_comatcopy('C', order, trans, m, n, alpha, lda, ldb);
  291. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  292. }
  293. /**
  294. * C API specific test
  295. * Test comatcopy by comparing it against refernce
  296. * with the following options:
  297. *
  298. * Column Major
  299. * Transposition
  300. * alpha_r = -1.0, alpha_i = 2.0
  301. */
  302. CTEST(comatcopy, c_api_colmajor_trans_col_50_row_100)
  303. {
  304. blasint m = 100, n = 50;
  305. blasint lda = 100, ldb = 50;
  306. char order = 'C';
  307. char trans = 'T';
  308. float alpha[] = {-1.0f, 2.0f};
  309. float norm = check_comatcopy('C', order, trans, m, n, alpha, lda, ldb);
  310. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  311. }
  312. /**
  313. * C API specific test
  314. * Test comatcopy by comparing it against refernce
  315. * with the following options:
  316. *
  317. * Column Major
  318. * Copy and conjugate
  319. * alpha_r = 1.0, alpha_i = 2.0
  320. */
  321. CTEST(comatcopy, c_api_colmajor_conj_col_100_row_100)
  322. {
  323. blasint m = 100, n = 100;
  324. blasint lda = 100, ldb = 100;
  325. char order = 'C';
  326. char trans = 'R';
  327. float alpha[] = {1.0f, 2.0f};
  328. float norm = check_comatcopy('C', order, trans, m, n, alpha, lda, ldb);
  329. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  330. }
  331. /**
  332. * C API specific test
  333. * Test comatcopy by comparing it against refernce
  334. * with the following options:
  335. *
  336. * Column Major
  337. * Transposition and conjugate
  338. * alpha_r = 2.0, alpha_i = 1.0
  339. */
  340. CTEST(comatcopy, c_api_colmajor_conjtrnas_col_100_row_100)
  341. {
  342. blasint m = 100, n = 100;
  343. blasint lda = 100, ldb = 100;
  344. char order = 'C';
  345. char trans = 'C';
  346. float alpha[] = {2.0f, 1.0f};
  347. float norm = check_comatcopy('C', order, trans, m, n, alpha, lda, ldb);
  348. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  349. }
  350. /**
  351. * C API specific test
  352. * Test comatcopy by comparing it against refernce
  353. * with the following options:
  354. *
  355. * Row Major
  356. * Copy only
  357. * alpha_r = 1.5, alpha_i = -1.0
  358. */
  359. CTEST(comatcopy, c_api_rowmajor_notrans_col_50_row_100)
  360. {
  361. blasint m = 100, n = 50;
  362. blasint lda = 50, ldb = 50;
  363. char order = 'R';
  364. char trans = 'N';
  365. float alpha[] = {1.5f, -1.0f};
  366. float norm = check_comatcopy('C', order, trans, m, n, alpha, lda, ldb);
  367. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  368. }
  369. /**
  370. * C API specific test
  371. * Test comatcopy by comparing it against refernce
  372. * with the following options:
  373. *
  374. * Row Major
  375. * Transposition
  376. * alpha_r = 1.5, alpha_i = -1.0
  377. */
  378. CTEST(comatcopy, c_api_rowmajor_trans_col_100_row_50)
  379. {
  380. blasint m = 50, n = 100;
  381. blasint lda = 100, ldb = 50;
  382. char order = 'R';
  383. char trans = 'T';
  384. float alpha[] = {1.5f, -1.0f};
  385. float norm = check_comatcopy('C', order, trans, m, n, alpha, lda, ldb);
  386. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  387. }
  388. /**
  389. * C API specific test
  390. * Test comatcopy by comparing it against refernce
  391. * with the following options:
  392. *
  393. * Row Major
  394. * Copy and conjugate
  395. * alpha_r = 1.5, alpha_i = -1.0
  396. */
  397. CTEST(comatcopy, c_api_rowmajor_conj_col_100_row_100)
  398. {
  399. blasint m = 100, n = 100;
  400. blasint lda = 100, ldb = 100;
  401. char order = 'R';
  402. char trans = 'R';
  403. float alpha[] = {1.5f, -1.0f};
  404. float norm = check_comatcopy('C', order, trans, m, n, alpha, lda, ldb);
  405. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  406. }
  407. /**
  408. * C API specific test
  409. * Test comatcopy by comparing it against refernce
  410. * with the following options:
  411. *
  412. * Row Major
  413. * Transposition and conjugate
  414. * alpha_r = 1.0, alpha_i = 2.0
  415. */
  416. CTEST(comatcopy, c_api_rowmajor_conjtrans_col_100_row_100)
  417. {
  418. blasint m = 100, n = 100;
  419. blasint lda = 100, ldb = 100;
  420. char order = 'R';
  421. char trans = 'C';
  422. float alpha[] = {1.0f, 2.0f};
  423. float norm = check_comatcopy('C', order, trans, m, n, alpha, lda, ldb);
  424. ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
  425. }
  426. /**
  427. * Test error function for an invalid param order.
  428. * Must be column (C) or row major (R).
  429. */
  430. CTEST(comatcopy, xerbla_invalid_order)
  431. {
  432. blasint m = 100, n = 100;
  433. blasint lda = 100, ldb = 100;
  434. char order = 'O';
  435. char trans = 'T';
  436. int expected_info = 1;
  437. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  438. ASSERT_EQUAL(TRUE, passed);
  439. }
  440. /**
  441. * Test error function for an invalid param trans.
  442. * Must be trans (T/C) or no-trans (N/R).
  443. */
  444. CTEST(comatcopy, xerbla_invalid_trans)
  445. {
  446. blasint m = 100, n = 100;
  447. blasint lda = 100, ldb = 100;
  448. char order = 'C';
  449. char trans = 'O';
  450. int expected_info = 2;
  451. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  452. ASSERT_EQUAL(TRUE, passed);
  453. }
  454. /**
  455. * Test error function for an invalid param lda.
  456. * If matrices are stored using row major layout,
  457. * lda must be at least n.
  458. */
  459. CTEST(comatcopy, xerbla_rowmajor_invalid_lda)
  460. {
  461. blasint m = 50, n = 100;
  462. blasint lda = 50, ldb = 100;
  463. char order = 'R';
  464. char trans = 'T';
  465. int expected_info = 7;
  466. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  467. ASSERT_EQUAL(TRUE, passed);
  468. }
  469. /**
  470. * Test error function for an invalid param lda.
  471. * If matrices are stored using column major layout,
  472. * lda must be at least m.
  473. */
  474. CTEST(comatcopy, xerbla_colmajor_invalid_lda)
  475. {
  476. blasint m = 100, n = 50;
  477. blasint lda = 50, ldb = 100;
  478. char order = 'C';
  479. char trans = 'T';
  480. int expected_info = 7;
  481. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  482. ASSERT_EQUAL(TRUE, passed);
  483. }
  484. /**
  485. * Test error function for an invalid param ldb.
  486. * If matrices are stored using row major layout and
  487. * there is no transposition, ldb must be at least n.
  488. */
  489. CTEST(comatcopy, xerbla_rowmajor_notrans_invalid_ldb)
  490. {
  491. blasint m = 50, n = 100;
  492. blasint lda = 100, ldb = 50;
  493. char order = 'R';
  494. char trans = 'N';
  495. int expected_info = 9;
  496. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  497. ASSERT_EQUAL(TRUE, passed);
  498. }
  499. /**
  500. * Test error function for an invalid param ldb.
  501. * If matrices are stored using row major layout and
  502. * there is transposition, ldb must be at least m.
  503. */
  504. CTEST(comatcopy, xerbla_rowmajor_trans_invalid_ldb)
  505. {
  506. blasint m = 100, n = 50;
  507. blasint lda = 100, ldb = 50;
  508. char order = 'R';
  509. char trans = 'T';
  510. int expected_info = 9;
  511. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  512. ASSERT_EQUAL(TRUE, passed);
  513. }
  514. /**
  515. * Test error function for an invalid param ldb.
  516. * If matrices are stored using row major layout and
  517. * there is no transposition, ldb must be at least n.
  518. */
  519. CTEST(comatcopy, xerbla_rowmajor_conj_invalid_ldb)
  520. {
  521. blasint m = 50, n = 100;
  522. blasint lda = 100, ldb = 50;
  523. char order = 'R';
  524. char trans = 'R';
  525. int expected_info = 9;
  526. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  527. ASSERT_EQUAL(TRUE, passed);
  528. }
  529. /**
  530. * Test error function for an invalid param ldb.
  531. * If matrices are stored using row major layout and
  532. * there is transposition, ldb must be at least m.
  533. */
  534. CTEST(comatcopy, xerbla_rowmajor_transconj_invalid_ldb)
  535. {
  536. blasint m = 100, n = 50;
  537. blasint lda = 100, ldb = 50;
  538. char order = 'R';
  539. char trans = 'C';
  540. int expected_info = 9;
  541. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  542. ASSERT_EQUAL(TRUE, passed);
  543. }
  544. /**
  545. * Test error function for an invalid param ldb.
  546. * If matrices are stored using column major layout and
  547. * there is no transposition, ldb must be at least m.
  548. */
  549. CTEST(comatcopy, xerbla_colmajor_notrans_invalid_ldb)
  550. {
  551. blasint m = 100, n = 50;
  552. blasint lda = 100, ldb = 50;
  553. char order = 'C';
  554. char trans = 'N';
  555. int expected_info = 9;
  556. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  557. ASSERT_EQUAL(TRUE, passed);
  558. }
  559. /**
  560. * Test error function for an invalid param ldb.
  561. * If matrices are stored using column major layout and
  562. * there is transposition, ldb must be at least n.
  563. */
  564. CTEST(comatcopy, xerbla_colmajor_trans_invalid_ldb)
  565. {
  566. blasint m = 50, n = 100;
  567. blasint lda = 100, ldb = 50;
  568. char order = 'C';
  569. char trans = 'T';
  570. int expected_info = 9;
  571. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  572. ASSERT_EQUAL(TRUE, passed);
  573. }
  574. /**
  575. * Test error function for an invalid param ldb.
  576. * If matrices are stored using column major layout and
  577. * there is no transposition, ldb must be at least m.
  578. */
  579. CTEST(comatcopy, xerbla_colmajor_conj_invalid_ldb)
  580. {
  581. blasint m = 100, n = 50;
  582. blasint lda = 100, ldb = 50;
  583. char order = 'C';
  584. char trans = 'R';
  585. int expected_info = 9;
  586. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  587. ASSERT_EQUAL(TRUE, passed);
  588. }
  589. /**
  590. * Test error function for an invalid param ldb.
  591. * If matrices are stored using column major layout and
  592. * there is transposition, ldb must be at least n.
  593. */
  594. CTEST(comatcopy, xerbla_colmajor_transconj_invalid_ldb)
  595. {
  596. blasint m = 50, n = 100;
  597. blasint lda = 100, ldb = 50;
  598. char order = 'C';
  599. char trans = 'C';
  600. int expected_info = 9;
  601. int passed = check_badargs(order, trans, m, n, lda, ldb, expected_info);
  602. ASSERT_EQUAL(TRUE, passed);
  603. }
  604. #endif