11 status =
ladel_set_union(col_set, set, difference, offset, insertions, col);
21 for (index = L->
nz[col]-1; index >= 0; index--)
22 L->
x[start+index+offset[index]] = L->
x[start+index];
25 for (index = 0; index < difference->
size_set; index++)
26 L->
x[start+insertions[index]] = 0;
45 ladel_int index1 = 0, index2, row1, row2, index_dif = 0;
53 for (index2 = 0; index2 < size_set2; index2++)
56 if (row2 <= threshold)
continue;
57 insertions[index1] = index1;
58 set1[index1] = dif[index1] = row2;
68 for (index2 = 0; index2 < size_set2; index2++)
71 if (row2 <= threshold)
continue;
73 for (; index1 < first_set->
size_set && row1 < row2; index1++)
76 offset[index1] = index_dif;
77 if (row1 >= row2)
break;
81 dif[index_dif] = row2;
89 for (; index2 < size_set2; index2++, size_set1++, index_dif++)
92 dif[index_dif] = set2[index2];
93 insertions[index_dif] = index1+index_dif;
100 for (; index1 < first_set->
size_set; index1++) offset[index1] = index_dif;
106 for (index1 = first_set->
size_set-1; index1 >= 0; index1--) set1[index1+offset[index1]] = set1[index1];
110 for (index1 = 0; index1 < first_set->
size_set; index1++)
111 for (; index_dif < offset[index1]; index_dif++)
112 insertions[index_dif] = index1 + index_dif;
115 for (index_dif = 0; index_dif < difference->
size_set; index_dif++) set1[insertions[index_dif]] = dif[index_dif];
124 if (!LD || !sym || !W || !work)
return FAIL;
132 ladel_int col, row, index, index_L, size_W = (W->
nz == NULL) ? W->
p[col_in_W+1] - W->
p[col_in_W] : W->
nz[col_in_W] ;
133 if (size_W == 0)
return SUCCESS;
136 if (up_or_down ==
UPDATE) sigma = 1.0;
137 else if (up_or_down ==
DOWNDATE) sigma = -1.0;
156 W_col[W->
i[index]] = factor*W->
x[index];
169 old_parent = etree[col];
170 col = etree[col] = L->
i[L->
p[col]];
173 if (col != old_parent)
184 if (col == old_parent)
194 old_parent = etree[col];
195 if (L->
nz[col] == 0)
break;
196 col = etree[col] = L->
i[L->
p[col]];
199 if (col == old_parent)
200 ladel_set_union(difference_child, difference, difference2, offset, insertions, 0);
207 for (col = W->
i[W->
p[col_in_W]]; col !=
NONE; col = etree[col])
211 alpha_new = alpha + sigma*w*w*dinv;
212 gamma = w*dinv/alpha_new;
213 Dinv[col] *= alpha/alpha_new;
215 for (index_L = L->
p[col]; index_L < L->p[col]+L->
nz[col]; index_L++)
218 W_col[row] -= w*L->
x[index_L];
219 L->
x[index_L] += sigma*gamma*W_col[row];
224 for (index = W->
i[W->
p[col_in_W]]; index !=
NONE; index = etree[index]) W_col[index] = 0;
#define NONE
Indicates a root (a node without parent), or an untouched node.
#define SET_HAS_NOT_CHANGED
Possible return value of ladel_set_union indicating the set has not changed.
#define TRUE
For booleans.
#define SUCCESS
For status returns.
#define FAIL
For status returns.
#define MAX_SET_SIZE_EXCEEDED
Possible return value of ladel_set_union indicating the set has grown beyond the maximum size.
#define UPDATE
Flag in rank1_update to perform an update.
#define DOWNDATE
Flag in rank1_update to perform a downdate.
#define SET_HAS_CHANGED
Possible return value of ladel_set_union indicating the set has changed.
#define LADEL_FOR(index, M, col)
Loop through a column of a sparse matrix.
ladel_int ladel_rank1_update(ladel_factor *LD, ladel_symbolics *sym, ladel_sparse_matrix *W, ladel_int col_in_W, ladel_double factor, ladel_int up_or_down, ladel_work *work)
Updates an factorization.
Constants and macros used in LADEL.
Routines to print out matrices and vectors.
Memory allocation routines.
void ladel_set_set(ladel_set *set, ladel_int *set_vals, ladel_int size_set, ladel_int max_size_set)
Fill in the fields of the given set.
ladel_int ladel_add_nonzero_pattern_to_col_of_L(ladel_sparse_matrix *L, ladel_int col, ladel_set *col_set, ladel_set *set, ladel_set *difference, ladel_int *offset, ladel_int *insertions)
Adds the nonzero pattern in set to the pattern of the col of L.
ladel_int ladel_set_union(ladel_set *first_set, ladel_set *second_set, ladel_set *difference, ladel_int *offset, ladel_int *insertions, ladel_int threshold)
Computes the set union of two index sets.
Helper routines for the rank1_update function.
Structures and types used in LADEL routines.
int64_t ladel_int
Type for integer numbers (default: int64_t)
double ladel_double
Type for floating point numbers (default: double)
Sparse matrix in compressed column storage.
ladel_double * x
numerical values (size nzmax)
ladel_int * p
column pointers (size ncol+1)
ladel_int * nz
(optional) number of elements in each column (size ncol)
ladel_int * i
row pointers (size nzmax)
ladel_int max_size_set
Maximum (allocated) size of the list.
ladel_int * set
List of integers representing the set.
ladel_int size_set
Size of the list.
Factors of an factorization.
ladel_sparse_matrix * L
L in LDL' factorization.
ladel_double * Dinv
D^-1 in LDL' factorization (stored as vector)
Workspace required for various routines in LADEL.
ladel_int * array_int_ncol2
An array of ncol integers.
ladel_set * set_unallocated_values3
An unallocated set structure.
ladel_set * set_preallocated2
A preallocated set structure.
ladel_int * array_int_ncol1
An array of ncol integers.
ladel_set * set_unallocated_values2
An unallocated set structure.
ladel_double * array_double_all_zeros_ncol1
An array of ncol doubles, on input and output this should be all zeros.
ladel_set * set_preallocated1
A preallocated set structure.
ladel_set * set_preallocated3
A preallocated set structure.
ladel_set * set_unallocated_values1
An unallocated set structure.