| 
 | 1 | +# THE CBLAS C INTERFACE TO BLAS  | 
 | 2 | + | 
 | 3 | +## Contents  | 
 | 4 | +[1. Introduction](#1-introduction)  | 
 | 5 | + | 
 | 6 | +[1.1 Naming Schemes](#11-naming-schemes)  | 
 | 7 | + | 
 | 8 | +[1.2 Integers](#12-integers)  | 
 | 9 | + | 
 | 10 | +[2. Function List](#2-function-list)  | 
 | 11 | + | 
 | 12 | +[2.1 BLAS Level 1](#21-blas-level-1)  | 
 | 13 | + | 
 | 14 | +[2.2 BLAS Level 2](#22-blas-level-2)  | 
 | 15 | + | 
 | 16 | +[2.3 BLAS Level 3](#23-blas-level-3)  | 
 | 17 | + | 
 | 18 | +[3. Examples](#3-examples)  | 
 | 19 | + | 
 | 20 | +[3.1 Calling DGEMV](#31-calling-dgemv)  | 
 | 21 | + | 
 | 22 | +[3.2 Calling DGEMV_64](#32-calling-dgemv_64)  | 
 | 23 | + | 
 | 24 | +## 1. Introduction  | 
 | 25 | +This document describes CBLAS, the C language interface to the Basic Linear Algebra Subprograms (BLAS).  | 
 | 26 | +In comparison to BLAS Fortran interfaces CBLAS interfaces support both row-major and column-major matrix  | 
 | 27 | +ordering with the `layout` parameter.  | 
 | 28 | +The prototypes for CBLAS interfaces, associated macros and type definitions are contained in the header  | 
 | 29 | +file [cblas.h](../CBLAS/include/cblas.h)  | 
 | 30 | + | 
 | 31 | +### 1.1 Naming Schemes  | 
 | 32 | +The naming scheme for the CBLAS interface is to take the Fortran BLAS routine name, make it lower case,  | 
 | 33 | +and add the prefix `cblas_`. For example, the BLAS routine `DGEMM` becomes `cblas_dgemm`.  | 
 | 34 | + | 
 | 35 | +CBLAS routines also support `_64` suffix that enables large data arrays support in the LP64 interface library  | 
 | 36 | +(default build configuration). This suffix allows to mix LP64 and ILP64 programming models in one application.  | 
 | 37 | +For example, `cblas_dgemm` with 32-bit integer type support can be mixed with `cblas_dgemm_64`  | 
 | 38 | +that supports 64-bit integer type.   | 
 | 39 | + | 
 | 40 | +### 1.2 Integers  | 
 | 41 | +Variables with the Fortran type integer are converted to `CBLAS_INT` in CBLAS. By default  | 
 | 42 | +the CBLAS interface is built with 32-bit integer type, but it can be re-defined to 64-bit integer type.  | 
 | 43 | + | 
 | 44 | +## 2. Function List  | 
 | 45 | +This section contains the list of the currently available CBLAS interfaces.  | 
 | 46 | + | 
 | 47 | +### 2.1 BLAS Level 1  | 
 | 48 | +* Single Precision Real:  | 
 | 49 | +  ```  | 
 | 50 | +  SROTG SROTMG SROT SROTM SSWAP SSCAL  | 
 | 51 | +  SCOPY SAXPY SDOT  SDSDOT SNRM2 SASUM   | 
 | 52 | +  ISAMAX  | 
 | 53 | +  ```  | 
 | 54 | +* Double Precision Real:  | 
 | 55 | +  ```  | 
 | 56 | +  DROTG DROTMG DROT DROTM DSWAP DSCAL  | 
 | 57 | +  DCOPY DAXPY DDOT  DSDOT DNRM2 DASUM   | 
 | 58 | +  IDAMAX  | 
 | 59 | +  ```  | 
 | 60 | +* Single Precision Complex:  | 
 | 61 | +  ```  | 
 | 62 | +  CROTG CSROT CSWAP CSCAL CSSCAL CCOPY   | 
 | 63 | +  CAXPY CDOTU_SUB CDOTC_SUB ICAMAX SCABS1  | 
 | 64 | +  ```  | 
 | 65 | +* Double Precision Complex:  | 
 | 66 | +  ```  | 
 | 67 | +  ZROTG ZDROT ZSWAP ZSCAL ZDSCAL ZCOPY   | 
 | 68 | +  ZAXPY ZDOTU_SUB ZDOTC_SUB IZAMAX DCABS1  | 
 | 69 | +  DZNRM2 DZASUM  | 
 | 70 | +  ```  | 
 | 71 | +### 2.2 BLAS Level 2  | 
 | 72 | +* Single Precision Real:  | 
 | 73 | +  ```  | 
 | 74 | +  SGEMV SGBMV SGER  SSBMV SSPMV SSPR  | 
 | 75 | +  SSPR2 SSYMV SSYR  SSYR2 STBMV STBSV  | 
 | 76 | +  STPMV STPSV STRMV STRSV  | 
 | 77 | +  ```  | 
 | 78 | +* Double Precision Real:  | 
 | 79 | +  ```  | 
 | 80 | +  DGEMV DGBMV DGER  DSBMV DSPMV DSPR  | 
 | 81 | +  DSPR2 DSYMV DSYR  DSYR2 DTBMV DTBSV  | 
 | 82 | +  DTPMV DTPSV DTRMV DTRSV  | 
 | 83 | +  ```  | 
 | 84 | +* Single Precision Complex:  | 
 | 85 | +  ```  | 
 | 86 | +  CGEMV CGBMV CHEMV CHBMV CHPMV CTRMV  | 
 | 87 | +  CTBMV CTPMV CTRSV CTBSV CTPSV CGERU  | 
 | 88 | +  CGERC CHER  CHER2 CHPR  CHPR2  | 
 | 89 | +  ```  | 
 | 90 | +* Double Precision Complex:  | 
 | 91 | +  ```  | 
 | 92 | +  ZGEMV ZGBMV ZHEMV ZHBMV ZHPMV ZTRMV  | 
 | 93 | +  ZTBMV ZTPMV ZTRSV ZTBSV ZTPSV ZGERU  | 
 | 94 | +  ZGERC ZHER  ZHER2 ZHPR  ZHPR2  | 
 | 95 | +  ```  | 
 | 96 | +### 2.3 BLAS Level 3  | 
 | 97 | +* Single Precision Real:  | 
 | 98 | +  ```  | 
 | 99 | +  SGEMM SSYMM SSYRK SSERK2K STRMM STRSM  | 
 | 100 | +  ```  | 
 | 101 | +* Double Precision Real:  | 
 | 102 | +  ```  | 
 | 103 | +  DGEMM DSYMM DSYRK DSERK2K DTRMM DTRSM  | 
 | 104 | +  ```  | 
 | 105 | +* Single Precision Complex:  | 
 | 106 | +  ```  | 
 | 107 | +  CGEMM CSYMM CHEMM CHERK CHER2K CTRMM  | 
 | 108 | +  CTRSM CSYRK CSYR2K  | 
 | 109 | +  ```  | 
 | 110 | +* Double Precision Complex:  | 
 | 111 | +  ```  | 
 | 112 | +  ZGEMM ZSYMM ZHEMM ZHERK ZHER2K ZTRMM   | 
 | 113 | +  ZTRSM ZSYRK ZSYR2K  | 
 | 114 | +  ```  | 
 | 115 | + | 
 | 116 | +## 3. Examples  | 
 | 117 | +This section contains examples of calling CBLAS functions from a C program.  | 
 | 118 | + | 
 | 119 | +### 3.1 Calling DGEMV  | 
 | 120 | +The variable declarations should be as follows:  | 
 | 121 | +```  | 
 | 122 | +   double *a, *x, *y;  | 
 | 123 | +   double alpha, beta;  | 
 | 124 | +   CBLAS_INT m, n, lda, incx, incy;  | 
 | 125 | +```  | 
 | 126 | +The CBLAS function call is then:  | 
 | 127 | +```  | 
 | 128 | +cblas_dgemv( CblasColMajor, CblasNoTrans, m, n, alpha, a, lda, x, incx, beta,  | 
 | 129 | +                y, incy );  | 
 | 130 | +```  | 
 | 131 | + | 
 | 132 | +### 3.2 Calling DGEMV_64  | 
 | 133 | +The variable declarations should be as follows:  | 
 | 134 | +```  | 
 | 135 | +   double *a, *x, *y;  | 
 | 136 | +   double alpha, beta;  | 
 | 137 | +   int64_t m, n, lda, incx, incy;  | 
 | 138 | +```  | 
 | 139 | +The CBLAS function call is then:  | 
 | 140 | +```  | 
 | 141 | +cblas_dgemv_64( CblasColMajor, CblasNoTrans, m, n, alpha, a, lda, x, incx, beta,  | 
 | 142 | +                y, incy );  | 
 | 143 | +```  | 
0 commit comments