24 if (!M || !M_transpose || !work)
return NULL;
26 ladel_int col, row, row2, index, index2, MMt_nnz = 0;
31 for (col = 0; col < M_transpose->
ncol; col++)
36 row = M_transpose->
i[index];
40 if (row2 > col)
break;
41 if (touched[row2] != work->
flag)
43 touched[row2] = work->
flag;
51 if (!MMt)
return NULL;
54 if (MMt->
values)
for (index = 0; index < MMt_nnz; index++) MMt->
x[index] = 0;
58 for (col = 0; col < M_transpose->
ncol; col++)
63 row = M_transpose->
i[index];
68 if (row2 > col)
break;
69 if (touched[row2] != work->
flag)
72 touched[row2] = work->
flag;
73 MMt->
i[MMt_nnz] = row2;
76 MMt_col[row2] += (diag) ? M->
x[index2]*diag[row]*M_transpose->
x[index] : M->
x[index2]*M_transpose->
x[index];
79 MMt->
p[col+1] = MMt_nnz+1;
85 MMt->
x[index] = MMt_col[MMt->
i[index]];
86 MMt_col[MMt->
i[index]] = 0;
#define TRUE
For booleans.
#define FALSE
For booleans.
#define UPPER
Use only upper part of matrix.
#define LADEL_FOR(index, M, col)
Loop through a column of a sparse matrix.
Constants and macros used in LADEL.
Routines to copy matrices and vectors.
Memory allocation routines.
ladel_sparse_matrix * ladel_sparse_alloc(ladel_int nrow, ladel_int ncol, ladel_int nzmax, ladel_int symmetry, ladel_int values, ladel_int nz)
Allocate a sparse matrix.
ladel_sparse_matrix * ladel_mat_diag_mat_transpose(const ladel_sparse_matrix *M, const ladel_sparse_matrix *M_transpose, const ladel_double *diag, ladel_work *work)
Computes .
ladel_sparse_matrix * ladel_mat_mat_transpose_pattern(const ladel_sparse_matrix *M, const ladel_sparse_matrix *M_transpose, ladel_work *work)
Computes the pattern of .
ladel_sparse_matrix * ladel_mat_mat_transpose(const ladel_sparse_matrix *M, const ladel_sparse_matrix *M_transpose, ladel_work *work)
Computes .
ladel_sparse_matrix * ladel_mat_mat_transpose_advanced(const ladel_sparse_matrix *M, const ladel_sparse_matrix *M_transpose, const ladel_double *diag, ladel_int values, ladel_work *work)
Core mat_mat_transpose function with all options (diag and value/pattern).
Routines to compute matrix matrix products. For now only and , with a diagonal matrix,...
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_int ncol
number of columns
ladel_double * x
numerical values (size nzmax)
ladel_int * p
column pointers (size ncol+1)
ladel_int values
has numerical values
ladel_int nrow
number of rows
ladel_int * i
row pointers (size nzmax)
Workspace required for various routines in LADEL.
ladel_int flag
Flag used to mark nodes, used in conjunction with array_int_ncol_flag.
ladel_int * array_int_ncol_flag
An array of ncol integers, assumed to be < flag.
ladel_double * array_double_all_zeros_ncol1
An array of ncol doubles, on input and output this should be all zeros.