LADEL main
Sparse LDL factorization package with rank 1 and rowadd/rowdel updates
ladel_upper_diag.c
Go to the documentation of this file.
1#include "ladel_types.h"
2#include "ladel_global.h"
3#include "ladel_upper_diag.h"
4#include "ladel_transpose.h"
5#include "ladel_debug_print.h"
6
8{
9 ladel_int index, row, col, Mptemp, nzM = 0;
10
11 if (M->symmetry == LOWER)
12 {
14 ladel_sparse_copy(Mt, M);
16 }
17
18 for (col = 0; col < M->ncol; col++)
19 {
20 Mptemp = M->p[col];
21 M->p[col] = nzM;
22 for (index = Mptemp; index < ((M->nz) ? Mptemp + M->nz[col] : M->p[col+1]); index++)
23 {
24 row = M->i[index];
25 if (row <= col)
26 {
27 M->i[nzM] = row;
28 if (M->values) M->x[nzM] = M->x[index];
29 nzM++;
30 }
31 }
32 }
33 M->p[M->ncol] = nzM;
35 M->symmetry = UPPER;
36}
#define TRUE
For booleans.
#define LOWER
Use only lower part of matrix.
#define UPPER
Use only upper part of matrix.
void ladel_sparse_copy(ladel_sparse_matrix *M, ladel_sparse_matrix *M_copy)
Copies a matrix (preallocated)
Definition: ladel_copy.c:12
Routines to print out matrices and vectors.
Memory allocation routines.
ladel_int ladel_sparse_realloc(ladel_sparse_matrix *M, ladel_int nzmax)
Reallocate a sparse matrix with a new size.
Definition: ladel_global.c:141
ladel_sparse_matrix * ladel_sparse_free(ladel_sparse_matrix *M)
Free a sparse matrix (and return NULL).
Definition: ladel_global.c:91
Routine to compute the transpose of a matrix.
ladel_sparse_matrix * ladel_transpose(ladel_sparse_matrix *M, ladel_int values, ladel_work *work)
Returns the transpose of a matrix, that is .
Structures and types used in LADEL routines.
int64_t ladel_int
Type for integer numbers (default: int64_t)
Definition: ladel_types.h:24
void ladel_to_upper_diag(ladel_sparse_matrix *M)
Return , that is the upper diagonal elements of M.
Routine to keep only the upper diagonal elements of a (symmetric) matrix.
Sparse matrix in compressed column storage.
Definition: ladel_types.h:35
ladel_int symmetry
type of symmetry (UNSYMMETRIC, UPPER or LOWER)
Definition: ladel_types.h:46
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 * nz
(optional) number of elements in each column (size ncol)
Definition: ladel_types.h:43
ladel_int values
has numerical values
Definition: ladel_types.h:45
ladel_int * i
row pointers (size nzmax)
Definition: ladel_types.h:41