Classes | Macros | Typedefs | Functions
ccolamd.c File Reference
#include "ccolamd.h"
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <stdio.h>
Include dependency graph for ccolamd.c:

Go to the source code of this file.

Classes

struct  CColamd_Col_struct
 
struct  CColamd_Row_struct
 

Macros

#define ALIVE   (0)
 
#define ASSERT(expression)
 
#define CCOLAMD_2   ccolamd2
 
#define CCOLAMD_apply_order   ccolamd_apply_order
 
#define CCOLAMD_C(n_col, ok)   ((t_mult (t_add (n_col, 1, ok), sizeof (CColamd_Col), ok) / sizeof (Int)))
 
#define CCOLAMD_fsize   ccolamd_fsize
 
#define CCOLAMD_MAIN   ccolamd
 
#define CCOLAMD_post_tree   ccolamd_post_tree
 
#define CCOLAMD_postorder   ccolamd_postorder
 
#define CCOLAMD_R(n_row, ok)   ((t_mult (t_add (n_row, 1, ok), sizeof (CColamd_Row), ok) / sizeof (Int)))
 
#define CCOLAMD_recommended   ccolamd_recommended
 
#define CCOLAMD_report   ccolamd_report
 
#define CCOLAMD_set_defaults   ccolamd_set_defaults
 
#define CMEMBER(c)   ((cmember == (Int *) NULL) ? (0) : (cmember [c]))
 
#define COL_IS_ALIVE(c)   (Col [c].start >= ALIVE)
 
#define COL_IS_DEAD(c)   (Col [c].start < ALIVE)
 
#define COL_IS_DEAD_PRINCIPAL(c)   (Col [c].start == DEAD_PRINCIPAL)
 
#define CSYMAMD_MAIN   csymamd
 
#define CSYMAMD_report   csymamd_report
 
#define DEAD   (-1)
 
#define DEAD_NON_PRINCIPAL   (-2)
 
#define DEAD_PRINCIPAL   (-1)
 
#define DEBUG0(params)   ;
 
#define DEBUG1(params)   ;
 
#define DEBUG2(params)   ;
 
#define DEBUG3(params)   ;
 
#define DEBUG4(params)   ;
 
#define DENSE_DEGREE(alpha, n)   ((Int) MAX (16.0, (alpha) * sqrt ((double) (n))))
 
#define EMPTY   (-1)
 
#define FALSE   (0)
 
#define GLOBAL
 
#define ID   "%d"
 
#define INDEX(i)   (i)
 
#define Int   int
 
#define Int_MAX   INT_MAX
 
#define INT_OVERFLOW(x)
 
#define KILL_NON_PRINCIPAL_COL(c)   { Col [c].start = DEAD_NON_PRINCIPAL ; }
 
#define KILL_PRINCIPAL_COL(c)   { Col [c].start = DEAD_PRINCIPAL ; }
 
#define KILL_ROW(r)   { Row [r].shared2.mark = DEAD ; }
 
#define MAX(a, b)   (((a) > (b)) ? (a) : (b))
 
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
 
#define NDEBUG
 
#define NULL   ((void *) 0)
 
#define ONES_COMPLEMENT(r)   (-(r)-1)
 
#define PRIVATE   static
 
#define PUBLIC
 
#define ROW_IS_ALIVE(r)   (Row [r].shared2.mark >= ALIVE)
 
#define ROW_IS_DEAD(r)   ROW_IS_MARKED_DEAD (Row[r].shared2.mark)
 
#define ROW_IS_MARKED_DEAD(row_mark)   (row_mark < ALIVE)
 
#define SCALAR_IS_NAN(x)   ((x) != (x))
 
#define TRUE   (1)
 

Typedefs

typedef struct CColamd_Col_struct CColamd_Col
 
typedef struct CColamd_Row_struct CColamd_Row
 

Functions

PUBLIC Int CCOLAMD_2 (Int n_row, Int n_col, Int Alen, Int A[], Int p[], double knobs[CCOLAMD_KNOBS], Int stats[CCOLAMD_STATS], Int Front_npivcol[], Int Front_nrows[], Int Front_ncols[], Int Front_parent[], Int Front_cols[], Int *p_nfr, Int InFront[], Int cmember[])
 
GLOBAL void CCOLAMD_apply_order (Int Front[], const Int Order[], Int Temp[], Int nn, Int nfr)
 
