LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ main()

int main ( )

Definition at line 16 of file example_user.c.

16 {
17 /* Locals */
18 lapack_int n = N, nrhs = NRHS, lda = LDA, ldb = LDB, info;
19 /* Local arrays */
20 lapack_int ipiv[N];
21 double a[LDA*N] = {
22 6.80, -6.05, -0.45, 8.32, -9.67,
23 -2.11, -3.30, 2.58, 2.71, -5.14,
24 5.66, 5.36, -2.70, 4.35, -7.26,
25 5.97, -4.44, 0.27, -7.17, 6.08,
26 8.23, 1.08, 9.04, 2.14, -6.87
27 };
28 double b[LDB*N] = {
29 4.02, -1.56, 9.81,
30 6.19, 4.00, -4.09,
31 -8.22, -8.67, -4.57,
32 -7.57, 1.75, -8.61,
33 -3.03, 2.86, 8.99
34 };
35
36 double aNorm;
37 double rcond;
38 char ONE_NORM = '1';
39 lapack_int NROWS = n;
40 lapack_int NCOLS = n;
41 lapack_int LEADING_DIMENSION_A = n;
42
43 /* Print Entry Matrix */
44 print_matrix( "Entry Matrix A", n, n, a, lda );
45 /* Print Right Rand Side */
46 print_matrix( "Right Rand Side", n, nrhs, b, ldb );
47 printf( "\n" );
48 /* Executable statements */
49 printf( "LAPACKE_dgecon Example Program Results\n" );
50 aNorm = LAPACKE_dlange(LAPACK_ROW_MAJOR, ONE_NORM, NROWS, NCOLS, a, LEADING_DIMENSION_A);
51 info = LAPACKE_dgetrf(LAPACK_ROW_MAJOR, NROWS, NCOLS, a, LEADING_DIMENSION_A, ipiv);
52 info = LAPACKE_dgecon(LAPACK_ROW_MAJOR, ONE_NORM, n, a, LEADING_DIMENSION_A, aNorm, &rcond); // aNorm should be 35.019999999999996
53 double work[4*N];
54 int iwork[N];
55 //info = LAPACKE_dgecon_work(LAPACK_ROW_MAJOR, ONE_NORM, n, a, LEADING_DIMENSION_A, aNorm, &rcond, work, iwork); // aNorm should be 35.019999999999996
56 //dgecon_( &ONE_NORM, &n, a, &LEADING_DIMENSION_A, &aNorm, &rcond, work, iwork, &info );
57 /* Check for the exact singularity */
58 if (info == 0)
59 {
60 printf("LAPACKE_dgecon completed SUCCESSFULLY...\n");
61 }
62 else if ( info < 0 )
63 {
64 printf( "Element %d of A had an illegal value\n", -info );
65 exit( 1 );
66 }
67 else
68 {
69 printf( "Unrecognized value of INFO = %d\n", info );
70 exit( 1 );
71 }
72
73 /* Print solution */
74 printf("LAPACKE_dlange / One-norm of A = %lf\n", aNorm);
75 printf("LAPACKE_dgecon / RCOND of A = %f\n", rcond);
76 exit( 0 );
77} /* End of LAPACKE_dgesv Example */
#define N
Definition: example_user.c:10
#define LDB
Definition: example_user.c:13
void print_matrix(char *desc, lapack_int m, lapack_int n, double *a, lapack_int lda)
Definition: example_user.c:80
#define NRHS
Definition: example_user.c:11
#define LDA
Definition: example_user.c:12
#define lapack_int
Definition: lapack.h:87
lapack_int LAPACKE_dgetrf(int matrix_layout, lapack_int m, lapack_int n, double *a, lapack_int lda, lapack_int *ipiv)
lapack_int LAPACKE_dgecon(int matrix_layout, char norm, lapack_int n, const double *a, lapack_int lda, double anorm, double *rcond)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
double LAPACKE_dlange(int matrix_layout, char norm, lapack_int m, lapack_int n, const double *a, lapack_int lda)
Here is the call graph for this function: