MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / init_scoring

Function init_scoring

include/Eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h:717–941  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715*/
716template <typename IndexType>
717static void init_scoring
718 (
719 /* === Parameters ======================================================= */
720
721 IndexType n_row, /* number of rows of A */
722 IndexType n_col, /* number of columns of A */
723 RowStructure<IndexType> Row [], /* of size n_row+1 */
724 ColStructure<IndexType> Col [], /* of size n_col+1 */
725 IndexType A [], /* column form and row form of A */
726 IndexType head [], /* of size n_col+1 */
727 double knobs [NKnobs],/* parameters */
728 IndexType *p_n_row2, /* number of non-dense, non-empty rows */
729 IndexType *p_n_col2, /* number of non-dense, non-empty columns */
730 IndexType *p_max_deg /* maximum row degree */
731 )
732{
733 /* === Local variables ================================================== */
734
735 IndexType c ; /* a column index */
736 IndexType r, row ; /* a row index */
737 IndexType *cp ; /* a column pointer */
738 IndexType deg ; /* degree of a row or column */
739 IndexType *cp_end ; /* a pointer to the end of a column */
740 IndexType *new_cp ; /* new column pointer */
741 IndexType col_length ; /* length of pruned column */
742 IndexType score ; /* current column score */
743 IndexType n_col2 ; /* number of non-dense, non-empty columns */
744 IndexType n_row2 ; /* number of non-dense, non-empty rows */
745 IndexType dense_row_count ; /* remove rows with more entries than this */
746 IndexType dense_col_count ; /* remove cols with more entries than this */
747 IndexType min_score ; /* smallest column score */
748 IndexType max_deg ; /* maximum row degree */
749 IndexType next_col ; /* Used to add to degree list.*/
750
751
752 /* === Extract knobs ==================================================== */
753
754 dense_row_count = numext::maxi(IndexType(0), numext::mini(IndexType(knobs [Colamd::DenseRow] * n_col), n_col)) ;
755 dense_col_count = numext::maxi(IndexType(0), numext::mini(IndexType(knobs [Colamd::DenseCol] * n_row), n_row)) ;
756 COLAMD_DEBUG1 (("colamd: densecount: %d %d\n", dense_row_count, dense_col_count)) ;
757 max_deg = 0 ;
758 n_col2 = n_col ;
759 n_row2 = n_row ;
760
761 /* === Kill empty columns =============================================== */
762
763 /* Put the empty columns at the end in their natural order, so that LU */
764 /* factorization can proceed as far as possible. */
765 for (c = n_col-1 ; c >= 0 ; c--)
766 {
767 deg = Col [c].length ;
768 if (deg == 0)
769 {
770 /* this is a empty column, kill and order it last */
771 Col [c].shared2.order = --n_col2 ;
772 Col[c].kill_principal() ;
773 }
774 }

Callers 1

compute_orderingFunction · 0.85

Calls 6

maxiFunction · 0.85
miniFunction · 0.85
kill_principalMethod · 0.80
killMethod · 0.80
is_deadMethod · 0.45
is_aliveMethod · 0.45

Tested by

no test coverage detected