GLOBAL void CCOLAMD_fsize (Int nn, Int Fsize[], Int Fnrows[], Int Fncols[], Int Parent[], Int Npiv[])
 
PUBLIC Int CCOLAMD_MAIN (Int n_row, Int n_col, Int Alen, Int A[], Int p[], double knobs[CCOLAMD_KNOBS], Int stats[CCOLAMD_STATS], Int cmember[])
 
static size_t ccolamd_need (Int nnz, Int n_row, Int n_col, int *ok)
 
GLOBAL Int CCOLAMD_post_tree (Int root, Int k, Int Child[], const Int Sibling[], Int Order[], Int Stack[])
 
GLOBAL void CCOLAMD_postorder (Int nn, Int Parent[], Int Nv[], Int Fsize[], Int Order[], Int Child[], Int Sibling[], Int Stack[], Int Front_cols[], Int cmember[])
 
PUBLIC size_t CCOLAMD_recommended (Int nnz, Int n_row, Int n_col)
 
PUBLIC void CCOLAMD_report (Int stats[CCOLAMD_STATS])
 
PUBLIC void CCOLAMD_set_defaults (double knobs[CCOLAMD_KNOBS])
 
PRIVATE Int clear_mark (Int tag_mark, Int max_mark, Int n_row, CColamd_Row Row[])
 
PUBLIC Int CSYMAMD_MAIN (Int n, Int A[], Int p[], Int perm[], double knobs[CCOLAMD_KNOBS], Int stats[CCOLAMD_STATS], void *(*allocate)(size_t, size_t), void(*release)(void *), Int cmember[], Int stype)
 
PUBLIC void CSYMAMD_report (Int stats[CCOLAMD_STATS])
 
PRIVATE void detect_super_cols (CColamd_Col Col[], Int A[], Int head[], Int row_start, Int row_length, Int in_set[])
 
PRIVATE Int find_ordering (Int n_row, Int n_col, Int Alen, CColamd_Row Row[], CColamd_Col Col[], Int A[], Int head[], Int max_deg, Int pfree, Int cset[], Int cset_start[], Int cmember[], Int Front_npivcol[], Int Front_nrows[], Int Front_ncols[], Int Front_parent[], Int Front_cols[], Int *p_nfr, Int aggressive, Int InFront[], Int order_for_lu)
 
PRIVATE Int garbage_collection (Int n_row, Int n_col, CColamd_Row Row[], CColamd_Col Col[], Int A[], Int *pfree)
 
PRIVATE Int init_rows_cols (Int n_row, Int n_col, CColamd_Row Row[], CColamd_Col Col[], Int A[], Int p[], Int stats[CCOLAMD_STATS])
 
PRIVATE void init_scoring (Int n_row, Int n_col, CColamd_Row Row[], CColamd_Col Col[], Int A[], Int head[], double knobs[CCOLAMD_KNOBS], Int *p_n_row2, Int *p_n_col2, Int *p_max_deg, Int cmember[], Int n_cset, Int cset_start[], Int dead_cols[], Int *p_ndense_row, Int *p_nempty_row, Int *p_nnewlyempty_row, Int *p_ndense_col, Int *p_nempty_col, Int *p_nnewlyempty_col)
 
PRIVATE void print_report (char *method, Int stats[CCOLAMD_STATS])
 
static size_t t_add (size_t a, size_t b, int *ok)
 
static size_t t_mult (size_t a, size_t k, int *ok)
 

Macro Definition Documentation

◆ ALIVE

#define ALIVE   (0)

Definition at line 754 of file ccolamd.c.

◆ ASSERT

#define ASSERT (   expression)

Definition at line 872 of file ccolamd.c.

◆ CCOLAMD_2

#define CCOLAMD_2   ccolamd2

Definition at line 642 of file ccolamd.c.

◆ CCOLAMD_apply_order

#define CCOLAMD_apply_order   ccolamd_apply_order

Definition at line 644 of file ccolamd.c.

◆ CCOLAMD_C

#define CCOLAMD_C (   n_col,
  ok 
)    ((t_mult (t_add (n_col, 1, ok), sizeof (CColamd_Col), ok) / sizeof (Int)))

Definition at line 1034 of file ccolamd.c.

◆ CCOLAMD_fsize

#define CCOLAMD_fsize   ccolamd_fsize

Definition at line 647 of file ccolamd.c.

◆ CCOLAMD_MAIN

#define CCOLAMD_MAIN   ccolamd

