/usr/include/af/blas.h is in libarrayfire-dev 3.2.2+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | /*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
/** \file blas.h
*
* Contains BLAS related functions
*
* Contains functions for basic BLAS functionallity
*/
#pragma once
#include <af/defines.h>
#ifdef __cplusplus
namespace af
{
class array;
/**
\brief Matrix multiply of two arrays
\copydetails blas_func_matmul
\param[in] lhs The array object on the left hand side
\param[in] rhs The array object on the right hand side
\param[in] optLhs Transpose left hand side before the function is performed
\param[in] optRhs Transpose right hand side before the function is performed
\return The result of the matrix multiplication of lhs, rhs
\note optLhs and optRhs can only be one of \ref AF_MAT_NONE, \ref
AF_MAT_TRANS, \ref AF_MAT_CTRANS \note This function is not supported
in GFOR
\ingroup blas_func_matmul
*/
AFAPI array matmul(const array &lhs, const array &rhs,
const matProp optLhs = AF_MAT_NONE,
const matProp optRhs = AF_MAT_NONE);
/**
\brief Matrix multiply of two arrays
\copydetails blas_func_matmul
\param[in] lhs The array object on the left hand side
\param[in] rhs The array object on the right hand side
\return The result of the matrix multiplication of \p lhs, transpose(\p rhs)
\note This function is not supported in GFOR
\ingroup blas_func_matmul
*/
AFAPI array matmulNT(const array &lhs, const array &rhs);
/**
\brief Matrix multiply of two arrays
\copydetails blas_func_matmul
\param[in] lhs The array object on the left hand side
\param[in] rhs The array object on the right hand side
\return The result of the matrix multiplication of transpose(\p lhs), \p rhs
\note This function is not supported in GFOR
\ingroup blas_func_matmul
*/
AFAPI array matmulTN(const array &lhs, const array &rhs);
/**
\brief Matrix multiply of two arrays
\copydetails blas_func_matmul
\param[in] lhs The array object on the left hand side
\param[in] rhs The array object on the right hand side
\return The result of the matrix multiplication of transpose(\p lhs), transpose(\p rhs)
\note This function is not supported in GFOR
\ingroup blas_func_matmul
*/
AFAPI array matmulTT(const array &lhs, const array &rhs);
/**
\brief Chain 2 matrix multiplications
The matrix multiplications are done in a way to reduce temporary memory
\param[in] a The first array
\param[in] b The second array
\param[in] c The third array
\returns out = a x b x c
\note This function is not supported in GFOR
\ingroup blas_func_matmul
*/
AFAPI array matmul(const array &a, const array &b, const array &c);
/**
\brief Chain 3 matrix multiplications
The matrix multiplications are done in a way to reduce temporary memory
\param[in] a The first array
\param[in] b The second array
\param[in] c The third array
\param[in] d The fourth array
\returns out = a x b x c x d
\note This function is not supported in GFOR
\ingroup blas_func_matmul
*/
AFAPI array matmul(const array &a, const array &b, const array &c, const array &d);
/**
\brief Dot Product
Scalar dot product between two vectors. Also referred to as the inner
product.
\code
// compute scalar dot product
array x = randu(100), y = randu(100);
af_print(dot(x,y));
\endcode
\param[in] lhs The array object on the left hand side
\param[in] rhs The array object on the right hand side
\param[in] optLhs Options for lhs. Currently only \ref AF_MAT_NONE and
AF_MAT_CONJ are supported.
\param[in] optRhs Options for rhs. Currently only \ref AF_MAT_NONE and AF_MAT_CONJ are supported
\return The result of the dot product of lhs, rhs
\note optLhs and optRhs can only be one of \ref AF_MAT_NONE or \ref AF_MAT_CONJ
\note optLhs = AF_MAT_CONJ and optRhs = AF_MAT_NONE will run conjugate dot operation.
\note This function is not supported in GFOR
\returns out = dot(lhs, rhs)
\ingroup blas_func_dot
*/
AFAPI array dot (const array &lhs, const array &rhs,
const matProp optLhs = AF_MAT_NONE,
const matProp optRhs = AF_MAT_NONE);
/**
\brief Transposes a matrix
\copydetails blas_func_transpose
\param[in] in Input Matrix
\param[in] conjugate If true a congugate transposition is performed
\return Transposed matrix
\ingroup blas_func_transpose
*/
AFAPI array transpose(const array& in, const bool conjugate = false);
/**
\brief Transposes a matrix in-place
\copydetails blas_func_transpose
\param[in,out] in is the matrix to be transposed in place
\param[in] conjugate If true a congugate transposition is performed
\ingroup blas_func_transpose
*/
AFAPI void transposeInPlace(array& in, const bool conjugate = false);
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
\brief Matrix multiply of two \ref af_array
\details Performs a matrix multiplication on two arrays (lhs, rhs).
\param[out] out Pointer to the output \ref af_array
\param[in] lhs A 2D matrix \ref af_array object
\param[in] rhs A 2D matrix \ref af_array object
\param[in] optLhs Transpose left hand side before the function is performed
\param[in] optRhs Transpose right hand side before the function is performed
\return AF_SUCCESS if the process is successful.
\ingroup blas_func_matmul
*/
AFAPI af_err af_matmul( af_array *out ,
const af_array lhs, const af_array rhs,
const af_mat_prop optLhs, const af_mat_prop optRhs);
/**
Scalar dot product between two vectors. Also referred to as the inner
product.
\code
// compute scalar dot product
array x = randu(100), y = randu(100);
print(dot<float>(x,y));
\endcode
\ingroup blas_func_dot
*/
AFAPI af_err af_dot( af_array *out,
const af_array lhs, const af_array rhs,
const af_mat_prop optLhs, const af_mat_prop optRhs);
/**
\brief Transposes a matrix
This funciton will tranpose the matrix in.
\param[out] out The transposed matrix
\param[in] in Input matrix which will be transposed
\param[in] conjugate Perform a congugate transposition
\return AF_SUCCESS if the process is successful.
\ingroup blas_func_transpose
*/
AFAPI af_err af_transpose(af_array *out, af_array in, const bool conjugate);
/**
\brief Transposes a matrix in-place
\copydetails blas_func_transpose
\param[in,out] in is the matrix to be transposed in place
\param[in] conjugate If true a congugate transposition is performed
\ingroup blas_func_transpose
*/
AFAPI af_err af_transpose_inplace(af_array in, const bool conjugate);
#ifdef __cplusplus
}
#endif
|