为什么BLAS没有加减法例程
Why are there no BLAS routines for addition and subtraction
在 BLAS 中有像
这样的例程
dscal scale a vector by a constant
dinit initialize a vector with given value
daxpy perform y = a*x + y
等等。但是显然没有向量加法或向量减法的例程。如果这是真的,那是什么原因呢?
特别是因为有例程执行更琐碎的操作,例如 dinit
或 dscal
。
当然可以使用 daxpy
和 a=1
或 a=-1
从给定向量执行 addition/subtraction,但在我看来这太复杂了。
为了找到合理的解释,我们必须回到 BLAS history
从那里我们可以了解到,Level 1 是在 70 年代设计的,远早于 Level 2、3 (
2 级为 1987 年,3 级为 1989 年)。
关于 1 级历史,在 CL Lawson 等人 1979 年的论文 Basic Linear Algebra Subprograms for Fortran Usage 中。我们可以阅读第 3 页
The criterion for including an operation in the package was that it
should involve just one level of looping and occur in the usual
algorithms of numerical linear algebra, such as Gaussian elimination
or the various elimination methods using orthogonal transformations.
本文基于 Hanson 等人于 1973 年 A Proposal for Standard Linear Algebra Subprograms 提出的初始规范。在本文档中,您可以再次阅读:
For example, it has been found [Krogh (1)] that the use of assembly
coded modules in a double precision program for solving linear
equations based on Householder transfZormations with column scaling
and column interchanges reduced the execution time on a Univac 1108 by
15% to 30% relative to the time required when carefully written
Fortran modules were used.
及之后
The operations which we feel belong in Class I according to the above
stated criteria are: (1) the dot product (inner product) of two
vectors, elementary vector operation, y := ax + y where x and y are
n-vectors and a is a scalar, and (3) the Givens 2 x 2 orthogonal
transformation applied to a 2 x n submatrix.
我们可以看到,主要关注点是使用线性替换、Givens 旋转或 Householder 变换来实现算法(线性求解器...)。在这种情况下,引用的参考文献中解释的最重要的操作是 axpy、缩放、点、范数等。目标不是提供一套完整的矢量操作,如加法、减法等……而只是集中在一小组程序上的努力。
在 BLAS 中有像
这样的例程dscal scale a vector by a constant
dinit initialize a vector with given value
daxpy perform y = a*x + y
等等。但是显然没有向量加法或向量减法的例程。如果这是真的,那是什么原因呢?
特别是因为有例程执行更琐碎的操作,例如 dinit
或 dscal
。
当然可以使用 daxpy
和 a=1
或 a=-1
从给定向量执行 addition/subtraction,但在我看来这太复杂了。
为了找到合理的解释,我们必须回到 BLAS history
从那里我们可以了解到,Level 1 是在 70 年代设计的,远早于 Level 2、3 ( 2 级为 1987 年,3 级为 1989 年)。
关于 1 级历史,在 CL Lawson 等人 1979 年的论文 Basic Linear Algebra Subprograms for Fortran Usage 中。我们可以阅读第 3 页
The criterion for including an operation in the package was that it should involve just one level of looping and occur in the usual algorithms of numerical linear algebra, such as Gaussian elimination or the various elimination methods using orthogonal transformations.
本文基于 Hanson 等人于 1973 年 A Proposal for Standard Linear Algebra Subprograms 提出的初始规范。在本文档中,您可以再次阅读:
For example, it has been found [Krogh (1)] that the use of assembly coded modules in a double precision program for solving linear equations based on Householder transfZormations with column scaling and column interchanges reduced the execution time on a Univac 1108 by 15% to 30% relative to the time required when carefully written Fortran modules were used.
及之后
The operations which we feel belong in Class I according to the above stated criteria are: (1) the dot product (inner product) of two vectors, elementary vector operation, y := ax + y where x and y are n-vectors and a is a scalar, and (3) the Givens 2 x 2 orthogonal transformation applied to a 2 x n submatrix.
我们可以看到,主要关注点是使用线性替换、Givens 旋转或 Householder 变换来实现算法(线性求解器...)。在这种情况下,引用的参考文献中解释的最重要的操作是 axpy、缩放、点、范数等。目标不是提供一套完整的矢量操作,如加法、减法等……而只是集中在一小组程序上的努力。