Definition at line 643 of file ccolamd.c.

◆ CCOLAMD_post_tree

#define CCOLAMD_post_tree   ccolamd_post_tree

Definition at line 646 of file ccolamd.c.

◆ CCOLAMD_postorder

#define CCOLAMD_postorder   ccolamd_postorder

Definition at line 645 of file ccolamd.c.

◆ CCOLAMD_R

#define CCOLAMD_R (   n_row,
  ok 
)    ((t_mult (t_add (n_row, 1, ok), sizeof (CColamd_Row), ok) / sizeof (Int)))

Definition at line 1037 of file ccolamd.c.

◆ CCOLAMD_recommended

#define CCOLAMD_recommended   ccolamd_recommended

Definition at line 640 of file ccolamd.c.

◆ CCOLAMD_report

#define CCOLAMD_report   ccolamd_report

Definition at line 649 of file ccolamd.c.

◆ CCOLAMD_set_defaults

#define CCOLAMD_set_defaults   ccolamd_set_defaults

Definition at line 641 of file ccolamd.c.

◆ CMEMBER

#define CMEMBER (   c)    ((cmember == (Int *) NULL) ? (0) : (cmember [c]))

Definition at line 738 of file ccolamd.c.

◆ COL_IS_ALIVE

#define COL_IS_ALIVE (   c)    (Col [c].start >= ALIVE)

Definition at line 766 of file ccolamd.c.

◆ COL_IS_DEAD

#define COL_IS_DEAD (   c)    (Col [c].start < ALIVE)

Definition at line 765 of file ccolamd.c.

◆ COL_IS_DEAD_PRINCIPAL

#define COL_IS_DEAD_PRINCIPAL (   c)    (Col [c].start == DEAD_PRINCIPAL)

Definition at line 767 of file ccolamd.c.

◆ CSYMAMD_MAIN

#define CSYMAMD_MAIN   csymamd

Definition at line 648 of file ccolamd.c.

◆ CSYMAMD_report

#define CSYMAMD_report   csymamd_report

Definition at line 650 of file ccolamd.c.

◆ DEAD

#define DEAD   (-1)

Definition at line 755 of file ccolamd.c.

◆ DEAD_NON_PRINCIPAL

#define DEAD_NON_PRINCIPAL   (-2)

Definition at line 759 of file ccolamd.c.

◆ DEAD_PRINCIPAL

#define DEAD_PRINCIPAL   (-1)

Definition at line 758 of file ccolamd.c.

◆ DEBUG0

#define DEBUG0 (   params)    ;

Definition at line 866 of file ccolamd.c.

◆ DEBUG1

#define DEBUG1 (   params)    ;

Definition at line 867 of file ccolamd.c.

◆ DEBUG2

#define DEBUG2 (   params)    ;

Definition at line 868 of file ccolamd.c.

◆ DEBUG3

#define DEBUG3 (   params)    ;

Definition at line 869 of file ccolamd.c.

◆ DEBUG4

#define DEBUG4 (   params)    ;

Definition at line 870 of file ccolamd.c.

◆ DENSE_DEGREE

#define DENSE_DEGREE (   alpha,
  n 
)    ((Int) MAX (16.0, (alpha) * sqrt ((double) (n))))

Definition at line 735 of file ccolamd.c.

◆ EMPTY

#define EMPTY   (-1)

Definition at line 726 of file ccolamd.c.

◆ FALSE

#define FALSE   (0)

Definition at line 751 of file ccolamd.c.

◆ GLOBAL

#define GLOBAL

Definition at line 731 of file ccolamd.c.

◆ ID

#define ID   "%d"

Definition at line 637 of file ccolamd.c.

◆ INDEX

#define INDEX (   i)    (i)

Definition at line 782 of file ccolamd.c.

◆ Int

#define Int   int

Definition at line 636 of file ccolamd.c.

◆ Int_MAX

#define Int_MAX   INT_MAX

Definition at line 638 of file ccolamd.c.

◆ INT_OVERFLOW

