The R Project SVN R-packages

Rev

Rev 1820 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#ifndef NDEBUG

        /*
        cholmod_print_parent (Lparent, n, "Lparent, w/colcnt", Common) ;
        cholmod_print_perm (Lperm, n, n, "Lperm, w/colcnt", Common) ;
        cholmod_print_subset (Lcolcount, n, n, "Colcount, w/colcnt",Common);
        */

        if (symmetric < 0)
        {
        /* symmetric lower case: S = tril (A (p,p))' and F = S' */
        /* workspace: Iwork (2*nrow) */
        C2 = cholmod_transpose (A, FALSE, Lperm, NULL, 0, Common) ;
        SS = C2 ;
        /* workspace: Iwork (nrow) */
        C1 = cholmod_transpose (C2, FALSE, NULL, NULL, 0, Common) ;
        FF = C1 ;
        }
        else
        {
        /* symmetric upper case: F = triu (A (p,p))'  and S = F' */
        /* unsymmetric case:     F = A (p,f)'         and S = F' */
        /* workspace: symmetric: Iwork (2*nrow),
         * unsym: Iwork (nrow if no fset, MAX(nrow,ncol) if fset)
         */
        C1 = cholmod_transpose (A, FALSE, Lperm, fset, nf, Common) ;
        FF = C1 ;
        /* workspace: Iwork (nrow) */
        C2 = cholmod_transpose (C1, FALSE, NULL, NULL, 0, Common) ;
        SS = C2 ;
        }

        /* workspace: symmmetric: Iwork (nrow),
         * unsymmetric: Iwork (nrow+ncol)*/
        ColCount2 = cholmod_malloc (n, sizeof (int), Common) ;
        Parent2 = cholmod_malloc (n, sizeof (int), Common) ;
        Post2 = cholmod_malloc (n, sizeof (int), Common) ;

        /*
        cholmod_print_parent (Lparent, n, "Lparent, w/colcnt", Common) ;
        printf (">>>>> finding etree of post-permuted matrix\n")  ;
        */

        cholmod_etree (symmetric ? SS:FF, Parent2, Common) ;

        /*
        cholmod_print_parent (Parent2, n, "Parent2, w/colcnt", Common) ;
        for (k = 0 ; k < n ; k++)
        {
        printf ("k %d Parent old %d new %d\n", k, Lparent [k],
            Parent2 [k]) ;
        }
        */

        for (k = 0 ; k < n ; k++)
        {
        ASSERT (Lparent [k] == Parent2 [k]) ;
        }

        /* workspace: Iwork (2*nrow) */
        cholmod_postorder (Parent2, n, NULL, Post2, Common) ;

        cholmod_rowcolcounts (symmetric ? FF:SS, fset, nf, Parent2,
        Post2, NULL, ColCount2, First, Level, Common) ;

        for (k = 0 ; k < n ; k++)
        {
        ASSERT (Lcolcount [k] == ColCount2 [k]) ;
        }

        cholmod_free (n, sizeof (int), ColCount2, Common) ;
        cholmod_free (n, sizeof (int), Parent2, Common) ;
        cholmod_free (n, sizeof (int), Post2, Common) ;

        cholmod_free_sparse (&C1, Common) ;
        cholmod_free_sparse (&C2, Common) ;
#endif