LASs - Linear Algebra Routines on OmpSs 1.0.0 LASs

- Main Page
- Files

- File List
- File Members

Functions
dnpgetrf.c File Reference

LASs-DDSs dnpgetrf routine. More...

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

Go to the source code of this file.

## Functions
enum LASS_RETURN | dnpgetrf (int M, int N, double *A, int LDA)

## Detailed Description

LASs-DDSs dnpgetrf routine.

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

Author
  Pedro Valero-Lara pedro.nosp@m..val.nosp@m.ero@b.nosp@m.sc.e.nosp@m.s
  Boro Sofranac boro..nosp@m.sofr.nosp@m.anac@.nosp@m.bsc..nosp@m.es

Date
  2017-21-11

Definition in file dnpgetrf.c.

## Function Documentation

enum LASS_RETURN dnpgetrf | ( | int | M,
|  | int | N,
|  | double * | A,
|  | int | LDA
| ) |  |

Performs the LU factorization without pivoting of a general M-by-N matrix A:

    A = L * U

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.

Parameters

  [in] | M | int. M specifies the number of rows of the matrix A. M >= 0.
  [in] | N | int. N specifies the number of columns of the matrix A. N >= 0.
  [in,out] | A | double *. 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.
  [in] | LDA | int. LDA specifies the number of columns of A ( row-major order ). LDA must be at least max( 1, N ).

Return values

  Success | successful exit
  NoSuccess | unsuccessful exit

See also
  kdnpgetrf

Definition at line 70 of file dnpgetrf.c.

Referenced by kdnpgesv(), and kdnpgetrf().

71 {
72
73 // Local variable
74 double alpha;
75 double sfmin;
76 int i, j, k;
77 int info = 0;
78
79 // Argument checking
80 if ( M < 0 )
81 {
82 fprintf( stderr, "Illegal value of M, in dnpgetrf code\n" );
83 return NoSuccess;
84 }
85
86 if ( N < 0 )
87 {
88 fprintf( stderr, "Illegal value of N, in dnpgetrf code\n" );
89 return NoSuccess;
90 }
91
92 if ( LDA < MAX( 1, N ) )
93 {
94 fprintf( stderr, "Illegal value of LDA, in dnpgetrf code\n" );
95 return NoSuccess;
96 }
97
98 // Qick return
99 if ( MIN( M, N ) == 0 )
100 {
101 return Success;
102 }
103
104 /****************
105 --DNPGETRF tile--
106 ****************/
107
108 // Minimum value in double precision
109 sfmin = LAPACKE_dlamch_work( 'S' );
110 k = MIN( M, N );
111
112 for ( i = 0; i < k; i++ )
113 {
114 alpha = A[i * LDA + i];
115 if ( alpha != ( double )0.0 )
116 {
117 // Compute elements from J+1 to M of the J-th column
118 if ( i < M )
119 {
120 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 else
127 {
128 for( j= i + 1; j < M; j++ )
129 {
130 A[j * LDA + i] = A[j * LDA + i] / alpha;
131 }
132 }
133 }
134 }
135 else if ( info == 0 )
136 {
137 info = i;
138 }
139 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 return Success;
151
152 }