#define INT_OVERFLOW (   x)
Value:
((!((x) * (1.0+1e-8) <= (double) Int_MAX)) \

Definition at line 744 of file ccolamd.c.

◆ KILL_NON_PRINCIPAL_COL

#define KILL_NON_PRINCIPAL_COL (   c)    { Col [c].start = DEAD_NON_PRINCIPAL ; }

Definition at line 770 of file ccolamd.c.

◆ KILL_PRINCIPAL_COL

#define KILL_PRINCIPAL_COL (   c)    { Col [c].start = DEAD_PRINCIPAL ; }

Definition at line 769 of file ccolamd.c.

◆ KILL_ROW

#define KILL_ROW (   r)    { Row [r].shared2.mark = DEAD ; }

Definition at line 768 of file ccolamd.c.

◆ MAX

#define MAX (   a,
  b 
)    (((a) > (b)) ? (a) : (b))

Definition at line 727 of file ccolamd.c.

◆ MIN

#define MIN (   a,
  b 
)    (((a) < (b)) ? (a) : (b))

Definition at line 728 of file ccolamd.c.

◆ NDEBUG

#define NDEBUG

Definition at line 582 of file ccolamd.c.

◆ NULL

#define NULL   ((void *) 0)

Definition at line 609 of file ccolamd.c.

◆ ONES_COMPLEMENT

#define ONES_COMPLEMENT (   r)    (-(r)-1)

Definition at line 747 of file ccolamd.c.

◆ PRIVATE

#define PRIVATE   static

Definition at line 733 of file ccolamd.c.

◆ PUBLIC

#define PUBLIC

Definition at line 732 of file ccolamd.c.

◆ ROW_IS_ALIVE

#define ROW_IS_ALIVE (   r)    (Row [r].shared2.mark >= ALIVE)

Definition at line 764 of file ccolamd.c.

◆ ROW_IS_DEAD

#define ROW_IS_DEAD (   r)    ROW_IS_MARKED_DEAD (Row[r].shared2.mark)

Definition at line 762 of file ccolamd.c.

◆ ROW_IS_MARKED_DEAD

#define ROW_IS_MARKED_DEAD (   row_mark)    (row_mark < ALIVE)

Definition at line 763 of file ccolamd.c.

◆ SCALAR_IS_NAN

#define SCALAR_IS_NAN (   x)    ((x) != (x))

Definition at line 741 of file ccolamd.c.

◆ TRUE

#define TRUE   (1)

Definition at line 750 of file ccolamd.c.

Typedef Documentation

◆ CColamd_Col

◆ CColamd_Row

Function Documentation

◆ CCOLAMD_2()

PUBLIC Int CCOLAMD_2 ( Int  n_row,
Int  n_col,
Int  Alen,
Int  A[],
Int  p[],
double  knobs[CCOLAMD_KNOBS],
Int  stats[CCOLAMD_STATS],
Int  Front_npivcol[],
Int  Front_nrows[],
Int  Front_ncols[],
Int  Front_parent[],
Int  Front_cols[],
Int p_nfr,
Int  InFront[],
Int  cmember[] 
)

Definition at line 1506 of file ccolamd.c.

◆ CCOLAMD_apply_order()

GLOBAL void CCOLAMD_apply_order ( Int  Front[],
const Int  Order[],
Int  Temp[],
Int  nn,
Int  nfr 
)

Definition at line 3873 of file ccolamd.c.

◆ CCOLAMD_fsize()

GLOBAL void CCOLAMD_fsize ( Int  nn,
Int  Fsize[],
Int  Fnrows[],
Int  Fncols[],
Int  Parent[],
Int  Npiv[] 
)

Definition at line 3910 of file ccolamd.c.

◆ CCOLAMD_MAIN()

PUBLIC Int CCOLAMD_MAIN ( Int  n_row,
Int  n_col,
Int  Alen,
Int  A[],
Int  p[],
double  knobs[CCOLAMD_KNOBS],
Int  stats[CCOLAMD_STATS],
Int  cmember[] 
)

Definition at line 1477 of file ccolamd.c.

◆ ccolamd_need()

static size_t ccolamd_need ( Int  nnz,
Int  n_row,
Int  n_col,
int ok 
)
static

Definition at line 1047 of file ccolamd.c.

◆ CCOLAMD_post_tree()

GLOBAL Int CCOLAMD_post_tree ( Int  root,
Int  k,
Int  Child[],
const Int  Sibling[],
Int  Order[],
Int  Stack[] 
)

Definition at line 4157 of file ccolamd.c.

◆ CCOLAMD_postorder()

GLOBAL void CCOLAMD_postorder ( Int  nn,
Int  Parent[],
Int  Nv[],
Int  Fsize[],
Int  Order[],
Int  Child[],
Int  Sibling[],
Int  Stack[],
Int  Front_cols[],
Int  cmember[] 
)

