LASs - Linear Algebra Routines on OmpSs 1.0.0 LASs

- Main Page
- Files

- File List
- File Members

Functions
dspmv.c File Reference

LASs-DSS dspmv routine. More...

`#include "../include/lass.h"`
Include dependency graph for dspmv.c:

Go to the source code of this file.

## Functions
void | dspmvseq (int M, int N, double ALPHA, const double *VAL_A, const int *ROW_PTR_A, const int *COL_IND_A, const double *X, double BETA, double *Y)

## Detailed Description

LASs-DSS dspmv routine.

LASs-DSSs is a software package provided by: Barcelona Supercomputing Center - Centro Nacional de Supercomputacion

Author
  Sandra Catalán sandr.nosp@m.a.ca.nosp@m.talan.nosp@m.@bsc.nosp@m..es
  Pedro Valero-Lara pedro.nosp@m..val.nosp@m.ero@b.nosp@m.sc.e.nosp@m.s

Date
  2018-09-07

Definition in file dspmv.c.

## Function Documentation

void dspmvseq | ( | int | M,
|  | int | N,
|  | double | ALPHA,
|  | const double * | VAL_A,
|  | const int * | ROW_PTR_A,
|  | const int * | COL_IND_A,
|  | const double * | X,
|  | double | BETA,
|  | double * | Y
| ) |  |

Performs the sparse matrix-vector operation:

    Y = ALPHA * A * X + BETA * Y

where ALPHA and BETA are scalars, X and Y are vectors, and A is a sparse matrix stored in thhe next three vectors VAL_A, COL_IND_A and ROW_PTR_A according to CSR format.

Parameters

  [in] | M | int. M specifies the number of rows of A.
  [in] | N | int. N specifies the number of columns of A.
  [in] | ALPHA | double.
  [in] | VAL_A | double *. VAL_A is a pointer to a vector which specifies the non-zero values of the original matrix A.
  [in] | COL_IND_A | unsigned int *. COL_IND_A is a pointer to a vector which specifies the column of each value of A in the original matrix.
  [in] | ROW_PTR_A | unsigned int *. ROW_PTR_A is a pointer to a vector which specifies the number of values that A contains in each row of the original matrix.
  [in] | X | double *. X is a pointer to a vector of dimension N.
  [in] | BETA | double .
  [in,out] | Y | double *. Y is a pointer to a vector of dimension M. On exit, Y is overwritten by the sparse matrix-vector result.

Return values

  Success | sucessful exit
  NoSuccess | unsucessful exit

Definition at line 84 of file dspmv.c.

90 {
91
92 // Local variables
93 double svalue = 0.0, value = 0.0;
94 int max = 0, col = 0;
95 int i, x;
96
97 for ( x = 0; x < M; x++ )
98 {
99 svalue = 0.0;
100 max = ROW_PTR_A[x + 1] - ROW_PTR_A[x];
101
102 for( i = 0; i < max; i++ )
103 {
104 value = VAL_A[ROW_PTR_A[x] + i];
105 col = COL_IND_A[ROW_PTR_A[x] + i];
106 svalue += value * X[col] * ALPHA;
107
108
109 }
110
111 Y[x] = svalue + Y[x] * BETA;
112
113 }
114
115 }