1 /* ========================================================================== */
2 /* === UMF_report_vector ==================================================== */
3 /* ========================================================================== */
4
5 /* -------------------------------------------------------------------------- */
6 /* UMFPACK Copyright (c) Timothy A. Davis, CISE, */
7 /* Univ. of Florida. All Rights Reserved. See ../Doc/License for License. */
8 /* web: http://www.cise.ufl.edu/research/sparse/umfpack */
9 /* -------------------------------------------------------------------------- */
10
11 #include "umf_internal.h"
12 #include "umf_report_vector.h"
13
14 /* ========================================================================== */
15 /* === print_value ========================================================== */
16 /* ========================================================================== */
17
print_value(Int i,const double Xx[],const double Xz[],Int scalar)18 PRIVATE void print_value
19 (
20 Int i,
21 const double Xx [ ],
22 const double Xz [ ], /* used for complex case only */
23 Int scalar /* if true, then print real part only */
24 )
25 {
26 Entry xi ;
27 /* if Xz is null, then X is in "merged" format (compatible with Entry, */
28 /* and ANSI C99 double _Complex type). */
29 PRINTF ((" "ID" :", INDEX (i))) ;
30 if (scalar)
31 {
32 PRINT_SCALAR (Xx [i]) ;
33 }
34 else
35 {
36 ASSIGN (xi, Xx, Xz, i, SPLIT (Xz)) ;
37 PRINT_ENTRY (xi) ;
38 }
39 PRINTF (("\n")) ;
40 }
41
42 /* ========================================================================== */
43 /* === UMF_report_vector ==================================================== */
44 /* ========================================================================== */
45
UMF_report_vector(Int n,const double Xx[],const double Xz[],Int prl,Int user,Int scalar)46 GLOBAL Int UMF_report_vector
47 (
48 Int n,
49 const double Xx [ ],
50 const double Xz [ ],
51 Int prl,
52 Int user,
53 Int scalar
54 )
55 {
56 Int n2, i ;
57
58 if (user || prl >= 4)
59 {
60 PRINTF (("dense vector, n = "ID". ", n)) ;
61 }
62
63 if (user)
64 {
65 if (!Xx)
66 {
67 PRINTF (("ERROR: vector not present\n\n")) ;
68 return (UMFPACK_ERROR_argument_missing) ;
69 }
70 if (n < 0)
71 {
72 PRINTF (("ERROR: length of vector is < 0\n\n")) ;
73 return (UMFPACK_ERROR_n_nonpositive) ;
74 }
75 }
76
77 if (user || prl >= 4)
78 {
79 PRINTF4 (("\n")) ;
80 }
81
82 if (prl == 4)
83 {
84 /* print level of 4 */
85 n2 = MIN (10, n) ;
86 for (i = 0 ; i < n2 ; i++)
87 {
88 print_value (i, Xx, Xz, scalar) ;
89 }
90 if (n2 < n)
91 {
92 PRINTF ((" ...\n")) ;
93 print_value (n-1, Xx, Xz, scalar) ;
94 }
95 }
96 else if (prl > 4)
97 {
98 /* print level 4 or more */
99 for (i = 0 ; i < n ; i++)
100 {
101 print_value (i, Xx, Xz, scalar) ;
102 }
103 }
104
105 PRINTF4 ((" dense vector ")) ;
106 if (user || prl >= 4)
107 {
108 PRINTF (("OK\n\n")) ;
109 }
110 return (UMFPACK_OK) ;
111 }
112