Definition at line 3970 of file ccolamd.c.

◆ CCOLAMD_recommended()

PUBLIC size_t CCOLAMD_recommended ( Int  nnz,
Int  n_row,
Int  n_col 
)

Definition at line 1084 of file ccolamd.c.

◆ CCOLAMD_report()

PUBLIC void CCOLAMD_report ( Int  stats[CCOLAMD_STATS])

Definition at line 1973 of file ccolamd.c.

◆ CCOLAMD_set_defaults()

PUBLIC void CCOLAMD_set_defaults ( double  knobs[CCOLAMD_KNOBS])

Definition at line 1115 of file ccolamd.c.

◆ clear_mark()

PRIVATE Int clear_mark ( Int  tag_mark,
Int  max_mark,
Int  n_row,
CColamd_Row  Row[] 
)

Definition at line 3678 of file ccolamd.c.

◆ CSYMAMD_MAIN()

PUBLIC Int CSYMAMD_MAIN ( Int  n,
Int  A[],
Int  p[],
Int  perm[],
double  knobs[CCOLAMD_KNOBS],
Int  stats[CCOLAMD_STATS],
void *(*)(size_t, size_t allocate,
void(*)(void *)  release,
Int  cmember[],
Int  stype 
)

Definition at line 1145 of file ccolamd.c.

◆ CSYMAMD_report()

PUBLIC void CSYMAMD_report ( Int  stats[CCOLAMD_STATS])

Definition at line 1986 of file ccolamd.c.

◆ detect_super_cols()

PRIVATE void detect_super_cols ( CColamd_Col  Col[],
Int  A[],
Int  head[],
Int  row_start,
Int  row_length,
Int  in_set[] 
)

Definition at line 3374 of file ccolamd.c.

◆ find_ordering()

PRIVATE Int find_ordering ( Int  n_row,
Int  n_col,
Int  Alen,
CColamd_Row  Row[],
CColamd_Col  Col[],
Int  A[],
Int  head[],
Int  max_deg,
Int  pfree,
Int  cset[],
Int  cset_start[],
Int  cmember[],
Int  Front_npivcol[],
Int  Front_nrows[],
Int  Front_ncols[],
Int  Front_parent[],
Int  Front_cols[],
Int p_nfr,
Int  aggressive,
Int  InFront[],
Int  order_for_lu 
)

Definition at line 2546 of file ccolamd.c.

◆ garbage_collection()

PRIVATE Int garbage_collection ( Int  n_row,
Int  n_col,
CColamd_Row  Row[],
CColamd_Col  Col[],
Int  A[],
Int pfree 
)

Definition at line 3546 of file ccolamd.c.

◆ init_rows_cols()

PRIVATE Int init_rows_cols ( Int  n_row,
Int  n_col,
CColamd_Row  Row[],
CColamd_Col  Col[],
Int  A[],
Int  p[],
Int  stats[CCOLAMD_STATS] 
)

Definition at line 2015 of file ccolamd.c.

◆ init_scoring()

PRIVATE void init_scoring ( Int  n_row,
Int  n_col,
CColamd_Row  Row[],
CColamd_Col  Col[],
Int  A[],
Int  head[],
double  knobs[CCOLAMD_KNOBS],
Int p_n_row2,
Int p_n_col2,
Int p_max_deg,
Int  cmember[],
Int  n_cset,
Int  cset_start[],
Int  dead_cols[],
Int p_ndense_row,
Int p_nempty_row,
Int p_nnewlyempty_row,
Int p_ndense_col,
Int p_nempty_col,
Int p_nnewlyempty_col 
)

Definition at line 2260 of file ccolamd.c.

◆ print_report()

PRIVATE void print_report ( char *  method,
Int  stats[CCOLAMD_STATS] 
)

Definition at line 3715 of file ccolamd.c.

◆ t_add()

static size_t t_add ( size_t  a,
size_t  b,
int ok 
)
static

Definition at line 1016 of file ccolamd.c.

◆ t_mult()

static size_t t_mult ( size_t  a,
size_t  k,
int ok 
)
static

Definition at line 1023 of file ccolamd.c.

e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
SCALAR_IS_NAN
#define SCALAR_IS_NAN(x)
Definition: ccolamd.c:741
Int_MAX
#define Int_MAX
Definition: ccolamd.c:638


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:09:45