BeBOP Optimized Sparse Kernel Interface Library  1.0.1h
Functions
blas.c File Reference

OSKI wrappers around the dense BLAS routines. More...

#include <oski/common.h>
#include <oski/config.h>
#include <oski/blas.h>
#include <oski/blas_names.h>

Functions

void BLAS_xSCAL (const oski_index_t *restrict len, oski_value_t *restrict alpha, oski_value_t *restrict x, const oski_index_t *restrict stride)
 This implementation assumes a general (*alpha).
void BLAS_xAXPY (const oski_index_t *restrict len, const oski_value_t *restrict alpha, const oski_value_t *restrict x, const oski_index_t *restrict incx, oski_value_t *restrict y, const oski_index_t *restrict incy)
 This implementation assumes a general (*alpha).
static void ZeroDenseMatRowmaj (oski_value_t *x, oski_index_t m, oski_index_t n, oski_index_t stride)
 Set all elements of a dense matrix, stored using row-major layout, to 0.
static void ZeroDenseMatColmaj (oski_value_t *x, oski_index_t m, oski_index_t n, oski_index_t stride)
 Set all elements of a dense matrix, stored using column-major layout, to 0.
int oski_ZeroVecView (oski_vecview_t x)
 Set all elements of a vector view $x$ to zero.
int oski_ScaleVecView (oski_vecview_t x, oski_value_t alpha)
 Computes $x \leftarrow \alpha\cdot x$.
int oski_RectScaledIdentityMult (oski_value_t alpha, const oski_vecview_t x, oski_vecview_t y)
 Computes $y \leftarrow y + \alpha I_{m\times n}\cdot x$, where $I_{m\times n}$ is an $m\times n$ matrix such that $I(k,k) = 1$ for all $1 \leq k \leq \min(m,n)$.
int oski_AXPYVecView (const oski_vecview_t x, oski_value_t alpha, oski_vecview_t y)
 Computes $y \leftarrow y + \alpha\cdot x$.
int oski_ConjVecView (oski_vecview_t x)
 Computes the complex conjugate of a vector view, i.e., $x \leftarrow \bar{x}$.

Detailed Description

OSKI wrappers around the dense BLAS routines.


Function Documentation

void BLAS_xAXPY ( const oski_index_t *restrict  len,
const oski_value_t *restrict  alpha,
const oski_value_t *restrict  x,
const oski_index_t *restrict  incx,
oski_value_t *restrict  y,
const oski_index_t *restrict  incy 
)

This implementation assumes a general (*alpha).

The caller should implement special tests when alpha is a special value (e.g., 0, 1, -1).

Todo:
Correctly implement the negative stride case (not used in BeBOP).

Considers the following special cases:

  • Both x and y are unit-stride accessible.
  • Only x or y are unit-stride accessible.
  • Both x and y require strided access.

References VAL_MAC.

void BLAS_xSCAL ( const oski_index_t *restrict  len,
oski_value_t *restrict  alpha,
oski_value_t *restrict  x,
const oski_index_t *restrict  stride 
)

This implementation assumes a general (*alpha).

The caller should implement special tests when alpha is a special value (e.g., 0, 1, -1).

Todo:
Correctly implement the negative stride case (not used in BeBOP).

Considers the unit-stride special case.

References VAL_SCALE.

int oski_RectScaledIdentityMult ( oski_value_t  alpha,
const oski_vecview_t  x,
oski_vecview_t  y 
)

Computes $y \leftarrow y + \alpha I_{m\times n}\cdot x$, where $I_{m\times n}$ is an $m\times n$ matrix such that $I(k,k) = 1$ for all $1 \leq k \leq \min(m,n)$.

Precondition:
x and y must be valid views.

References oski_vecstruct_t::colinc, oski_vecstruct_t::num_cols, oski_vecstruct_t::num_rows, oski_vecstruct_t::orient, oski_vecstruct_t::rowinc, oski_vecstruct_t::stride, and oski_vecstruct_t::val.

int oski_ScaleVecView ( oski_vecview_t  x,
oski_value_t  alpha 
)

Set all elements of a vector view $x$ to zero.

Parameters:
[in]xValid vector view.
Returns:
0 on success, or an error code on err.

References ERR_BAD_VECVIEW, INVALID_VEC, LAYOUT_COLMAJ, LAYOUT_ROWMAJ, oski_vecstruct_t::num_cols, oski_vecstruct_t::num_rows, oski_vecstruct_t::orient, OSKI_ERR_BAD_VEC, oski_vecstruct_t::stride, oski_vecstruct_t::val, ZeroDenseMatColmaj(), and ZeroDenseMatRowmaj().

static void ZeroDenseMatColmaj ( oski_value_t *  x,
oski_index_t  m,
oski_index_t  n,
oski_index_t  stride 
) [static]

Set all elements of a dense matrix, stored using column-major layout, to 0.

Parameters:
[in,out]xArray storing the matrix.
[in]mLogical number of logical rows.
[in]nLogical number of logical columns.
[in]strideLeading-dimension.
Postcondition:
All elements of the logical matrix are set to 0.

References oski_ZeroMem(), VAL_SET_ZERO, and VECCM_GET.

Referenced by oski_ZeroVecView().

static void ZeroDenseMatRowmaj ( oski_value_t *  x,
oski_index_t  m,
oski_index_t  n,
oski_index_t  stride 
) [static]

Set all elements of a dense matrix, stored using row-major layout, to 0.

Parameters:
[in,out]xArray storing the matrix.
[in]mLogical number of logical rows.
[in]nLogical number of logical columns.
[in]strideLeading-dimension.
Postcondition:
All elements of the logical matrix are set to 0.

References oski_ZeroMem(), VAL_SET_ZERO, and VECRM_GET.

Referenced by oski_ZeroVecView().