GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
blas_level_1.c File Reference
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/gmath.h>
Include dependency graph for blas_level_1.c:

Go to the source code of this file.

Functions

void G_math_d_x_dot_y (double *x, double *y, double *value, int rows)
 Compute the dot product of vector x and y. More...
 
void G_math_d_euclid_norm (double *x, double *value, int rows)
 Compute the euclid norm of vector x. More...
 
void G_math_d_asum_norm (double *x, double *value, int rows)
 Compute the asum norm of vector x. More...
 
void G_math_d_max_norm (double *x, double *value, int rows)
 Compute the maximum norm of vector x. More...
 
void G_math_d_ax_by (double *x, double *y, double *z, double a, double b, int rows)
 Scales vectors x and y with the scalars a and b and adds them. More...
 
void G_math_d_copy (double *x, double *y, int rows)
 Copy the vector x to y. More...
 
void G_math_f_x_dot_y (float *x, float *y, float *value, int rows)
 Compute the dot product of vector x and y. More...
 
void G_math_f_euclid_norm (float *x, float *value, int rows)
 Compute the euclid norm of vector x. More...
 
void G_math_f_asum_norm (float *x, float *value, int rows)
 Compute the asum norm of vector x. More...
 
void G_math_f_max_norm (float *x, float *value, int rows)
 Compute the maximum norm of vector x. More...
 
void G_math_f_ax_by (float *x, float *y, float *z, float a, float b, int rows)
 Scales vectors x and y with the scalars a and b and adds them. More...
 
void G_math_f_copy (float *x, float *y, int rows)
 Copy the vector x to y. More...
 
void G_math_i_x_dot_y (int *x, int *y, double *value, int rows)
 Compute the dot product of vector x and y. More...
 
void G_math_i_euclid_norm (int *x, double *value, int rows)
 Compute the euclid norm of vector x. More...
 
void G_math_i_asum_norm (int *x, double *value, int rows)
 Compute the asum norm of vector x. More...
 
void G_math_i_max_norm (int *x, int *value, int rows)
 Compute the maximum norm of vector x. More...
 
void G_math_i_ax_by (int *x, int *y, int *z, int a, int b, int rows)
 Scales vectors x and y with the scalars a and b and adds them. More...
 
void G_math_i_copy (int *x, int *y, int rows)
 Copy the vector x to y. More...
 

Function Documentation

◆ G_math_d_asum_norm()

void G_math_d_asum_norm ( double *  x,
double *  value,
int  rows 
)

Compute the asum norm of vector x.

\[ a = ||{\bf x}||_1 \]

The functions creates its own parallel OpenMP region. It can be called within a parallel OpenMP region if nested parallelism is supported by the compiler.

Parameters
x(double *)– the vector
value(double *) – the return value
rows(int)
Returns
(void)

Definition at line 112 of file blas_level_1.c.

Referenced by G_math_dasum().

◆ G_math_d_ax_by()

void G_math_d_ax_by ( double *  x,
double *  y,
double *  z,
double  a,
double  b,
int  rows 
)

Scales vectors x and y with the scalars a and b and adds them.

\[ {\bf z} = a{\bf x} + b{\bf y} \]

This function is multi-threaded with OpenMP and can be called within a parallel OpenMP region.

Parameters
x(double *)
y(double *)
z(double *)
a(double)
b(double)
rows(int)
Returns
(void)

Definition at line 173 of file blas_level_1.c.

◆ G_math_d_copy()

void G_math_d_copy ( double *  x,
double *  y,
int  rows 
)

Copy the vector x to y.

\[ {\bf y} = {\bf x} \]

This function is not multi-threaded

Parameters
x(double *)
y(double *)
rows(int)

Definition at line 237 of file blas_level_1.c.

Referenced by G_math_dcopy().

◆ G_math_d_euclid_norm()

void G_math_d_euclid_norm ( double *  x,
double *  value,
int  rows 
)

Compute the euclid norm of vector x.

\[ a = ||{\bf x}||_2 \]

The functions creates its own parallel OpenMP region. It can be called within a parallel OpenMP region if nested parallelism is supported by the compiler.

Parameters
x(double *) – the vector
value(double *) – the return value
rows(int)
Returns
(void)

Definition at line 80 of file blas_level_1.c.

Referenced by G_math_dnrm2().

◆ G_math_d_max_norm()

void G_math_d_max_norm ( double *  x,
double *  value,
int  rows 
)

Compute the maximum norm of vector x.

\[ a = ||{\bf x}||_\infty \]

This function is not multi-threaded

Parameters
x(double *)– the vector
value(double *) – the return value
rows(int)
Returns
(void)

Definition at line 142 of file blas_level_1.c.

References max.

Referenced by G_math_idamax().

◆ G_math_d_x_dot_y()

void G_math_d_x_dot_y ( double *  x,
double *  y,
double *  value,
int  rows 
)

Compute the dot product of vector x and y.

\[ a = {\bf x}^T {\bf y} \]

The functions creates its own parallel OpenMP region. It can be called within a parallel OpenMP region if nested parallelism is supported by the compiler.

Parameters
x(double *)
y(double *)
value(double *) – the return value
rows(int)
Returns
(void)

Definition at line 48 of file blas_level_1.c.

Referenced by G_math_ddot().

◆ G_math_f_asum_norm()

void G_math_f_asum_norm ( float *  x,
float *  value,
int  rows 
)

Compute the asum norm of vector x.

\[ a = ||{\bf x}||_1 \]

