1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// The OpenBLAS argument-error checks: `DCHKE` in test/dblat2.f (Level 2) and
// test/dblat3.f (Level 3), with the XERBLA shim they depend on,
// test/xerbla_test.c, and ctest/c_xerbla.c with ctest/cblas_test.h, distributed
// in OpenMathLib/OpenBLAS 791b02a1a00c996b66a894f6df93421c53b62d80. Source
// URLs:
// https://github.com/OpenMathLib/OpenBLAS/blob/791b02a1a00c996b66a894f6df93421c53b62d80/test/dblat2.f
// https://github.com/OpenMathLib/OpenBLAS/blob/791b02a1a00c996b66a894f6df93421c53b62d80/test/dblat3.f
// https://github.com/OpenMathLib/OpenBLAS/blob/791b02a1a00c996b66a894f6df93421c53b62d80/ctest/cblas_test.h
// Original credits, from the file headers: Level 2 `DCHKE` was written on
// 10-August-1987 by Richard Hanson (Sandia National Labs) and Jeremy Du Croz
// (NAG Central Office); Level 3 `DCHKE` on 8-February-1989 by Jack Dongarra
// (Argonne National Laboratory), Iain Duff (AERE Harwell), Jeremy Du Croz and
// Sven Hammarling (Numerical Algorithms Group Ltd); `ctest/cblas_test.h` says
// "Written by Keita Teranishi", and `ctest/c_xerbla.c` carries no notice.
// Netlib BLAS test-program terms: faer/COPYING.BLAS.NETLIB. This Rust
// adaptation is new code under the crate's MIT licence.
//
// Material change: reference BLAS reports a bad argument by calling XERBLA with
// the argument's position, and the source test intercepts that call and
// compares the index. faer has no error return and no argument index; it
// rejects a bad shape with a panic that names the violated precondition, so
// each check below asserts the panic and its message instead of the index. What
// is ported is the rejection, not the reporting mechanism.
//
// The message is part of the assertion: a bare `should_panic` would also pass
// on an unrelated panic inside the call.
//
// `DCHKE` calls each routine with one argument deliberately inconsistent and
// relies on the routine rejecting it before the one-element arrays it passes
// are touched. faer cannot be exercised that way once its check is removed, so
// the shapes here are picked so that the unguarded call reads *less* than the
// arrays hold: the non-vacuity runs remove a check and must stay in bounds.
// That is a constraint on running the mutant, not a property of `DCHKE`.
//
// `matmul_with_conj`'s structure check (`dst_nrows == dst_ncols` for a
// non-dense destination) has no arm here: the unguarded kernel is not provably
// in-bounds for a non-square triangular destination, so removing that check is
// not a safe mutation to run.