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

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