File blas.hpp

namespace boosting
class Blas
#include <blas.hpp>

Allows to execute BLAS routines.

Public Types

typedef double (*DdotFunction)(int *n, double *dx, int *incx, double *dy, int *incy)

A function pointer to BLAS’ DDOT routine.

typedef void (*DspmvFunction)(char *uplo, int *n, double *alpha, double *ap, double *x, int *incx, double *beta, double *y, int *incy)

A function pointer to BLAS’ DSPMV routine.

Public Functions

Blas(DdotFunction ddotFunction, DspmvFunction dspmvFunction)
Parameters:
  • ddotFunction – A function pointer to BLAS’ DDOT routine

  • dspmvFunction – A function pointer to BLAS’ DSPMV routine

float64 ddot(float64 *x, float64 *y, int n) const

Computes and returns the dot product x * y of two vectors x and y using BLAS’ DDOT routine (see https://www.netlib.org/lapack/explore-html/d1/dcc/group__dot_ga2a42ecc597403b22ad786715c739196b.html#ga2a42ecc597403b22ad786715c739196b).

Parameters:
  • x – A pointer to an array of type float64, shape (n), representing the first vector x

  • y – A pointer to an array of type float64, shape (n), representing the second vector y

  • n – The number of elements in the arrays x and y

Returns:

A scalar of type float64, representing the result of the dot product x * y

void dspmv(float64 *a, float64 *x, float64 *output, int n) const

Computes and returns the solution to the matrix-vector operation A * x using BLAS’ DSPMV routine (see https://www.netlib.org/lapack/explore-html/d0/d4b/group__hpmv_ga739f8dc2316523832bde2b237fcad8a6.html#ga739f8dc2316523832bde2b237fcad8a6).

DSPMV expects the matrix A to be a symmetric matrix with shape (n, n) and x to be an array with shape (n). The matrix A must be supplied in packed form, i.e., as an array with shape (n * (n + 1) / 2 ) that consists of the columns of A appended to each other and omitting all unspecified elements.

Parameters:
  • a – A pointer to an array of type float64, shape (n * (n + 1) / 2), representing the elements in the upper-right triangle of the matrix A in a packed form

  • x – A pointer to an array of type float64, shape (n), representing the elements in the array x

  • output – A pointer to an array of type float64, shape (n), the result of the matrix-vector operation A * x should be written to. May contain arbitrary values

  • n – The number of elements in the arrays a and x

Private Members

const DdotFunction ddotFunction_
const DspmvFunction dspmvFunction_