\hypertarget{dnpgetrf_8c}{}\section{src/dnpgetrf.c File Reference}
\label{dnpgetrf_8c}\index{src/dnpgetrf.\+c@{src/dnpgetrf.\+c}}


L\+A\+Ss-\/\+D\+D\+Ss dnpgetrf routine.  


{\ttfamily \#include \char`\"{}../include/lass.\+h\char`\"{}}\\*
Include dependency graph for dnpgetrf.\+c\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{dnpgetrf_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
enum L\+A\+S\+S\+\_\+\+R\+E\+T\+U\+RN \hyperlink{dnpgetrf_8c_a90f43bdc154edb1979f7ffce22e142ff}{dnpgetrf} (int M, int N, double $\ast$A, int L\+DA)
\end{DoxyCompactItemize}


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

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

\begin{DoxyAuthor}{Author}
Pedro Valero-\/\+Lara \href{mailto:pedro.valero@bsc.es}{\tt pedro.\+valero@bsc.\+es} 

Boro Sofranac \href{mailto:boro.sofranac@bsc.es}{\tt boro.\+sofranac@bsc.\+es} 
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
2017-\/21-\/11   
\end{DoxyDate}


\subsection{Function Documentation}
\index{dnpgetrf.\+c@{dnpgetrf.\+c}!dnpgetrf@{dnpgetrf}}
\index{dnpgetrf@{dnpgetrf}!dnpgetrf.\+c@{dnpgetrf.\+c}}
\subsubsection[{\texorpdfstring{dnpgetrf(int M, int N, double $\ast$\+A, int L\+D\+A)}{dnpgetrf(int M, int N, double *A, int LDA)}}]{\setlength{\rightskip}{0pt plus 5cm}enum L\+A\+S\+S\+\_\+\+R\+E\+T\+U\+RN dnpgetrf (
\begin{DoxyParamCaption}
\item[{int}]{M, }
\item[{int}]{N, }
\item[{double $\ast$}]{A, }
\item[{int}]{L\+DA}
\end{DoxyParamCaption}
)}\hypertarget{dnpgetrf_8c_a90f43bdc154edb1979f7ffce22e142ff}{}\label{dnpgetrf_8c_a90f43bdc154edb1979f7ffce22e142ff}
Performs the LU factorization without pivoting of a general M-\/by-\/N matrix A\+: \begin{DoxyVerb}A = L * U
\end{DoxyVerb}


where L is a lower triangular ( lower trapezoidal if M $>$ N ) matrix with unit diagonal elements and U is an upper triangular ( upper trapezoidal if M $<$ N ) matrix.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em M} & int. M specifies the number of rows of the matrix A. M $>$= 0.\\
\hline
\mbox{\tt in}  & {\em N} & int. N specifies the number of columns of the matrix A. N $>$= 0.\\
\hline
\mbox{\tt in,out}  & {\em A} & double $\ast$. A is a pointer to a regular matrix of dimension M-\/by-\/N. On exit, if return value is Success, the matrix A is overwriten by the factors L and U. The unit diagonal elements of L are not stored.\\
\hline
\mbox{\tt in}  & {\em L\+DA} & int. L\+DA specifies the number of columns of A ( row-\/major order ). L\+DA must be at least max( 1, N ).\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em Success} & successful exit \\
\hline
{\em No\+Success} & unsuccessful exit\\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{lass_8h_aad8c6b9542e74c481faff1ff5e03850f}{kdnpgetrf} 
\end{DoxySeeAlso}


Definition at line 70 of file dnpgetrf.\+c.



Referenced by kdnpgesv(), and kdnpgetrf().


\begin{DoxyCode}
71 \{
72 
73     \textcolor{comment}{// Local variable}
74     \textcolor{keywordtype}{double} alpha;
75     \textcolor{keywordtype}{double} sfmin;
76     \textcolor{keywordtype}{int} i, j, k;
77     \textcolor{keywordtype}{int} info = 0;
78 
79     \textcolor{comment}{// Argument checking}
80     \textcolor{keywordflow}{if} ( M < 0 )
81     \{
82         fprintf( stderr, \textcolor{stringliteral}{"Illegal value of M, in dnpgetrf code\(\backslash\)n"} );
83         \textcolor{keywordflow}{return} NoSuccess;
84     \}
85 
86     \textcolor{keywordflow}{if} ( N < 0 )
87     \{
88         fprintf( stderr, \textcolor{stringliteral}{"Illegal value of N, in dnpgetrf code\(\backslash\)n"} );
89         \textcolor{keywordflow}{return} NoSuccess;
90     \}
91 
92     \textcolor{keywordflow}{if} ( LDA < MAX( 1, N ) )
93     \{
94         fprintf( stderr, \textcolor{stringliteral}{"Illegal value of LDA, in dnpgetrf code\(\backslash\)n"} );
95         \textcolor{keywordflow}{return} NoSuccess;
96     \}
97 
98     \textcolor{comment}{// Qick return}
99     \textcolor{keywordflow}{if} ( MIN( M, N ) == 0 )
100     \{
101         \textcolor{keywordflow}{return} Success;
102     \}
103     
104     \textcolor{comment}{/****************}
105 \textcolor{comment}{    --DNPGETRF tile--}
106 \textcolor{comment}{    ****************/}   
107 
108     \textcolor{comment}{// Minimum value in double precision    }
109     sfmin = LAPACKE\_dlamch\_work( \textcolor{charliteral}{'S'} );
110     k = MIN( M, N );
111     
112     \textcolor{keywordflow}{for} ( i = 0; i < k; i++ ) 
113     \{
114         alpha = A[i * LDA + i];
115         \textcolor{keywordflow}{if} ( alpha != ( \textcolor{keywordtype}{double} )0.0 ) 
116         \{
117             \textcolor{comment}{// Compute elements from J+1 to M of the J-th column}
118             \textcolor{keywordflow}{if} ( i < M ) 
119             \{   
120                 \textcolor{keywordflow}{if} ( fabs( alpha ) > fabs( sfmin ) )
121                 \{
122                     alpha = 1.0 / alpha;  
123                     cblas\_dscal( M - i - 1, alpha, 
124                         &( A[( i + 1 ) * LDA + i] ), LDA );
125                 \} 
126                 \textcolor{keywordflow}{else} 
127                 \{
128                     \textcolor{keywordflow}{for}( j= i + 1; j < M; j++ )
129                     \{   
130                         A[j * LDA + i] = A[j * LDA + i] / alpha;
131                     \}
132                 \}
133             \}
134         \} 
135         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} ( info == 0 ) 
136         \{
137             info = i;       
138         \}
139         \textcolor{keywordflow}{if} ( i < k ) 
140         \{
141             cblas\_dger( CblasRowMajor,
142                         M - i - 1, N - i - 1, 
143                         -1.0,
144                         &A[( i + 1 ) * LDA + i], LDA,
145                         &A[ i * LDA + ( i + 1 )], 1,
146                         &A[( i + 1 ) * LDA + ( i + 1 ) ], LDA );        
147         \}
148     \}
149     
150     \textcolor{keywordflow}{return} Success;
151 
152 \} 
\end{DoxyCode}
