Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
374 views
in Technique[技术] by (71.8m points)

function - Why BLAS SAXPY updates input/output vector Y?

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...