Behavior of cblas_zgemv when array contains nan.

In NumPy (actually originally in SciPy), we found a case where multiplying a complex matrix that contains inf+nanj by a complex vector could result in nan in the output vector in positions where the corresponding rows of the inputs did not contain nan. I have a C++ program and data to demonstrate this at https://github.com/WarrenWeckesser/experiments/tree/main/c%2B%2B/accelerate-zgemv-bug. When the full matrix CC is multiplied with the vector weights, the output at element 17 is nan. When just row 17 of CC is multiplied with weights, the result is not nan.

The matrix CC does have some occurrences of inf+nanj, but not in the row that produces element 17 of the output.

Is this a bug? Is there some way that the value inf+nanj in the input matrix can "contaminate" the output in a position that should give a non-nan value?

Behavior of cblas_zgemv when array contains nan.
 
 
Q