LADEL main
Sparse LDL factorization package with rank 1 and rowadd/rowdel updates
ladel_debug_print.c
Go to the documentation of this file.
1#include "ladel_global.h"
2#include "ladel_types.h"
3#include "ladel_debug_print.h"
4#include <stdio.h>
5
6/* Print a sparse matrix so the output can be entered into matlab */
8 ladel_print("M = sparse(%" LADEL_PRIi ", %" LADEL_PRIi ");", M->nrow, M->ncol);
9 ladel_int col, index = 0;
10 ladel_double *Mx = M->x;
11 ladel_int *Mi = M->i;
12
13 for (col = 1; col <= M->ncol; col++) {
14 LADEL_FOR(index, M, col-1)
15 ladel_print("M(%" LADEL_PRIi ", %" LADEL_PRIi ") = %.16le;", Mi[index]+1, col, Mx[index]);
16 }
17 ladel_print("\n");
18}
19
20/* Print the entries of a sparse matrix column by column */
22 ladel_print("Printing entries: \n");
23 ladel_int col, index;
24 ladel_double *Mx = M->x;
25 ladel_int *Mi = M->i;
26 ladel_int *Mp = M->p;
27
28 for (col = 0; col < M->ncol; col++) {
29 for(index = Mp[col]; index < Mp[col+1]; index++)
30 ladel_print("M(%" LADEL_PRIi ", %" LADEL_PRIi ") = %.16le;", Mi[index], col, Mx[index]);
31 }
32 ladel_print("\n");
33}
34
36 ladel_print("L = sparse(%" LADEL_PRIi ", %" LADEL_PRIi ");", LD->L->nrow, LD->L->ncol);
37 ladel_int col, index = 0;
38 ladel_double *Lx = LD->L->x;
39 ladel_int *Li = LD->L->i;
40
41 for (col = 1; col <= LD->L->ncol; col++)
42 LADEL_FOR(index, LD->L, col-1)
43 ladel_print("L(%" LADEL_PRIi ", %" LADEL_PRIi ") = %.16le;", Li[index]+1, col, Lx[index]);
44
46}
47
49 size_t k;
50 ladel_print("x = zeros(%lu, 1);", len);
51 for (k = 0; k < len; k++) {
52 ladel_print("x(%lu) = %.16le;", k+1, x[k]);
53 }
54 ladel_print("\n");
55}
56
58 size_t k;
59 ladel_print("x = zeros(%lu, 1);", len);
60 for (k = 0; k < len; k++) {
61 ladel_print("x(%lu) = %" LADEL_PRIi ";", k+1, x[k]);
62 }
63 ladel_print("\n");
64}
65
67{
68 ladel_print("Size set %" LADEL_PRIi " (max %" LADEL_PRIi ")\n", set->size_set, set->max_size_set);
69 ladel_print("Elements: ");
70 ladel_int index;
71 for (index = 0; index < set->size_set; index++) ladel_print("%" LADEL_PRIi " ", set->set[index]);
72 ladel_print("\n");
73}
#define LADEL_FOR(index, M, col)
Loop through a column of a sparse matrix.
void ladel_print_dense_vector_matlab(ladel_double *x, size_t len)
Prints output that can be copied into Matlab to retrieve the given double vector.
void ladel_print_sparse_matrix_entries(ladel_sparse_matrix *M)
Prints the contents of all entries in a matrix.
void ladel_print_factor_matlab(ladel_factor *LD)
Prints output that can be copied into Matlab to retrieve the given factor.
void ladel_print_sparse_matrix_matlab(ladel_sparse_matrix *M)
Prints output that can be copied into Matlab to retrieve the given matrix.
void ladel_print_dense_int_vector_matlab(ladel_int *x, size_t len)
Prints output that can be copied into Matlab to retrieve the given double vector.
void ladel_print_set(ladel_set *set)
Print the content of an index set.
Routines to print out matrices and vectors.
Memory allocation routines.
#define ladel_print
Print function.
Definition: ladel_global.h:97
Structures and types used in LADEL routines.
int64_t ladel_int
Type for integer numbers (default: int64_t)
Definition: ladel_types.h:24
#define LADEL_PRIi
Definition: ladel_types.h:25
double ladel_double
Type for floating point numbers (default: double)
Definition: ladel_types.h:20
Sparse matrix in compressed column storage.
Definition: ladel_types.h:35
ladel_int ncol
number of columns
Definition: ladel_types.h:38
ladel_double * x
numerical values (size nzmax)
Definition: ladel_types.h:42
ladel_int * p
column pointers (size ncol+1)
Definition: ladel_types.h:40
ladel_int nrow
number of rows
Definition: ladel_types.h:37
ladel_int * i
row pointers (size nzmax)
Definition: ladel_types.h:41
Set of integers.
Definition: ladel_types.h:81
ladel_int max_size_set
Maximum (allocated) size of the list.
Definition: ladel_types.h:84
ladel_int * set
List of integers representing the set.
Definition: ladel_types.h:82
ladel_int size_set
Size of the list.
Definition: ladel_types.h:83
Factors of an factorization.
Definition: ladel_types.h:69
ladel_int ncol
number of columns in the analyzed matrix
Definition: ladel_types.h:70
ladel_sparse_matrix * L
L in LDL' factorization.
Definition: ladel_types.h:71
ladel_double * Dinv
D^-1 in LDL' factorization (stored as vector)
Definition: ladel_types.h:73