cblas.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2017, Andrew W. Steiner
5 
6  This file is part of O2scl.
7 
8  O2scl is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  O2scl is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with O2scl. If not, see <http://www.gnu.org/licenses/>.
20 
21  -------------------------------------------------------------------
22 */
23 #ifndef O2SCL_CBLAS_H
24 #define O2SCL_CBLAS_H
25 
26 /** \file cblas.h
27  \brief Header wrapper for \ref cblas_base.h and documentation of
28  \ref o2scl_cblas, \ref o2scl_cblas_bracket, \ref o2scl_linalg
29  and \ref o2scl_linalg_bracket namespaces
30 */
31 
32 #include <cmath>
33 #include <o2scl/permutation.h>
34 
35 /** \brief Namespace for O2scl CBLAS function templates
36 
37  These functions are only intended as a fallback for situations
38  where an optimized BLAS is not available.
39 
40  <b>Level-1 BLAS functions</b>
41 
42  Some functionality which would otherwise appear here is
43  already given in \ref vector.h.
44  - The equivalent of <tt>dcopy()</tt> is given in \ref vector_copy()
45  except that the ordering is reversed (in \ref vector_copy() the
46  source preceeds the destination in the function argument list).
47  - The equivalent of <tt>dswap()</tt> is given in \ref vector_swap().
48  - The equivalent of <tt>idamax()</tt> is given in
49  \ref vector_max_index().
50 
51  <b>Level-2 BLAS functions</b>
52 
53  Currently only \ref dgemv(), \ref dtrmv(), and \ref dtrsv() are
54  implemented.
55 
56  <b>Level-3 BLAS functions</b>
57 
58  Currently only \ref dgemm() is implemented.
59 
60  <b>Helper BLAS functions</b>
61 
62  There are several basic BLAS functions which are helpful
63  to operate on only a part of a vector or matrix to
64  ensure that the linear algebra routines are flexible
65  with the types that they can handle.
66 
67  The subvector functions operate only one set of adjacent
68  vector elements. For a vector defined by
69  with
70  \f[
71  {\vec x} =
72  \left(
73  \begin{array}{c}
74  x_0 \\
75  x_1 \\
76  . \\
77  . \\
78  x_{\mathrm{ie}} \\
79  x_{\mathrm{ie}+1} \\
80  . \\
81  . \\
82  x_{\mathrm{N}-1} \\
83  x_{\mathrm{N}} \\
84  x_{\mathrm{N}+1} \\
85  . \\
86  .
87  \end{array}
88  \right)
89  \f]
90  the functions with suffix <tt>subvec</tt> operate only on
91  elements from \f$ x_{\mathrm{ie}} \f$ to \f$ x_{\mathrm{N}-1} \f$
92  (inclusive).
93 
94  The subcolumn functions operate only on a part of a column of
95  a matrix. For a matrix defined by
96  \f[
97  m = \left(
98  \begin{array}{ccccccc}
99  m_{0,0} & m_{0,1} & . & . & m_{0,\mathrm{ic}} & . & . \\
100  m_{1,0} & m_{1,1} & . & . & m_{1,\mathrm{ic}} & . & . \\
101  . & . & . & . & . & . & . \\
102  . & . & . & . & m_{\mathrm{ir},\mathrm{ic}} & . & . \\
103  . & . & . & . & m_{\mathrm{ir}+1,\mathrm{ic}} & . & . \\
104  . & . & . & . & . & . & . \\
105  . & . & . & . & . & . & . \\
106  . & . & . & . & m_{\mathrm{N}-1,\mathrm{ic}} & . & . \\
107  . & . & . & . & m_{\mathrm{N},\mathrm{ic}} & . & . \\
108  . & . & . & . & m_{\mathrm{N}+1,\mathrm{ic}} & . & . \\
109  . & . & . & . & . & . & . \\
110  \end{array}
111  \right)
112  \f]
113  the functions with suffix <tt>subcol</tt> operate only
114  on elements in the column from \f$ m_{\mathrm{ir},\mathrm{ic}} \f$
115  to \f$ m_{\mathrm{N}-1,\mathrm{ic}} \f$ inclusive.
116 
117  The subrow functions operate only on a part of a row of
118  a matrix. For a matrix defined by
119  \f[
120  m = \left(
121  \begin{array}{ccccccccccc}
122  m_{0,0} & m_{0,1} & . & . & . & . & . & . & . & . & . \\
123  m_{1,0} & m_{1,1} & . & . & . & . & . & . & . & . & . \\
124  . & . & . & . & . & . & . & . & . & . & . \\
125  . & . & . & . & . & . & . & . & . & . & . \\
126  m_{\mathrm{ir},0} & . & . &
127  m_{\mathrm{ir},\mathrm{ic}} &
128  m_{\mathrm{ir},\mathrm{ic}+1} &
129  . & . &
130  m_{\mathrm{ir},\mathrm{N}-1} &
131  m_{\mathrm{ir},\mathrm{N}} &
132  m_{\mathrm{ir},\mathrm{N}+1} &
133  . \\
134  . & . & . & . & . & . & . & . & . & . & . \\
135  \end{array}
136  \right)
137  \f]
138  the functions with suffix <tt>subrow</tt> operate only
139  on elements in the column from \f$ m_{\mathrm{ir},\mathrm{ic}} \f$
140  to \f$ m_{\mathrm{ir},\mathrm{N}-1} \f$ inclusive.
141 
142  This namespace is documented inside <tt>src/linalg/cblas.h</tt>.
143 */
144 namespace o2scl_cblas {
145 
146 #define O2SCL_IX(V,i) V[i]
147 #define O2SCL_IX2(M,i,j) M(i,j)
148 #include <o2scl/cblas_base.h>
149 #undef O2SCL_IX
150 #undef O2SCL_IX2
151 
152 }
153 
154 /** \brief Namespace for O2scl CBLAS function templates with operator[]
155 
156  This namespace contains an identical copy of all the functions given
157  in the \ref o2scl_cblas namespace, but perform matrix indexing
158  with <tt>[][]</tt> rather than <tt>(,)</tt>. See \ref o2scl_cblas
159  for the function listing and documentation.
160  */
162 
163 #define O2SCL_IX(V,i) V[i]
164 #define O2SCL_IX2(M,i,j) M[i][j]
165 #include <o2scl/cblas_base.h>
166 #undef O2SCL_IX
167 #undef O2SCL_IX2
168 
169 }
170 
171 /** \brief The namespace for linear algebra classes and functions
172 
173  See \ref linalg_section for more complete information
174  about linear algebra in \o2.
175 
176  This namespace documentation is in the file
177  <tt>src/base/cblas.h</tt>
178 */
179 namespace o2scl_linalg {
180 }
181 
182 /** \brief The namespace for linear algebra classes and functions
183  with operator()
184 
185  This namespace contains an identical copy of all the functions given
186  in the \ref o2scl_cblas namespace, but perform matrix indexing
187  with <tt>[][]</tt> rather than <tt>(,)</tt>. See \ref o2scl_linalg
188  for the function listing and documentation.
189 
190  See \ref linalg_section for more complete information
191  about linear algebra in \o2.
192 
193  This namespace documentation is in the file
194  <tt>src/base/cblas.h</tt>
195 */
196 namespace o2scl_linalg_bracket {
197 }
198 
199 
200 #endif
Namespace for O2scl CBLAS function templates with operator[].
Definition: cblas.h:161
The namespace for linear algebra classes and functions with operator()
Definition: bidiag.h:46
Namespace for O2scl CBLAS function templates.
Definition: cblas.h:144
The namespace for linear algebra classes and functions.
Definition: bidiag.h:36

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).