What is the rationale for the SAXPY routine of the BLAS specification (http://www.netlib.org/blas/#_level_1) to perform the update (1): Y = A * X + Y, rather than the new assignment (2): Z = A * X + Y ?
To perform Z = A * X + Y using (1), we need to do (pseudo code):
Z = Y
SAXPY(A,X,Z)
For arrays of size N, that is 1 extra O(N) array assignment when compared to (2): that seems less efficient. On top of that (2) allows (1) if vector Y is passed for the output Z vector so it would seem both more general and more efficient.
I would be very interested in hearing about the principles supporting the design choice of (1) over that of (2) in most implementations I've come around, e.g. LAPACK. Thank you very much.
question from:
https://stackoverflow.com/questions/65895072/why-blas-saxpy-updates-input-output-vector-y 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…