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