programmer's documentation
Functions
cs_blas.c File Reference
#include "cs_defs.h"
#include <math.h>
#include "cs_base.h"
#include "cs_parall.h"
#include "cs_blas.h"
Include dependency graph for cs_blas.c:

Functions

void cs_axpy (cs_lnum_t n, double a, const cs_real_t *x, cs_real_t *restrict y)
 Constant times a vector plus a vector: y <– ax + y. More...
 
double cs_dot (cs_lnum_t n, const cs_real_t *x, const cs_real_t *y)
 Return the dot product of 2 vectors: x.y. More...
 
double cs_gres (cs_lnum_t n, const cs_real_t *vol, const cs_real_t *x, const cs_real_t *y)
 Return the global residual of 2 extensive vectors: 1/sum(vol) . sum(X.Y/vol) More...
 
double cs_dot_xx (cs_lnum_t n, const cs_real_t *x)
 Return dot products of a vector with itself: x.x. More...
 
void cs_dot_xx_xy (cs_lnum_t n, const cs_real_t *restrict x, const cs_real_t *restrict y, double *xx, double *xy)
 Return 2 dot products of 2 vectors: x.x, and x.y. More...
 
void cs_dot_xy_yz (cs_lnum_t n, const cs_real_t *restrict x, const cs_real_t *restrict y, const cs_real_t *restrict z, double *xy, double *yz)
 Return 2 dot products of 3 vectors: x.x, and y.z. More...
 
void cs_dot_xx_xy_yz (cs_lnum_t n, const cs_real_t *restrict x, const cs_real_t *restrict y, const cs_real_t *restrict z, double *xx, double *xy, double *yz)
 Return 3 dot products of 3 vectors: x.x, x.y, and y.z. More...
 
void cs_dot_xx_yy_xy_xz_yz (cs_lnum_t n, const cs_real_t *restrict x, const cs_real_t *restrict y, const cs_real_t *restrict z, double *xx, double *yy, double *xy, double *xz, double *yz)
 Return 5 dot products of 3 vectors: x.x, y.y, x.y, x.z, and y.z. More...
 
double cs_gdot (cs_lnum_t n, const cs_real_t *x, const cs_real_t *y)
 Return the global dot product of 2 vectors: x.y. More...
 

Function Documentation

void cs_axpy ( cs_lnum_t  n,
double  a,
const cs_real_t x,
cs_real_t *restrict  y 
)

Constant times a vector plus a vector: y <– ax + y.

Parameters
[in]nsize of arrays x and y
[in]amultiplier for x
[in]xarray of floating-point values
[in,out]yarray of floating-point values
double cs_dot ( cs_lnum_t  n,
const cs_real_t x,
const cs_real_t y 
)

Return the dot product of 2 vectors: x.y.

Parameters
[in]nsize of arrays x and y
[in]xarray of floating-point values
[in]yarray of floating-point values
Returns
dot product
double cs_dot_xx ( cs_lnum_t  n,
const cs_real_t x 
)

Return dot products of a vector with itself: x.x.

For better precision, a superblock algorithm is used.

Parameters
[in]nsize of array x
[in]xarray of floating-point values
Returns
dot product
void cs_dot_xx_xy ( cs_lnum_t  n,
const cs_real_t *restrict  x,
const cs_real_t *restrict  y,
double *  xx,
double *  xy 
)

Return 2 dot products of 2 vectors: x.x, and x.y.

The products could be computed separately, but computing them simultaneously adds more optimization opportunities and possibly better cache behavior.

For better precision, a superblock algorithm is used.

Parameters
[in]nsize of arrays x and y
[in]xarray of floating-point values
[in]yarray of floating-point values
[out]xxx.x dot product
[out]xyx.y dot product
void cs_dot_xx_xy_yz ( cs_lnum_t  n,
const cs_real_t *restrict  x,
const cs_real_t *restrict  y,
const cs_real_t *restrict  z,
double *  xx,
double *  xy,
double *  yz 
)

Return 3 dot products of 3 vectors: x.x, x.y, and y.z.

The products could be computed separately, but computing them simultaneously adds more optimization opportunities and possibly better cache behavior.

For better precision, a superblock algorithm is used.

Parameters
[in]nsize of arrays x and y, and z
[in]xarray of floating-point values
[in]yarray of floating-point values
[in]zarray of floating-point values
[out]xxx.x dot product
[out]xyx.y dot product
[out]yzy.z dot product
void cs_dot_xx_yy_xy_xz_yz ( cs_lnum_t  n,
const cs_real_t *restrict  x,
const cs_real_t *restrict  y,
const cs_real_t *restrict  z,
double *  xx,
double *  yy,
double *  xy,
double *  xz,
double *  yz 
)

Return 5 dot products of 3 vectors: x.x, y.y, x.y, x.z, and y.z.

The products could be computed separately, but computing them simultaneously adds more optimization opportunities and possibly better cache behavior.

For better precision, a superblock algorithm is used.

Parameters
[in]nsize of arrays x and y, and z
[in]xarray of floating-point values
[in]yarray of floating-point values
[in]zarray of floating-point values
[out]xxx.x dot product
[out]yyy.y dot product
[out]xyx.y dot product
[out]xzx.z dot product
[out]yzy.z dot product
void cs_dot_xy_yz ( cs_lnum_t  n,
const cs_real_t *restrict  x,
const cs_real_t *restrict  y,
const cs_real_t *restrict  z,
double *  xy,
double *  yz 
)

Return 2 dot products of 3 vectors: x.x, and y.z.

The products could be computed separately, but computing them simultaneously adds more optimization opportunities and possibly better cache behavior.

For better precision, a superblock algorithm is used.

Parameters
[in]nsize of arrays x and y, and z
[in]xarray of floating-point values
[in]yarray of floating-point values
[in]zarray of floating-point values
[out]xyx.y dot product
[out]yzy.z dot product
double cs_gdot ( cs_lnum_t  n,
const cs_real_t x,
const cs_real_t y 
)

Return the global dot product of 2 vectors: x.y.

In parallel mode, the local results are summed on the default global communicator.

For better precision, a superblock algorithm is used.

Parameters
[in]nsize of arrays x and y
[in]xarray of floating-point values
[in]yarray of floating-point values
Returns
dot product
double cs_gres ( cs_lnum_t  n,
const cs_real_t vol,
const cs_real_t x,
const cs_real_t y 
)

Return the global residual of 2 extensive vectors: 1/sum(vol) . sum(X.Y/vol)

In parallel mode, the local results are summed on the default global communicator.

Parameters
[in]nsize of arrays x and y
[in]volarray of floating-point values
[in]xarray of floating-point values
[in]yarray of floating-point values
Returns
global residual