#include "ov.h"
#include "defun-dld.h"
#include "error.h"
#include "gripes.h"
#include "utils.h"
#include "oct-locbuf.h"
#include "ov-re-mat.h"
#include "ov-re-sparse.h"
#include "ov-cx-sparse.h"
#include "oct-sparse.h"
Go to the source code of this file.
Classes | |
struct | CMK_Node |
Defines | |
#define | H_empty(H, h) ((h) == 0) |
#define | LEFT(i) (((i) << 1) + 1) |
#define | PARENT(i) (((i) - 1) >> 1) |
#define | Q_empty(Q, N, qh, qt) ((qh) == (qt)) |
#define | RIGHT(i) (((i) << 1) + 2) |
Functions | |
static octave_idx_type | calc_degrees (octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *D) |
DEFUN_DLD (symrcm, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{p} =} symrcm (@var{S})\n\ Return the symmetric reverse Cuthill-McKee permutation of @var{S}.\n\ @var{p} is a permutation vector such that\n\ @code{@var{S}(@var{p}, @var{p})} tends to have its diagonal elements\n\ closer to the diagonal than @var{S}. This is a good preordering for LU\n\ or Cholesky@tie{}factorization of matrices that come from 'long, skinny'\n\ problems. It works for both symmetric and asymmetric @var{S}.\n\ \n\ The algorithm represents a heuristic approach to the NP-complete\n\ bandwidth minimization problem. The implementation is based in the\n\ descriptions found in\n\ \n\ E. Cuthill, J. McKee. @cite{Reducing the Bandwidth of Sparse Symmetric\n\ Matrices}. Proceedings of the 24th ACM National Conference, 157--172\n\ 1969, Brandon Press, New Jersey.\n\ \n\ A. George, J.W.H. Liu. @cite{Computer Solution of Large Sparse\n\ Positive Definite Systems}, Prentice Hall Series in Computational\n\ Mathematics, ISBN 0-13-165274-5, 1981.\n\ \n\ @seealso{colperm, colamd, symamd}\n\ @end deftypefn") | |
static octave_idx_type | find_starting_node (octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, const octave_idx_type *ridx2, const octave_idx_type *cidx2, octave_idx_type *D, octave_idx_type start) |
static void | H_heapify_min (CMK_Node *A, octave_idx_type i, octave_idx_type size) |
static void | H_insert (CMK_Node *H, octave_idx_type &h, const CMK_Node &o) |
static CMK_Node | H_remove_min (CMK_Node *H, octave_idx_type &h, int reorg) |
static CMK_Node | Q_deq (CMK_Node *Q, octave_idx_type N, octave_idx_type &qh) |
static void | Q_enq (CMK_Node *Q, octave_idx_type N, octave_idx_type &qt, const CMK_Node &o) |
static void | transpose (octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2) |
#define H_empty | ( | H, | ||
h | ||||
) | ((h) == 0) |
Definition at line 190 of file symrcm.cc.
Referenced by DEFUN_DLD().
#define LEFT | ( | i | ) | (((i) << 1) + 1) |
Definition at line 109 of file symrcm.cc.
Referenced by H_heapify_min().
#define PARENT | ( | i | ) | (((i) - 1) >> 1) |
Definition at line 113 of file symrcm.cc.
Referenced by H_insert().
Definition at line 104 of file symrcm.cc.
Referenced by DEFUN_DLD(), and find_starting_node().
#define RIGHT | ( | i | ) | (((i) << 1) + 2) |
Definition at line 111 of file symrcm.cc.
Referenced by H_heapify_min().
static octave_idx_type calc_degrees | ( | octave_idx_type | N, | |
const octave_idx_type * | ridx, | |||
const octave_idx_type * | cidx, | |||
octave_idx_type * | D | |||
) | [static] |
Definition at line 334 of file symrcm.cc.
Referenced by DEFUN_DLD().
DEFUN_DLD | ( | symrcm | , | |
args | ||||
) |
Definition at line 418 of file symrcm.cc.
References arg(), B, calc_degrees(), octave_value::columns(), CMK_Node::deg, CMK_Node::dist, Array< T >::elem(), error_state, find_starting_node(), Array< T >::fortran_vec(), gripe_square_matrix_required(), H_empty, H_insert(), H_remove_min(), CMK_Node::id, octave_value::is_real_type(), N, OCTAVE_LOCAL_BUFFER, octave_value(), print_usage(), Q, Q_deq(), Q_empty, Q_enq(), r1, r2, octave_value::rows(), octave_value::sparse_complex_matrix_value(), octave_value::sparse_matrix_value(), transpose(), Sparse< T >::xcidx(), and Sparse< T >::xridx().
static octave_idx_type find_starting_node | ( | octave_idx_type | N, | |
const octave_idx_type * | ridx, | |||
const octave_idx_type * | cidx, | |||
const octave_idx_type * | ridx2, | |||
const octave_idx_type * | cidx2, | |||
octave_idx_type * | D, | |||
octave_idx_type | start | |||
) | [static] |
Definition at line 196 of file symrcm.cc.
References CMK_Node::deg, CMK_Node::dist, Array< T >::fortran_vec(), CMK_Node::id, OCTAVE_LOCAL_BUFFER, Q, Q_deq(), Q_empty, Q_enq(), r1, r2, and x.
Referenced by DEFUN_DLD().
static void H_heapify_min | ( | CMK_Node * | A, | |
octave_idx_type | i, | |||
octave_idx_type | size | |||
) | [static] |
static void H_insert | ( | CMK_Node * | H, | |
octave_idx_type & | h, | |||
const CMK_Node & | o | |||
) | [static] |
static CMK_Node H_remove_min | ( | CMK_Node * | H, | |
octave_idx_type & | h, | |||
int | reorg | |||
) | [inline, static] |
static CMK_Node Q_deq | ( | CMK_Node * | Q, | |
octave_idx_type | N, | |||
octave_idx_type & | qh | |||
) | [inline, static] |
Definition at line 96 of file symrcm.cc.
Referenced by DEFUN_DLD(), and find_starting_node().
static void Q_enq | ( | CMK_Node * | Q, | |
octave_idx_type | N, | |||
octave_idx_type & | qt, | |||
const CMK_Node & | o | |||
) | [inline, static] |
Definition at line 87 of file symrcm.cc.
Referenced by DEFUN_DLD(), and find_starting_node().
static void transpose | ( | octave_idx_type | N, | |
const octave_idx_type * | ridx, | |||
const octave_idx_type * | cidx, | |||
octave_idx_type * | ridx2, | |||
octave_idx_type * | cidx2 | |||
) | [static] |
Definition at line 386 of file symrcm.cc.
References OCTAVE_LOCAL_BUFFER.
Referenced by DEFUN_DLD(), SparseMatrix::hermitian(), install_b_b_ops(), install_bm_bm_ops(), install_cdm_cdm_ops(), install_cell_ops(), install_chm_ops(), install_class_ops(), install_cm_cm_ops(), install_cs_cs_ops(), install_dm_dm_ops(), install_fcdm_fcdm_ops(), install_fcs_fcs_ops(), install_fdm_fdm_ops(), install_fs_fs_ops(), install_m_m_ops(), install_pm_pm_ops(), install_range_ops(), install_s_s_ops(), install_sbm_sbm_ops(), install_scm_scm_ops(), install_sm_sm_ops(), install_str_str_ops(), install_struct_ops(), FloatQR::update(), and QR::update().