⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blas.texi

📁 开放gsl矩阵运算
💻 TEXI
📖 第 1 页 / 共 3 页
字号:
matrix @var{A} is symmetric.  When @var{Uplo} is @code{CblasUpper} thenthe upper triangle and diagonal of @var{A} are used, and when @var{Uplo}is @code{CblasLower} then the lower triangle and diagonal of @var{A} areused.@end deftypefun@deftypefun int gsl_blas_chemm (CBLAS_SIDE_t @var{Side}, CBLAS_UPLO_t @var{Uplo}, const gsl_complex_float @var{alpha}, const gsl_matrix_complex_float * @var{A}, const gsl_matrix_complex_float * @var{B}, const gsl_complex_float @var{beta}, gsl_matrix_complex_float * @var{C})@deftypefunx int gsl_blas_zhemm (CBLAS_SIDE_t @var{Side}, CBLAS_UPLO_t @var{Uplo}, const gsl_complex @var{alpha}, const gsl_matrix_complex * @var{A}, const gsl_matrix_complex * @var{B}, const gsl_complex @var{beta}, gsl_matrix_complex * @var{C})@cindex HEMM, Level-3 BLASThese functions compute the matrix-matrix product and sum @math{C =\alpha A B + \beta C} for @var{Side} is @code{CblasLeft} and @math{C =\alpha B A + \beta C} for @var{Side} is @code{CblasRight}, where thematrix @var{A} is hermitian.  When @var{Uplo} is @code{CblasUpper} thenthe upper triangle and diagonal of @var{A} are used, and when @var{Uplo}is @code{CblasLower} then the lower triangle and diagonal of @var{A} areused.  The imaginary elements of the diagonal are automatically set tozero.@end deftypefun@deftypefun int gsl_blas_strmm (CBLAS_SIDE_t @var{Side}, CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{TransA}, CBLAS_DIAG_t @var{Diag}, float @var{alpha}, const gsl_matrix_float * @var{A}, gsl_matrix_float * @var{B})@deftypefunx int gsl_blas_dtrmm (CBLAS_SIDE_t @var{Side}, CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{TransA}, CBLAS_DIAG_t @var{Diag}, double @var{alpha}, const gsl_matrix * @var{A}, gsl_matrix * @var{B})@deftypefunx int gsl_blas_ctrmm (CBLAS_SIDE_t @var{Side}, CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{TransA}, CBLAS_DIAG_t @var{Diag}, const gsl_complex_float @var{alpha}, const gsl_matrix_complex_float * @var{A}, gsl_matrix_complex_float * @var{B})@deftypefunx int gsl_blas_ztrmm (CBLAS_SIDE_t @var{Side}, CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{TransA}, CBLAS_DIAG_t @var{Diag}, const gsl_complex @var{alpha}, const gsl_matrix_complex * @var{A}, gsl_matrix_complex * @var{B})@cindex TRMM, Level-3 BLASThese functions compute the matrix-matrix product @math{B = \alpha op(A)B} for @var{Side} is @code{CblasLeft} and @math{B = \alpha B op(A)} for@var{Side} is @code{CblasRight}.  The matrix @var{A} is triangular and@math{op(A) = A}, @math{A^T}, @math{A^H} for @var{TransA} =@code{CblasNoTrans}, @code{CblasTrans}, @code{CblasConjTrans} When@var{Uplo} is @code{CblasUpper} then the upper triangle of @var{A} isused, and when @var{Uplo} is @code{CblasLower} then the lower triangleof @var{A} is used.  If @var{Diag} is @code{CblasNonUnit} then thediagonal of @var{A} is used, but if @var{Diag} is @code{CblasUnit} thenthe diagonal elements of the matrix @var{A} are taken as unity and arenot referenced.@end deftypefun@deftypefun int gsl_blas_strsm (CBLAS_SIDE_t @var{Side}, CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{TransA}, CBLAS_DIAG_t @var{Diag}, float @var{alpha}, const gsl_matrix_float * @var{A}, gsl_matrix_float * @var{B})@deftypefunx int gsl_blas_dtrsm (CBLAS_SIDE_t @var{Side}, CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{TransA}, CBLAS_DIAG_t @var{Diag}, double @var{alpha}, const gsl_matrix * @var{A}, gsl_matrix * @var{B})@deftypefunx int gsl_blas_ctrsm (CBLAS_SIDE_t @var{Side}, CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{TransA}, CBLAS_DIAG_t @var{Diag}, const gsl_complex_float @var{alpha}, const gsl_matrix_complex_float * @var{A}, gsl_matrix_complex_float * @var{B})@deftypefunx int gsl_blas_ztrsm (CBLAS_SIDE_t @var{Side}, CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{TransA}, CBLAS_DIAG_t @var{Diag}, const gsl_complex @var{alpha}, const gsl_matrix_complex * @var{A}, gsl_matrix_complex * @var{B})@cindex TRSM, Level-3 BLASThese functions compute the matrix-matrix product @math{B = \alpha op(inv(A))B} for @var{Side} is @code{CblasLeft} and @math{B = \alpha B op(inv(A))} for@var{Side} is @code{CblasRight}.  The matrix @var{A} is triangular and@math{op(A) = A}, @math{A^T}, @math{A^H} for @var{TransA} =@code{CblasNoTrans}, @code{CblasTrans}, @code{CblasConjTrans} When@var{Uplo} is @code{CblasUpper} then the upper triangle of @var{A} isused, and when @var{Uplo} is @code{CblasLower} then the lower triangleof @var{A} is used.  If @var{Diag} is @code{CblasNonUnit} then thediagonal of @var{A} is used, but if @var{Diag} is @code{CblasUnit} thenthe diagonal elements of the matrix @var{A} are taken as unity and arenot referenced.@end deftypefun@deftypefun int gsl_blas_ssyrk (CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{Trans}, float @var{alpha}, const gsl_matrix_float * @var{A}, float @var{beta}, gsl_matrix_float * @var{C})@deftypefunx int gsl_blas_dsyrk (CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{Trans}, double @var{alpha}, const gsl_matrix * @var{A}, double @var{beta}, gsl_matrix * @var{C})@deftypefunx int gsl_blas_csyrk (CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{Trans}, const gsl_complex_float @var{alpha}, const gsl_matrix_complex_float * @var{A}, const gsl_complex_float @var{beta}, gsl_matrix_complex_float * @var{C})@deftypefunx int gsl_blas_zsyrk (CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{Trans}, const gsl_complex @var{alpha}, const gsl_matrix_complex * @var{A}, const gsl_complex @var{beta}, gsl_matrix_complex * @var{C})@cindex SYRK, Level-3 BLASThese functions compute a rank-k update of the symmetric matrix @var{C},@math{C = \alpha A A^T + \beta C} when @var{Trans} is@code{CblasNoTrans} and @math{C = \alpha A^T A + \beta C} when@var{Trans} is @code{CblasTrans}.  Since the matrix @var{C} is symmetriconly its upper half or lower half need to be stored.  When @var{Uplo} is@code{CblasUpper} then the upper triangle and diagonal of @var{C} areused, and when @var{Uplo} is @code{CblasLower} then the lower triangleand diagonal of @var{C} are used.@end deftypefun@deftypefun int gsl_blas_cherk (CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{Trans}, float @var{alpha}, const gsl_matrix_complex_float * @var{A}, float @var{beta}, gsl_matrix_complex_float * @var{C})@deftypefunx int gsl_blas_zherk (CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{Trans}, double @var{alpha}, const gsl_matrix_complex * @var{A}, double @var{beta}, gsl_matrix_complex * @var{C})@cindex HERK, Level-3 BLASThese functions compute a rank-k update of the hermitian matrix @var{C},@math{C = \alpha A A^H + \beta C} when @var{Trans} is@code{CblasNoTrans} and @math{C = \alpha A^H A + \beta C} when@var{Trans} is @code{CblasTrans}.  Since the matrix @var{C} is hermitianonly its upper half or lower half need to be stored.  When @var{Uplo} is@code{CblasUpper} then the upper triangle and diagonal of @var{C} areused, and when @var{Uplo} is @code{CblasLower} then the lower triangleand diagonal of @var{C} are used.  The imaginary elements of thediagonal are automatically set to zero.@end deftypefun@deftypefun int gsl_blas_ssyr2k (CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{Trans}, float @var{alpha}, const gsl_matrix_float * @var{A}, const gsl_matrix_float * @var{B}, float @var{beta}, gsl_matrix_float * @var{C})@deftypefunx int gsl_blas_dsyr2k (CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{Trans}, double @var{alpha}, const gsl_matrix * @var{A}, const gsl_matrix * @var{B}, double @var{beta}, gsl_matrix * @var{C})@deftypefunx int gsl_blas_csyr2k (CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{Trans}, const gsl_complex_float @var{alpha}, const gsl_matrix_complex_float * @var{A}, const gsl_matrix_complex_float * @var{B}, const gsl_complex_float @var{beta}, gsl_matrix_complex_float * @var{C})@deftypefunx int gsl_blas_zsyr2k (CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{Trans}, const gsl_complex @var{alpha}, const gsl_matrix_complex * @var{A}, const gsl_matrix_complex * @var{B}, const gsl_complex @var{beta}, gsl_matrix_complex *@var{C})@cindex SYR2K, Level-3 BLASThese functions compute a rank-2k update of the symmetric matrix @var{C},@math{C = \alpha A B^T + \alpha B A^T + \beta C} when @var{Trans} is@code{CblasNoTrans} and @math{C = \alpha A^T B + \alpha B^T A + \beta C} when@var{Trans} is @code{CblasTrans}.  Since the matrix @var{C} is symmetriconly its upper half or lower half need to be stored.  When @var{Uplo} is@code{CblasUpper} then the upper triangle and diagonal of @var{C} areused, and when @var{Uplo} is @code{CblasLower} then the lower triangleand diagonal of @var{C} are used.@end deftypefun@deftypefun int gsl_blas_cher2k (CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{Trans}, const gsl_complex_float @var{alpha}, const gsl_matrix_complex_float * @var{A}, const gsl_matrix_complex_float * @var{B}, float @var{beta}, gsl_matrix_complex_float * @var{C})@deftypefunx int gsl_blas_zher2k (CBLAS_UPLO_t @var{Uplo}, CBLAS_TRANSPOSE_t @var{Trans}, const gsl_complex @var{alpha}, const gsl_matrix_complex * @var{A}, const gsl_matrix_complex * @var{B}, double @var{beta}, gsl_matrix_complex * @var{C})@cindex HER2K, Level-3 BLASThese functions compute a rank-2k update of the hermitian matrix @var{C},@math{C = \alpha A B^H + \alpha^* B A^H + \beta C} when @var{Trans} is@code{CblasNoTrans} and @math{C = \alpha A^H B + \alpha^* B^H A + \beta C} when@var{Trans} is @code{CblasTrans}.  Since the matrix @var{C} is hermitianonly its upper half or lower half need to be stored.  When @var{Uplo} is@code{CblasUpper} then the upper triangle and diagonal of @var{C} areused, and when @var{Uplo} is @code{CblasLower} then the lower triangleand diagonal of @var{C} are used.  The imaginary elements of thediagonal are automatically set to zero.@end deftypefun@node BLAS Examples@section ExamplesThe following program computes the product of two matrices using theLevel-3 @sc{blas} function @sc{dgemm},@tex\beforedisplay$$\left(\matrix{0.11&0.12&0.13\cr0.21&0.22&0.23\cr}\right)\left(\matrix{1011&1012\cr1021&1022\cr1031&1031\cr}\right)=\left(\matrix{367.76&368.12\cr674.06&674.72\cr}\right)$$\afterdisplay@end tex@ifinfo@example[ 0.11 0.12 0.13 ]  [ 1011 1012 ]     [ 367.76 368.12 ][ 0.21 0.22 0.23 ]  [ 1021 1022 ]  =  [ 674.06 674.72 ]                    [ 1031 1032 ]@end example@end ifinfo@noindentThe matrices are stored in row major order, according to the C convention for arrays.@example#include <stdio.h>#include <gsl/gsl_blas.h>intmain (void)@{  double a[] = @{ 0.11, 0.12, 0.13,                 0.21, 0.22, 0.23 @};  double b[] = @{ 1011, 1012,                 1021, 1022,                 1031, 1032 @};  double c[] = @{ 0.00, 0.00,                 0.00, 0.00 @};  gsl_matrix_view A = gsl_matrix_view_array(a, 2, 3);  gsl_matrix_view B = gsl_matrix_view_array(b, 3, 2);  gsl_matrix_view C = gsl_matrix_view_array(c, 2, 2);  /* Compute C = A B */  gsl_blas_dgemm (CblasNoTrans, CblasNoTrans,                  1.0, &A.matrix, &B.matrix,                  0.0, &C.matrix);  printf("[ %g, %g\n", c[0], c[1]);  printf("  %g, %g ]\n", c[2], c[3]);  return 0;  @}@end example@noindentHere is the output from the program,@example$ ./a.out[ 367.76, 368.12  674.06, 674.72 ]@end example@node BLAS References and Further Reading@section References and Further Reading@noindentInformation on the @sc{blas} standards, including both the legacy anddraft interface standards, is available online from the @sc{blas}Homepage and @sc{blas} Technical Forum web-site.@itemize @asis@item@cite{BLAS Homepage} @url{http://www.netlib.org/blas/}@item@cite{BLAS Technical Forum} @url{http://www.netlib.org/cgi-bin/checkout/blast/blast.pl}@end itemize@noindentThe following papers contain the specifications for Level 1, Level 2 andLevel 3 @sc{blas}.@itemize @asis@itemC. Lawson, R. Hanson, D. Kincaid, F. Krogh, "Basic Linear AlgebraSubprograms for Fortran Usage", @cite{ACM Transactions on MathematicalSoftware}, Vol. 5 (1979), Pages 308-325.@itemJ.J. Dongarra, J. DuCroz, S. Hammarling, R. Hanson, "An Extended Set ofFortran Basic Linear Algebra Subprograms", @cite{ACM Transactions onMathematical Software}, Vol. 14, No. 1 (1988), Pages 1-32.@itemJ.J. Dongarra, I. Duff, J. DuCroz, S. Hammarling, "A Set ofLevel 3 Basic Linear Algebra Subprograms", @cite{ACM Transactions onMathematical Software}, Vol. 16 (1990), Pages 1-28.@end itemize@noindentPostscript versions of the latter two papers are available from@url{http://www.netlib.org/blas/}. A @sc{cblas} wrapper for Fortran @sc{blas}libraries is available from the same location.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -