| 1503 | |
| 1504 | template<typename typ> |
| 1505 | static inline void |
| 1506 | eigh_wrapper(char JOBZ, |
| 1507 | char UPLO, |
| 1508 | char**args, |
| 1509 | npy_intp const *dimensions, |
| 1510 | npy_intp const *steps) |
| 1511 | { |
| 1512 | using basetyp = basetype_t<typ>; |
| 1513 | ptrdiff_t outer_steps[3]; |
| 1514 | size_t iter; |
| 1515 | size_t outer_dim = *dimensions++; |
| 1516 | size_t op_count = (JOBZ=='N')?2:3; |
| 1517 | EIGH_PARAMS_t<typ> eigh_params; |
| 1518 | int error_occurred = get_fp_invalid_and_clear(); |
| 1519 | |
| 1520 | for (iter = 0; iter < op_count; ++iter) { |
| 1521 | outer_steps[iter] = (ptrdiff_t) steps[iter]; |
| 1522 | } |
| 1523 | steps += op_count; |
| 1524 | |
| 1525 | if (init_evd(&eigh_params, |
| 1526 | JOBZ, |
| 1527 | UPLO, |
| 1528 | (fortran_int)dimensions[0], dispatch_scalar<typ>())) { |
| 1529 | LINEARIZE_DATA_t matrix_in_ld; |
| 1530 | LINEARIZE_DATA_t eigenvectors_out_ld; |
| 1531 | LINEARIZE_DATA_t eigenvalues_out_ld; |
| 1532 | |
| 1533 | init_linearize_data(&matrix_in_ld, |
| 1534 | eigh_params.N, eigh_params.N, |
| 1535 | steps[1], steps[0]); |
| 1536 | init_linearize_data(&eigenvalues_out_ld, |
| 1537 | 1, eigh_params.N, |
| 1538 | 0, steps[2]); |
| 1539 | if ('V' == eigh_params.JOBZ) { |
| 1540 | init_linearize_data(&eigenvectors_out_ld, |
| 1541 | eigh_params.N, eigh_params.N, |
| 1542 | steps[4], steps[3]); |
| 1543 | } |
| 1544 | |
| 1545 | for (iter = 0; iter < outer_dim; ++iter) { |
| 1546 | int not_ok; |
| 1547 | /* copy the matrix in */ |
| 1548 | linearize_matrix((typ*)eigh_params.A, (typ*)args[0], &matrix_in_ld); |
| 1549 | not_ok = call_evd(&eigh_params); |
| 1550 | if (!not_ok) { |
| 1551 | /* lapack ok, copy result out */ |
| 1552 | delinearize_matrix((basetyp*)args[1], |
| 1553 | (basetyp*)eigh_params.W, |
| 1554 | &eigenvalues_out_ld); |
| 1555 | |
| 1556 | if ('V' == eigh_params.JOBZ) { |
| 1557 | delinearize_matrix((typ*)args[2], |
| 1558 | (typ*)eigh_params.A, |
| 1559 | &eigenvectors_out_ld); |
| 1560 | } |
| 1561 | } else { |
| 1562 | /* lapack fail, set result to nan */ |
nothing calls this directly
no test coverage detected