The functions creates its own parallel OpenMP region. It can be called within a parallel OpenMP region if nested parallelism is supported by the compiler.

Parameters
x(float *)– the vector
value(float *) – the return value
rows(int)
Returns
(void)

Definition at line 328 of file blas_level_1.c.

References count.

Referenced by G_math_sasum().

◆ G_math_f_ax_by()

void G_math_f_ax_by ( float *  x,
float *  y,
float *  z,
float  a,
float  b,
int  rows 
)

Scales vectors x and y with the scalars a and b and adds them.

\[ {\bf z} = a{\bf x} + b{\bf y} \]

This function is multi-threaded with OpenMP and can be called within a parallel OpenMP region.

Parameters
x(float *)
y(float *)
z(float *)
a(float)
b(float)
rows(int)
Returns
(void)

Definition at line 392 of file blas_level_1.c.

◆ G_math_f_copy()

void G_math_f_copy ( float *  x,
float *  y,
int  rows 
)

Copy the vector x to y.

\[ {\bf y} = {\bf x} \]

This function is not multi-threaded

Parameters
x(float *)
y(float *)
rows(int)

Definition at line 455 of file blas_level_1.c.

Referenced by G_math_scopy().

◆ G_math_f_euclid_norm()

void G_math_f_euclid_norm ( float *  x,
float *  value,
int  rows 
)

Compute the euclid norm of vector x.

\[ a = ||{\bf x}||_2 \]

The functions creates its own parallel OpenMP region. It can be called within a parallel OpenMP region if nested parallelism is supported by the compiler.

Parameters
x(double *) – the vector
value(float *) – the return value
rows(int)
Returns
(void)

Definition at line 296 of file blas_level_1.c.

Referenced by G_math_snrm2().

◆ G_math_f_max_norm()

void G_math_f_max_norm ( float *  x,
float *  value,
int  rows 
)

Compute the maximum norm of vector x.

\[ a = ||{\bf x}||_\infty \]

This function is not multi-threaded

Parameters
x(float *)– the vector
value(float *) – the return value
rows(int)
Returns
(void)

Definition at line 361 of file blas_level_1.c.

References max.

Referenced by G_math_isamax().

◆ G_math_f_x_dot_y()

void G_math_f_x_dot_y ( float *  x,
float *  y,
float *  value,
int  rows 
)

Compute the dot product of vector x and y.

\[ a = {\bf x}^T {\bf y} \]

The functions creates its own parallel OpenMP region. It can be called within a parallel OpenMP region if nested parallelism is supported by the compiler.

Parameters
x(float *)
y(float *)
value(float *) – the return value
rows(int)
Returns
(void)

Definition at line 264 of file blas_level_1.c.

Referenced by G_math_sdot().

◆ G_math_i_asum_norm()

void G_math_i_asum_norm ( int *  x,
double *  value,
int  rows 
)

Compute the asum norm of vector x.

\[ a = ||{\bf x}||_1 \]

The functions creates its own parallel OpenMP region. It can be called within a parallel OpenMP region if nested parallelism is supported by the compiler.

Parameters
x(int *)– the vector
value(double *) – the return value
rows(int)
Returns
(void)

Definition at line 546 of file blas_level_1.c.

◆ G_math_i_ax_by()

void G_math_i_ax_by ( int *  x,
int *  y,
int *  z,
int  a,
int  b,
int  rows 
)

Scales vectors x and y with the scalars a and b and adds them.

\[ {\bf z} = a{\bf x} + b{\bf y} \]

This function is multi-threaded with OpenMP and can be called within a parallel OpenMP region.

Parameters
x(int *)
y(int *)
z(int *)
a(int)
b(int)
rows(int)
Returns
(void)

Definition at line 607 of file blas_level_1.c.

◆ G_math_i_copy()

void G_math_i_copy ( int *  x,
int *  y,
int  rows 
)

Copy the vector x to y.

\[ {\bf y} = {\bf x} \]

This function is not multi-threaded

Parameters
x(int *)
y(int *)
rows(int)

Definition at line 670 of file blas_level_1.c.

◆ G_math_i_euclid_norm()

void G_math_i_euclid_norm ( int *  x,
double *  value,
int  rows 
)

Compute the euclid norm of vector x.

\[ a = ||{\bf x}||_2 \]

The functions creates its own parallel OpenMP region. It can be called within a parallel OpenMP region if nested parallelism is supported by the compiler.

Parameters
x(int *) – the vector
value(double *) – the return value
rows(int)
Returns
(void)

Definition at line 514 of file blas_level_1.c.

◆ G_math_i_max_norm()

void G_math_i_max_norm ( int *  x,
int *  value,
int  rows 
)

Compute the maximum norm of vector x.

\[ a = ||{\bf x}||_\infty \]

This function is not multi-threaded

Parameters
x(int *)– the vector
value(int *) – the return value
rows(int)
Returns
(void)

Definition at line 576 of file blas_level_1.c.

References max.

◆ G_math_i_x_dot_y()

void G_math_i_x_dot_y ( int *  x,
int *  y,
double *  value,
int  rows 
)

Compute the dot product of vector x and y.

\[ a = {\bf x}^T {\bf y} \]

The functions creates its own parallel OpenMP region. It can be called within a parallel OpenMP region if nested parallelism is supported by the compiler.

Parameters
x(int *)
y(int *)
value(double *) – the return value
rows(int)
Returns
(void)

Definition at line 482 of file blas_level_1.c.