Austin Schuh | 9a24b37 | 2018-01-28 16:12:29 -0800 | [diff] [blame] | 1 | \documentclass[a4paper]{report} |
| 2 | |
| 3 | \usepackage[margin=3.0cm]{geometry} |
| 4 | \usepackage{amsmath} |
| 5 | \usepackage[pdftex]{graphicx} |
| 6 | %\usepackage{graphics} |
| 7 | \usepackage{subfig} |
| 8 | |
| 9 | |
| 10 | |
| 11 | \title{BLASFEO reference guide} |
| 12 | \author{Gianluca Frison} |
| 13 | |
| 14 | |
| 15 | |
| 16 | \begin{document} |
| 17 | |
| 18 | \maketitle |
| 19 | \tableofcontents |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 26 | \chapter{Introduction} |
| 27 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 28 | |
| 29 | BLASFEO - BLAS For Embedded Optimization. |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 36 | \chapter{Matrix data type} |
| 37 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 38 | |
| 39 | The fundamental data type in BLASFEO is a C struct defining a matrix, called {\tt strmat}. |
| 40 | Depending on the chosen linear algebra library, the struct is defined differently. |
| 41 | |
| 42 | |
| 43 | |
| 44 | \section{{\tt strmat} definition} |
| 45 | |
| 46 | |
| 47 | \subsection{BLASFEO} |
| 48 | |
| 49 | \begin{verbatim} |
| 50 | struct d_strmat |
| 51 | { |
| 52 | int bs; |
| 53 | int m; |
| 54 | int n; |
| 55 | int pm; |
| 56 | int cn; |
| 57 | double *pA; |
| 58 | double *dA; |
| 59 | int use_dA; |
| 60 | int memory_size; |
| 61 | }; |
| 62 | \end{verbatim} |
| 63 | where the struct members are |
| 64 | \begin{description} |
| 65 | \item[bs] height of the panel |
| 66 | \item[m] number of rows |
| 67 | \item[n] number of columns |
| 68 | \item[pm] number of rows of the matrix as allocated in memory, used for memory alignment |
| 69 | \item[cn] number of rows of the matrix as allocated in memory, used for memory alignment |
| 70 | \item[pA] pointer to a pm$\times$pn array of doubles, the first element is aligned to cache line size |
| 71 | \item[dA] pointer to a min(m,n) array of doubles, used e.g. to store the inverse of the diagonal of the matrix |
| 72 | \item[use\_dA] flag to tell if dA contains useful information |
| 73 | \item[memory\_size] size of the memory (in bytes) needed for pA and pD |
| 74 | \end{description} |
| 75 | |
| 76 | |
| 77 | \subsection{BLAS} |
| 78 | |
| 79 | \begin{verbatim} |
| 80 | struct d_strmat |
| 81 | { |
| 82 | int m; // rows |
| 83 | int n; // cols |
| 84 | double *pA; // pointer to a m*n array of doubles |
| 85 | int memory_size; // size of needed memory |
| 86 | }; |
| 87 | \end{verbatim} |
| 88 | \begin{description} |
| 89 | \item[m] number of rows |
| 90 | \item[n] number of columns |
| 91 | \item[pA] pointer to a m$\times$n array of doubles |
| 92 | \item[memory\_size] size of the memory (in bytes) needed for pA |
| 93 | \end{description} |
| 94 | |
| 95 | |
| 96 | |
| 97 | \section{{\tt strmat} management} |
| 98 | |
| 99 | \begin{verbatim} |
| 100 | void d_allocate_strmat(int m, int n, struct d_strmat *sA); |
| 101 | \end{verbatim} |
| 102 | |
| 103 | \begin{verbatim} |
| 104 | void d_free_strmat(struct d_strmat *sA); |
| 105 | \end{verbatim} |
| 106 | |
| 107 | \begin{verbatim} |
| 108 | int d_size_strmat(int m, int n); |
| 109 | \end{verbatim} |
| 110 | |
| 111 | \begin{verbatim} |
| 112 | void d_create_strmat(int m, int n, struct d_strmat *sA, void *memory); |
| 113 | \end{verbatim} |
| 114 | |
| 115 | |
| 116 | |
| 117 | \section{{\tt strmat} conversion} |
| 118 | |
| 119 | \begin{verbatim} |
| 120 | void d_cvt_mat2strmat(int m, int n, double *A, int lda, struct d_strmat *sA, |
| 121 | int ai, int aj); |
| 122 | \end{verbatim} |
| 123 | |
| 124 | \begin{verbatim} |
| 125 | void d_cvt_tran_mat2strmat(int m, int n, double *A, int lda, struct d_strmat *sA, |
| 126 | int ai, int aj); |
| 127 | \end{verbatim} |
| 128 | |
| 129 | \begin{verbatim} |
| 130 | void d_cvt_strmat2mat(int m, int n, struct d_strmat *sA, int ai, int aj, |
| 131 | double *A, int lda); |
| 132 | \end{verbatim} |
| 133 | |
| 134 | \begin{verbatim} |
| 135 | void d_cvt_tran_strmat2mat(int m, int n, struct d_strmat *sA, int ai, int aj, |
| 136 | double *A, int lda); |
| 137 | \end{verbatim} |
| 138 | |
| 139 | |
| 140 | |
| 141 | \section{{\tt strmat} print} |
| 142 | |
| 143 | \begin{verbatim} |
| 144 | void d_print_strmat(int m, int n, struct d_strmat *sA, int ai, int aj); |
| 145 | \end{verbatim} |
| 146 | |
| 147 | |
| 148 | |
| 149 | \end{document} |