\hypertarget{dspmv_8c}{}\section{src/dspmv.c File Reference}
\label{dspmv_8c}\index{src/dspmv.\+c@{src/dspmv.\+c}}


L\+A\+Ss-\/\+D\+SS dspmv routine.  


{\ttfamily \#include \char`\"{}../include/lass.\+h\char`\"{}}\\*
Include dependency graph for dspmv.\+c\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{dspmv_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{dspmv_8c_a370e9cd2de50f704173265423d33d289}{dspmvseq} (int M, int N, double A\+L\+P\+HA, const double $\ast$V\+A\+L\+\_\+A, const int $\ast$R\+O\+W\+\_\+\+P\+T\+R\+\_\+A, const int $\ast$C\+O\+L\+\_\+\+I\+N\+D\+\_\+A, const double $\ast$X, double B\+E\+TA, double $\ast$Y)
\end{DoxyCompactItemize}


\subsection{Detailed Description}
L\+A\+Ss-\/\+D\+SS dspmv routine. 

L\+A\+Ss-\/\+D\+S\+Ss is a software package provided by\+: Barcelona Supercomputing Center -\/ Centro Nacional de Supercomputacion

\begin{DoxyAuthor}{Author}
Sandra Catalán \href{mailto:sandra.catalan@bsc.es}{\tt sandra.\+catalan@bsc.\+es} 

Pedro Valero-\/\+Lara \href{mailto:pedro.valero@bsc.es}{\tt pedro.\+valero@bsc.\+es} 
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
2018-\/09-\/07   
\end{DoxyDate}


\subsection{Function Documentation}
\index{dspmv.\+c@{dspmv.\+c}!dspmvseq@{dspmvseq}}
\index{dspmvseq@{dspmvseq}!dspmv.\+c@{dspmv.\+c}}
\subsubsection[{\texorpdfstring{dspmvseq(int M, int N, double A\+L\+P\+H\+A, const double $\ast$\+V\+A\+L\+\_\+\+A, const int $\ast$\+R\+O\+W\+\_\+\+P\+T\+R\+\_\+\+A, const int $\ast$\+C\+O\+L\+\_\+\+I\+N\+D\+\_\+\+A, const double $\ast$\+X, double B\+E\+T\+A, double $\ast$\+Y)}{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)}}]{\setlength{\rightskip}{0pt plus 5cm}void dspmvseq (
\begin{DoxyParamCaption}
\item[{int}]{M, }
\item[{int}]{N, }
\item[{double}]{A\+L\+P\+HA, }
\item[{const double $\ast$}]{V\+A\+L\+\_\+A, }
\item[{const int $\ast$}]{R\+O\+W\+\_\+\+P\+T\+R\+\_\+A, }
\item[{const int $\ast$}]{C\+O\+L\+\_\+\+I\+N\+D\+\_\+A, }
\item[{const double $\ast$}]{X, }
\item[{double}]{B\+E\+TA, }
\item[{double $\ast$}]{Y}
\end{DoxyParamCaption}
)}\hypertarget{dspmv_8c_a370e9cd2de50f704173265423d33d289}{}\label{dspmv_8c_a370e9cd2de50f704173265423d33d289}
Performs the sparse matrix-\/vector operation\+: \begin{DoxyVerb}Y = ALPHA * A * X + BETA * Y
\end{DoxyVerb}


where A\+L\+P\+HA and B\+E\+TA are scalars, X and Y are vectors, and A is a sparse matrix stored in thhe next three vectors V\+A\+L\+\_\+A, C\+O\+L\+\_\+\+I\+N\+D\+\_\+A and R\+O\+W\+\_\+\+P\+T\+R\+\_\+A according to C\+SR format.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em M} & int. M specifies the number of rows of A.\\
\hline
\mbox{\tt in}  & {\em N} & int. N specifies the number of columns of A.\\
\hline
\mbox{\tt in}  & {\em A\+L\+P\+HA} & double.\\
\hline
\mbox{\tt in}  & {\em V\+A\+L\+\_\+A} & double $\ast$. V\+A\+L\+\_\+A is a pointer to a vector which specifies the non-\/zero values of the original matrix A.\\
\hline
\mbox{\tt in}  & {\em C\+O\+L\+\_\+\+I\+N\+D\+\_\+A} & unsigned int $\ast$. C\+O\+L\+\_\+\+I\+N\+D\+\_\+A is a pointer to a vector which specifies the column of each value of A in the original matrix.\\
\hline
\mbox{\tt in}  & {\em R\+O\+W\+\_\+\+P\+T\+R\+\_\+A} & unsigned int $\ast$. R\+O\+W\+\_\+\+P\+T\+R\+\_\+A is a pointer to a vector which specifies the number of values that A contains in each row of the original matrix.\\
\hline
\mbox{\tt in}  & {\em X} & double $\ast$. X is a pointer to a vector of dimension N.\\
\hline
\mbox{\tt in}  & {\em B\+E\+TA} & double .\\
\hline
\mbox{\tt in,out}  & {\em Y} & double $\ast$. Y is a pointer to a vector of dimension M. On exit, Y is overwritten by the sparse matrix-\/vector result.\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em Success} & sucessful exit \\
\hline
{\em No\+Success} & unsucessful exit \\
\hline
\end{DoxyRetVals}


Definition at line 84 of file dspmv.\+c.


\begin{DoxyCode}
90 \{
91 
92     \textcolor{comment}{// Local variables}
93     \textcolor{keywordtype}{double} svalue = 0.0, value = 0.0;
94     \textcolor{keywordtype}{int} max = 0, col = 0;
95     \textcolor{keywordtype}{int} i, x;
96 
97     \textcolor{keywordflow}{for} ( x = 0; x < M; x++ )
98     \{
99         svalue = 0.0;
100         max = ROW\_PTR\_A[x + 1] - ROW\_PTR\_A[x];
101 
102         \textcolor{keywordflow}{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 \}
\end{DoxyCode}
