Beispiel #1
0
void clmCastActors
(  mclx**   mxpp        /* is made stochastic and has loops added */
,  mclx**   clpp        /* entries are set to self-value */
,  mclx**   el_to_clpp  /* transpose of cl            */
,  mclx**   el_on_clpp  /* will be made stochastic    */
,  mclx**   cl_on_clpp  /* will be made stochastic    */
,  mclx**   cl_on_elpp  /* transpose of stochastic el_on_cl */
,  double   frac        /* consider clusters in el_on_cl until frac
                               edge weight is covered */
)
   {  mclxAdjustLoops(*mxpp, mclxLoopCBmax, NULL)
   ;  mclxMakeStochastic(*mxpp)
   ;  *el_to_clpp =  mclxTranspose(*clpp)

                              /* el_to_cl not stochastic? */
   ;  *el_on_clpp =  mclxCompose(*el_to_clpp, *mxpp, 0, 1)
   ;  mclxMakeStochastic(*el_on_clpp)

   ;  *cl_on_clpp =  mclxCompose(*el_on_clpp, *clpp, 0, 1)
   ;  mclxMakeStochastic(*cl_on_clpp)

   ;  set_cl_to_projection(*clpp, *el_on_clpp)
   ;  prune_el_on_cl(*el_to_clpp, *el_on_clpp, frac, 10)
   ;  *cl_on_elpp =  mclxTranspose(*el_on_clpp)
;  }
Beispiel #2
0
static int test_cycle
(  const mclx* mx
,  dim n_limit
)
   {  mclv* starts = run_through(mx), *starts2
   ;  if (starts->n_ivps)
      {  dim i
      ;  if (n_limit)
         {  mclx* mxt = mclxTranspose(mx)
         ;  starts2 = run_through(mxt)
         ;  mclxFree(&mxt)
         ;  mclvBinary(starts, starts2, starts, fltMultiply)

         ;  mcxErr
            (me, "cycles detected (%u nodes)", (unsigned) starts->n_ivps)

         ;  if (starts->n_ivps)
            {  fprintf(stdout, "%lu", (ulong) starts->ivps[0].idx)
            ;  for (i=1; i<MCX_MIN(starts->n_ivps, n_limit); i++)
               fprintf(stdout, " %lu", (ulong) starts->ivps[i].idx)
            ;  fputc('\n', stdout)
         ;  }
            else
            mcxErr(me, "strange, no nodes selected")
      ;  }
         else
         mcxErr(me, "cycles detected")
      ;  return 1
   ;  }

      mcxTell(me, "no cycles detected")
   ;  return 0
;  }
Beispiel #3
0
void test_for_cycles
(  mclx* mx
)
   {  mclx* tp = mclxTranspose(mx)
   ;  mclv* fwd = mclxColSizes(mx, MCL_VECTOR_COMPLETE)
   ;  mclv* bwd = mclxColSizes(tp, MCL_VECTOR_COMPLETE)
   ;  dim i, n_cycle = 0

   ;  for (i=0;i<bwd->n_ivps;i++)
      {  ofs level_up = fire_node(mx, i, NULL)
      ;  ofs level_dn = fire_node(tp, i, NULL)
      ;  if (level_up < 0 || level_dn < 0)
            fprintf(stderr, " [%lu cycle]", (ulong) i)
         ,  n_cycle++
   ;  }

      if (n_cycle)
      fputc('\n', stderr)
   ;  mclvFree(&bwd)
   ;  mclvFree(&fwd)
   ;  mclxFree(&tp)
   ;  fprintf
      (  stderr
      ,  "file with %lu edges has %d cycles\n"
      ,  (ulong) mclxNrofEntries(mx)
      ,  (int) n_cycle
      )
   ;  exit(n_cycle ? 1 : 0)
;  }
mclMatrix* mclInterpret
(  mclMatrix* dag
)
   {  mclv* v_attr = mclvCopy(NULL, dag->dom_cols)
   ;  mclx* m_attr = NULL, *m_cls = NULL, *m_clst = NULL
   ;  dim d

   ;  mclvMakeCharacteristic(v_attr)

   ;  for (d=0;d<N_COLS(dag);d++)
      {  mclv* col = dag->cols+d
      ;  if (mclvGetIvp(col, col->vid, NULL))   /* deemed attractor */
         mclvInsertIdx(v_attr, col->vid, 2.0)
   ;  }

      mclvSelectGqBar(v_attr, 1.5)

   ;  m_attr = mclxSub(dag, v_attr, v_attr)
   ;  mclxAddTranspose(m_attr, 1.0)

   ;  m_cls = clmUGraphComponents(m_attr, NULL) /* attractor systems as clusters */
   ;  mclvCopy(m_cls->dom_rows, dag->dom_cols)  /* add all nodes to this cluster matrix */
   ;  m_clst = mclxTranspose(m_cls)             /* nodes(columns) with zero neighbours need to be classified */
   ;  mclgUnionvReset(dag)                      /* make mx->dom-rows characteristic */
   ;  mclxFree(&m_cls)

   ;  for (d=0;d<N_COLS(dag);d++)
      {  mclv* closure, *clsids
      ;  if (mclvGetIvp(v_attr, dag->cols[d].vid, NULL))
         continue                               /* attractor already classified */

      ;  closure =   get_closure(dag, dag->cols+d)  /* take all [neighbours of [neighbours of [..]]] */
      ;  clsids  =   mclgUnionv(m_clst, closure, NULL, SCRATCH_READY, NULL)

      ;  mclvAdd(m_clst->cols+d, clsids, m_clst->cols+d)
      ;  mclvFree(&clsids)
      ;  mclvFree(&closure)
   ;  }

      m_cls = mclxTranspose(m_clst)
   ;  mclxFree(&m_attr)
   ;  mclxFree(&m_clst)
   ;  mclvFree(&v_attr)
   ;  return m_cls
;  }
Beispiel #5
0
static int calc_depth
(  mclx* m_transient
)
{   mclx* m_inverse = mclxTranspose(m_transient)
                      ;
    dim c, depth = 0

                   ;
    if(0)puts("")

        ;
    for (c=0; c<N_COLS(m_inverse); c++)
    {   dim this_depth = 0
                         ;
        if (!m_inverse->cols[c].n_ivps)    /* no incoming nodes */
        {   mclv* next = mclxGetVector(m_transient, m_inverse->cols[c].vid, RETURN_ON_FAIL, NULL)
                         ;
            if (!next)
                continue
                ;
            mclgUnionvInitList(m_transient, next)
            ;
            do
            {   mclv* next2 = mclgUnionv(m_transient, next, NULL, SCRATCH_UPDATE, NULL)
                              ;
                if (0 && next->ivps)
                    fprintf(stdout, "chain %d ->\n", (int) m_inverse->cols[c].vid)
                    ,  mclvaDump(next, stdout, -1, " ", 0)
                    ;
                if (this_depth)   /* otherwise starting vector in matrix */
                    mclvFree(&next)
                    ;
                next = next2
                       ;
                this_depth++
                ;
            }
            while (next->n_ivps)
                ;
            mclvFree(&next)      /* did loop at least once, so not the starting vector */
            ;
            mclgUnionvReset(m_transient)
            ;
        }
        if (this_depth > depth)
            depth = this_depth
                    ;
    }

    mclxFree(&m_inverse)
    ;
    return depth
           ;
}
Beispiel #6
0
void dump_dag
(  mclx* mx
,  mclTab* tab
)
   {  mclx* mx = mclxTranspose(mx)
   ;  dim i
   ;  for (i=0;i<N_COLS(mx);i++)
      {  mclv* v = mx->cols+i
      ;  if (v->val < 1.5)
         {  dump_label(tab, v->vid, 0)
         ;  walk_dag(mx, v, 1)
      ;  }
      }
   }
Beispiel #7
0
void mclgTFgraph
(  mclx* mx
,  pnum  mode
,  pval  val
)
   {  switch(mode)
      {        case MCLG_TF_MAX:       mclxMergeTranspose(mx, fltMax, 1.0)
   ;  break ;  case MCLG_TF_MIN:       mclxMergeTranspose(mx, fltMin, 1.0)
   ;  break ;  case MCLG_TF_ADD:       mclxMergeTranspose(mx, fltAdd, 1.0)
   ;  break ;  case MCLG_TF_SELFRM:    mclxAdjustLoops(mx, mclxLoopCBremove, NULL)
   ;  break ;  case MCLG_TF_SELFMAX:   mclxAdjustLoops(mx, mclxLoopCBmax, NULL)
   ;  break ;  case MCLG_TF_NORMSELF:  mclxNormSelf(mx)
   ;  break ;  case MCLG_TF_MUL:       mclxMergeTranspose(mx, fltMultiply, 1.0)
   ;  break ;  case MCLG_TF_ARCMAX:    mclxMergeTranspose(mx, fltArcMax, 1.0)

   ;  break ;  case MCLG_TF_ARCMAXGQ:  mclxMergeTranspose3(mx, fltArcMaxGQ, 1.0, val)
   ;  break ;  case MCLG_TF_ARCMAXGT:  mclxMergeTranspose3(mx, fltArcMaxGT, 1.0, val)
   ;  break ;  case MCLG_TF_ARCMAXLQ:  mclxMergeTranspose3(mx, fltArcMaxLQ, 1.0, val)
   ;  break ;  case MCLG_TF_ARCMAXLT:  mclxMergeTranspose3(mx, fltArcMaxLT, 1.0, val)

   ;  break ;  case MCLG_TF_ARCMINGQ:  mclxMergeTranspose3(mx, fltArcMinGQ, 1.0, val)
   ;  break ;  case MCLG_TF_ARCMINGT:  mclxMergeTranspose3(mx, fltArcMinGT, 1.0, val)
   ;  break ;  case MCLG_TF_ARCMINLQ:  mclxMergeTranspose3(mx, fltArcMinLQ, 1.0, val)
   ;  break ;  case MCLG_TF_ARCMINLT:  mclxMergeTranspose3(mx, fltArcMinLT, 1.0, val)

   ;  break ;  case MCLG_TF_ARCDIFFGQ: mclxMergeTranspose3(mx, fltArcDiffGQ, 1.0, val)
   ;  break ;  case MCLG_TF_ARCDIFFGT: mclxMergeTranspose3(mx, fltArcDiffGT, 1.0, val)
   ;  break ;  case MCLG_TF_ARCDIFFLQ: mclxMergeTranspose3(mx, fltArcDiffLQ, 1.0, val)
   ;  break ;  case MCLG_TF_ARCDIFFLT: mclxMergeTranspose3(mx, fltArcDiffLT, 1.0, val)

   ;  break ;  case MCLG_TF_ARCSUB:    mclxMergeTranspose(mx, fltSubtract, 1.0)
   ;  break ;  case MCLG_TF_TUG:       mclxPerturb(mx, val, MCLX_PERTURB_SYMMETRIC)
   ;  break ;  case MCLG_TF_TRANSPOSE: { mclx* tp = mclxTranspose(mx); mclxTransplant(mx, &tp); }
   ;  break ;  case MCLG_TF_SHRUG:     mclxPerturb(mx, val, MCLX_PERTURB_SYMMETRIC | MCLX_PERTURB_RAND)
   ;  break ;  case MCLG_TF_ILS:       mclxILS(mx)
   ;  break ;  case MCLG_TF_TOPN:      mclxKNNdispatch(mx, val+0.5, mclx_n_thread_g, 0)
   ;  break ;  case MCLG_TF_KNN:       mclxKNNdispatch(mx, val+0.5, mclx_n_thread_g, 1)
   ;  break ;  case MCLG_TF_MCL:       tf_do_mcl(mx, val, FALSE)
   ;  break ;  case MCLG_TF_ARC_MCL:   tf_do_mcl(mx, val, TRUE)
   ;  break ;  case MCLG_TF_THREAD:    mclx_n_thread_g = val + 0.5
   ;  break ;  case MCLG_TF_CEILNB:    { mclv* cv = mclgCeilNB(mx, val+0.5, NULL, NULL, NULL); mclvFree(&cv); }
   ;  break ;  case MCLG_TF_STEP:      mclg_tf_step(mx, val+0.5)
   ;  break ;  case MCLG_TF_QT:        mclxQuantiles(mx, val)
   ;  break ;  case MCLG_TF_SSQ:       tf_ssq(mx, val)
   ;  break ;  case MCLG_TF_SHUFFLE:   mcxErr("mclgTFgraph", "shuffle not yet done (lift from mcxrand)")
   ;  break ;  default:                mcxErr("mclgTFgraph", "unknown mode")
   ;  break
   ;  }
   }
Beispiel #8
0
static mclx* get_coarse
(  const mclx* mxbase
,  mclx* clprev
,  mcxbool add_transpose
)
   {  mclx* blockc   =  mclxBlocksC(mxbase, clprev)
   ;  mclx* clprevtp =  mclxTranspose(clprev)
   ;  mclx *p1       =  NULL     /* p_roduct */
   ;  mclx* mx_coarse=  NULL

   ;  mclxMakeStochastic(clprev)

/****************** <EXPERIMENTAL CRAP>  ************************************/
   ;  if (hdp_g)
      mclxUnary(clprev, fltxPower, &hdp_g)
                        /* parameter: use mxbase rather than blockc */
   ;  if (getenv("MCLCM_BLOCK_STOCHASTIC")) /* this works very badly! */
      mclxMakeStochastic(blockc)

   ;  else if (getenv("MCLCM_BASE_UNSCALE") && start_col_sums_g)
      {  dim i
      ;  for (i=0;i<N_COLS(blockc);i++)
         {  double f = start_col_sums_g->ivps[i].val
         ;  mclvUnary(blockc->cols+i, fltxMul, &f)
      ;  }
   ;  }
/****************** </EXPERIMENTAL> *****************************************/

      p1 = mclxCompose(blockc, clprev, 0)
;if (0)
{mcxIO* t = mcxIOnew("-", "w")
;mclxWrite(blockc, t, MCLXIO_VALUE_GETENV, EXIT_ON_FAIL)
;
}
   ;  mclxFree(&blockc)
   ;  mx_coarse = mclxCompose(clprevtp, p1, 0) 
   ;  if (add_transpose)
      mclxAddTranspose(mx_coarse, 0.0)
   ;  mclxAdjustLoops(mx_coarse, mclxLoopCBremove, NULL)

   ;  mclxFree(&p1)
   ;  mclxFree(&clprevtp)

   ;  mclxMakeCharacteristic(clprev)
   ;  return mx_coarse
;  }
Beispiel #9
0
void write_clustering
(  mclx* cl
,  const mclx* clprev
,  mcxIO* xfcone
,  mcxIO* xfstack
,  const char* plexprefix
,  int multiplex_idx
,  const mclAlgParam* mlp
)
   {  
                        /* this branch is also taken for dispatch mode */
      if (plexprefix)
      {  mcxTing* clname = mcxTingPrint(NULL, "%s.%03d", plexprefix, multiplex_idx)
      ;  mcxIO* xfout = mcxIOnew(clname->str, "w")

      ;  if (dispatch_g && mlp && !mcxIOopen(xfout, RETURN_ON_FAIL))
         fprintf(xfout->fp, "# %s\n", mlp->cline->str)  

      ;  mclxaWrite(cl, xfout, MCLXIO_VALUE_NONE, RETURN_ON_FAIL)
      ;  mcxTingFree(&clname)
      ;  mcxIOfree(&xfout)
   ;  }
      
      if (subcluster_g || dispatch_g)
      return

   ;  if (xfstack)
      mclxaWrite(cl, xfstack, MCLXIO_VALUE_NONE, RETURN_ON_FAIL)

   ;  if (xfcone && !clprev)
      mclxaWrite(cl, xfcone, MCLXIO_VALUE_NONE, RETURN_ON_FAIL)
   ;  else if (xfcone)
      {  mclx* clprevt = mclxTranspose(clprev)
      ;  mclx* contracted = mclxCompose(clprevt, cl, 0)
      ;  mclxMakeCharacteristic(contracted)
      ;  mclxaWrite(contracted, xfcone, MCLXIO_VALUE_NONE, RETURN_ON_FAIL)
      ;  mclxFree(&clprevt)
      ;  mclxFree(&contracted)
   ;  }
   }
Beispiel #10
0
int main
(  int                  argc
,  const char*          argv[]
)
   {  mcxIO      *xfin        =  mcxIOnew("-", "r")
   ;  mcxIO      *xfout       =  mcxIOnew("-", "w")
   ;  mclMatrix  *mx          =  NULL
   ;  mclx* cmapx = NULL, *rmapx = NULL
   ;  const char* me          =  "mcxmap"
   ;  long        cshift      =  0
   ;  long        rshift      =  0
   ;  long        cmul        =  1
   ;  long        rmul        =  1
   ;  mcxIO*     xf_cannc     =  NULL
   ;  mcxIO*     xf_cannr     =  NULL
   ;  mcxstatus   status      =  STATUS_OK
   ;  mcxbool     invert      =  FALSE
   ;  mcxbool     invertr     =  FALSE
   ;  mcxbool     invertc     =  FALSE
   ;  mcxIO* xf_map_c = NULL, *xf_map_r = NULL, *xf_map = NULL, *xf_tab = NULL

   ;  mcxOption* opts, *opt
   ;  mcxstatus parseStatus = STATUS_OK

   ;  mcxLogLevel =
      MCX_LOG_AGGR | MCX_LOG_MODULE | MCX_LOG_IO | MCX_LOG_GAUGE | MCX_LOG_WARN
   ;  mclxIOsetQMode("MCLXIOVERBOSITY", MCL_APP_VB_NO)
   ;  mclx_app_init(stderr)
   
   ;  mcxOptAnchorSortById(options, sizeof(options)/sizeof(mcxOptAnchor) -1)
   ;  opts = mcxOptParse(options, (char**) argv, argc, 1, 0, &parseStatus)

   ;  if (!opts)
      exit(0)

   ;  for (opt=opts;opt->anch;opt++)
      {  mcxOptAnchor* anch = opt->anch

      ;  switch(anch->id)
         {  case MY_OPT_HELP
         :  case MY_OPT_APROPOS
         :  mcxOptApropos(stdout, me, syntax, 0, 0, options)
         ;  return 0
         ;

            case MY_OPT_VERSION
         :  app_report_version(me)
         ;  return 0
         ;

            case MY_OPT_IMX
         :  mcxIOnewName(xfin, opt->val)
         ;  break
         ;

            case MY_OPT_OUT
         :  mcxIOnewName(xfout, opt->val)
         ;  break
         ;

            case MY_OPT_MUL
         :  cmul =  atol(opt->val)
         ;  rmul =  cmul
         ;  break
         ;

            case MY_OPT_CMUL
         :  cmul =  atol(opt->val)
         ;  break
         ;

            case MY_OPT_RMUL
         :  rmul =  atol(opt->val)
         ;  break
         ;

            case MY_OPT_SHIFT
         :  cshift =  atol(opt->val)
         ;  rshift =  atol(opt->val)
         ;  break
         ;

            case MY_OPT_CSHIFT
         :  cshift =  atol(opt->val)
         ;  break
         ;

            case MY_OPT_RSHIFT
         :  rshift =  atol(opt->val)
         ;  break
         ;

            case MY_OPT_MAP
         :  xf_map =  mcxIOnew(opt->val, "r")
         ;  invert =  FALSE
         ;  break
         ;

            case MY_OPT_CMAP
         :  invertc  =  FALSE  
         ;  xf_map_c =  mcxIOnew(opt->val, "r")
         ;  break
         ;

            case MY_OPT_RMAP
         :  invertr  =  FALSE  
         ;  xf_map_r =  mcxIOnew(opt->val, "r")
         ;  break
         ;

            case MY_OPT_MAPI
         :  invert =  TRUE  
         ;  xf_map =  mcxIOnew(opt->val, "r")
         ;  break
         ;

            case MY_OPT_CMAPI
         :  invertc  =  TRUE  
         ;  xf_map_c =  mcxIOnew(opt->val, "r")
         ;  break
         ;

            case MY_OPT_RMAPI
         :  invertr  =  TRUE  
         ;  xf_map_r =  mcxIOnew(opt->val, "r")
         ;  break
         ;

            case MY_OPT_MAKE_MAP
         :  xf_cannc = mcxIOnew(opt->val, "w")
         ;  xf_cannr = xf_cannc
         ;  break
         ;

            case MY_OPT_MAKE_MAPC
         :  xf_cannc = mcxIOnew(opt->val, "w")
         ;  break
         ;

            case MY_OPT_MAKE_MAPR
         :  xf_cannr = mcxIOnew(opt->val, "w")
         ;  break
         ;

            case MY_OPT_TAB
         :  xf_tab = mcxIOnew(opt->val, "r")
         ;  break
         ;
         }
      }

                     /* little special case. restructure when it grows */
      if (xf_tab)
      {  mclTab* tab1, *tab2
      ;  if (xf_map)
         {  mcxIOopen(xf_map, EXIT_ON_FAIL)
         ;  cmapx = mclxRead(xf_map, EXIT_ON_FAIL)  
      ;  }
         else
         mcxDie(1, me, "-tab option requires -map option")

      ;  tab1 = mclTabRead(xf_tab, NULL, EXIT_ON_FAIL)
      ;  if ((tab2 = mclTabMap(tab1, cmapx)))
         mclTabWrite(tab2, xfout, NULL, EXIT_ON_FAIL)
       ; else
         mcxDie(1, me, "map file error (subsumption/bijection)")

      ;  return 0
   ;  }

      mx = mclxRead(xfin, EXIT_ON_FAIL)

   ;  if (xf_map)
      {  mcxIOopen(xf_map, EXIT_ON_FAIL)
      ;  cmapx = mclxRead(xf_map, EXIT_ON_FAIL)  
      ;  rmapx = cmapx
   ;  }
      else
      {  if (xf_map_c)
         {  mcxIOopen(xf_map_c, EXIT_ON_FAIL)
         ;  cmapx = mclxRead(xf_map_c, EXIT_ON_FAIL)  
      ;  }
         else if (cshift || cmul > 1)
         cmapx
         =  mclxMakeMap
            (  mclvCopy(NULL, mx->dom_cols)
            ,  mclvMap(NULL, cmul, cshift, mx->dom_cols)
            )
      ;  else if (xf_cannc)      /* fixme slightly flaky interface */
         {  cmapx 
            =  mclxMakeMap
               (  mclvCopy(NULL, mx->dom_cols)
               ,  mclvCanonical(NULL, mx->dom_cols->n_ivps, 1.0)
               )
         ;  mclxWrite(cmapx, xf_cannc, MCLXIO_VALUE_GETENV, RETURN_ON_FAIL)
      ;  }

         if (xf_map_r)
         {  mcxIOopen(xf_map_r, EXIT_ON_FAIL)
         ;  rmapx = mclxRead(xf_map_r, EXIT_ON_FAIL)  
      ;  }
         else if (rshift || rmul > 1)
         rmapx
         =  mclxMakeMap
            (  mclvCopy(NULL, mx->dom_rows)
            ,  mclvMap(NULL, rmul, rshift, mx->dom_rows)
            )
      ;  else if (xf_cannr)
         {  rmapx 
            =  mclxMakeMap
               (  mclvCopy(NULL, mx->dom_rows)
               ,  mclvCanonical(NULL, mx->dom_rows->n_ivps, 1.0)
               )
         ;  if (xf_cannr != xf_cannc)
            mclxWrite(rmapx, xf_cannr, MCLXIO_VALUE_GETENV, RETURN_ON_FAIL)
         ;  else if (!mclxIsGraph(mx))
            mcxErr(me, "row map not written but matrix is not a graph")
      ;  }
      }

      if (invert && cmapx && cmapx == rmapx)
      {  mclx* cmapxi = mclxTranspose(cmapx)
      ;  mclxFree(&cmapx)
      ;  cmapx = rmapx = cmapxi
   ;  }
      else
      {  if ((invert || invertr) && rmapx)
         {  mclx* rmapxi = mclxTranspose(rmapx)
         ;  mclxFree(&rmapx)
         ;  rmapx = rmapxi
      ;  }
         if ((invert || invertc) && cmapx)
         {  mclx* cmapxi = mclxTranspose(cmapx)
         ;  mclxFree(&cmapx)
         ;  cmapx = cmapxi
      ;  }
      }

   ;  status = STATUS_FAIL

   ;  do
      {  if (cmapx && mclxMapCols(mx, cmapx))
         break
      ;  if (rmapx && mclxMapRows(mx, rmapx))
         break
      ;  status = STATUS_OK
   ;  }
      while (0)

   ;  if (status)
      {  mcxErr(me, "error, nothing written")
      ;  return 1
   ;  }

      mclxWrite(mx, xfout, MCLXIO_VALUE_GETENV, EXIT_ON_FAIL)
   ;  return 0
;  }
Beispiel #11
0
static mcxstatus mateMain
(  int         argc_unused    cpl__unused
,  const char* argv[]
)
   {  mcxIO* xfx, *xfy
   ;  mclx* mx, *my, *meet, *teem, *myt
   ;  dim x, y

   ;  mcxIOopen(xfout, EXIT_ON_FAIL)

   ;  xfx =  mcxIOnew(argv[0], "r")
   ;  mx  =  mclxRead(xfx, EXIT_ON_FAIL)
   ;  mcxIOclose(xfx)
   ;  xfy =  mcxIOnew(argv[1], "r")
   ;  my  =  mclxRead(xfy, EXIT_ON_FAIL)
   ;  myt =  mclxTranspose(my)

   ;  if (!MCLD_EQUAL(mx->dom_rows, my->dom_rows))
      mcxDie(1, me, "domains are not equal")

   ;  meet=  mclxCompose(myt, mx, 0, 0)      /* fixme thread interface */
   ;  teem=  mclxTranspose(meet)

   ;  if (legend)
      fprintf
      (  xfout->fp
      ,  "%-10s %6s %6s %6s %6s %6s %6s %6s\n"
      ,  "overlap"
      ,  "x-idx"
      ,  "y-idx"
      ,  "meet"
      ,  "xdiff"
      ,  "ydiff"
      ,  "x-size"
      ,  "y-size"
      )

   ;  for (x=0;x<N_COLS(meet);x++)
      {  mclv* xvec = meet->cols+x
      ;  long X = xvec->vid
      ;  long xsize = mx->cols[x].n_ivps

      ;  if (one2many && xvec->n_ivps < 2)
         continue

      ;  for (y=0;y<N_COLS(teem);y++)
         {  mclv* yvec = teem->cols+y
         ;  long Y = yvec->vid
         ;  long ysize = my->cols[y].n_ivps
         ;  double twinfac
         ;  long meetsize
         ;  mclp* ivp = mclvGetIvp(yvec, X, NULL)
         ;  if (!ivp)
            continue

         /*
          * meet size, left diff, right diff, right size.
         */

         ;  meetsize = ivp->val

         ;  if (!xsize && !ysize)         /* paranoia */
            continue

         ;  twinfac = 2 * meetsize / ( (double) (xsize + ysize) )

         ;  if (xfout)
            fprintf
            (  xfout->fp
            ,  "%-10.3f %6ld %6ld %6ld %6ld %6ld %6ld %6ld\n"
            ,  twinfac
            ,  X
            ,  Y
            ,  meetsize
            ,  xsize - meetsize
            ,  ysize - meetsize
            ,  xsize
            ,  ysize
            )
      ;  }
      }
      return STATUS_OK
;  }
Beispiel #12
0
int main
(  int                  argc
   ,  const char*          argv[]
)
{   mcxIO *xf_cl = NULL, *xf_mx = NULL
                                  ;
    mclx *cl = NULL, *elcl = NULL
                             ;
    int a = 1
            ;
    dim i

    ;
    mcxLogLevel =
        MCX_LOG_AGGR | MCX_LOG_MODULE | MCX_LOG_IO | MCX_LOG_GAUGE | MCX_LOG_WARN
        ;
    mclxIOsetQMode("MCLXIOVERBOSITY", MCL_APP_VB_YES)
    ;
    mclx_app_init(stderr)

    ;
    while(a < argc)
    {   if (!strcmp(argv[a], "-icl"))
        {   if (a++ + 1 < argc)
                xf_cl =  mcxIOnew(argv[a], "r")
                         ;
            else goto arg_missing
                ;
        }
        else if (!strcmp(argv[a], "-h"))
        {   help
:
            mcxUsage(stdout, me, usagelines)
            ;
            mcxExit(STATUS_FAIL)
            ;
        }
        else if (!strcmp(argv[a], "--version"))
        {   app_report_version(me)
            ;
            exit(0)
            ;
        }
        else if (!strcmp(argv[a], "-imx"))
        {   if (a++ + 1 < argc)
                xf_mx = mcxIOnew(argv[a], "r")
                        ;
            else goto arg_missing
                ;
        }
        else if (!strcmp(argv[a], "-h"))
        {   goto help
            ;
        }
        else if (0)
        {   arg_missing:
            ;
            mcxErr
            (  me
               ,  "flag <%s> needs argument; see help (-h)"
               ,  argv[argc-1]
            )
            ;
            mcxExit(1)
            ;
        }
        else
        {   mcxErr
            (  me
               ,  "unrecognized flag <%s>; see help (-h)"
               ,  argv[a]
            )
            ;
            mcxExit(1)
            ;
        }
        a++
        ;
    }

    if (!xf_cl)
        mcxErr(me, "need cluster file")
        ,  mcxExit(1)

        ;
    cl =  mclxRead(xf_cl, EXIT_ON_FAIL)
          ;
    elcl = mclxTranspose(cl)

           ;
    for (i=0; i<N_COLS(elcl); i++)
    {   mclv* vec = elcl->cols+i
                    ;
        if (vec->n_ivps > 1)
            fprintf(stdout, "%ld\n", (long) vec->vid)
            ;
    }

    return 0
           ;
}
Beispiel #13
0
int main
(  int                  argc
,  const char*          argv[]
)
   {  mcxIO* xf_tab     =  NULL
   ;  mcxIO* xf_tabr    =  NULL
   ;  mcxIO* xf_tabc    =  NULL
   ;  mcxIO* xf_restrict_tab     =  NULL
   ;  mcxIO* xf_restrict_tabr    =  NULL
   ;  mcxIO* xf_restrict_tabc    =  NULL
   ;  mcxIO* xf_mx      =  mcxIOnew("-", "r")
   ;  mcxIO* xfout    =  NULL
   ;  const char*  fndump  =  "-"
   ;  mclTab* tabr      =  NULL
   ;  mclTab* tabc      =  NULL
   ;  mclTab* restrict_tabr =  NULL
   ;  mclTab* restrict_tabc =  NULL
   ;  mcxbool transpose =  FALSE
   ;  mcxbool lazy_tab  =  FALSE
   ;  mcxbool write_tabc =  FALSE
   ;  mcxbool write_tabr =  FALSE
   ;  mcxbool cat       =  FALSE
   ;  mcxbool tree      =  FALSE
   ;  mcxbool skel      =  FALSE
   ;  mcxbool newick    =  FALSE
   ;  mcxbits newick_bits = 0
   ;  mcxbits cat_bits  =  0
   ;  dim catmax        =  1
   ;  dim n_max         =  0
   ;  dim table_nlines  =  0
   ;  dim table_nfields =  0
   ;  int split_idx     =  1
   ;  int split_inc     =  1
   ;  const char* split_stem =  NULL
   ;  const char* sort_mode = NULL
   ;  mcxTing* line     =  mcxTingEmpty(NULL, 10)

   ;  mcxbits modes     =  MCLX_DUMP_VALUES

   ;  mcxbits mode_dump =  MCLX_DUMP_PAIRS
   ;  mcxbits mode_part =  0
   ;  mcxbits mode_loop =  MCLX_DUMP_LOOP_ASIS
   ;  mcxbits mode_matrix = 0
   ;  int digits        =  MCLXIO_VALUE_GETENV

   ;  mcxOption* opts, *opt
   ;  mcxstatus parseStatus = STATUS_OK

   ;  mcxLogLevel =
      MCX_LOG_AGGR | MCX_LOG_MODULE | MCX_LOG_IO | MCX_LOG_GAUGE | MCX_LOG_WARN
   ;  mclxIOsetQMode("MCLXIOVERBOSITY", MCL_APP_VB_YES)
   ;  mclx_app_init(stderr)
   
   ;  mcxOptAnchorSortById(options, sizeof(options)/sizeof(mcxOptAnchor) -1)
   ;  opts = mcxOptParse(options, (char**) argv, argc, 1, 0, &parseStatus)

   ;  if (!opts)
      exit(0)

   ;  for (opt=opts;opt->anch;opt++)
      {  mcxOptAnchor* anch = opt->anch

      ;  switch(anch->id)
         {  case MY_OPT_HELP
         :  case MY_OPT_APROPOS
         :  mcxOptApropos(stdout, me, syntax, 0, 0, options)
         ;  return 0
         ;

            case MY_OPT_VERSION
         :  app_report_version(me)
         ;  return 0
         ;

            case MY_OPT_TAB
         :  xf_tab = mcxIOnew(opt->val, "r")
         ;  break
         ;

            case MY_OPT_TABC
         :  xf_tabc = mcxIOnew(opt->val, "r")
         ;  break
         ;

            case MY_OPT_TABR
         :  xf_tabr = mcxIOnew(opt->val, "r")
         ;  break
         ;

            case MY_OPT_OUTPUT
         :  fndump = opt->val
         ;  break
         ;

            case MY_OPT_SEP_LEAD
         :  sep_lead_g = opt->val
         ;  break
         ;

            case MY_OPT_SEP_FIELD
         :  sep_row_g = opt->val
         ;  break
         ;

            case MY_OPT_SEP_CAT
         :  sep_cat_g = opt->val
         ;  break
         ;

            case MY_OPT_SEP_VAL
         :  sep_val_g = opt->val
         ;  break
         ;

            case MY_OPT_PREFIXC
         :  prefixc_g = opt->val
         ;  break
         ;

            case MY_OPT_RESTRICT_TAB
         :  xf_restrict_tab = mcxIOnew(opt->val, "r")
         ;  break
         ;

            case MY_OPT_RESTRICT_TABC
         :  xf_restrict_tabc = mcxIOnew(opt->val, "r")
         ;  break
         ;

            case MY_OPT_RESTRICT_TABR
         :  xf_restrict_tabr = mcxIOnew(opt->val, "r")
         ;  break
         ;

            case MY_OPT_LAZY_TAB
         :  lazy_tab = TRUE
         ;  break
         ;

            case MY_OPT_NO_VALUES
         :  BIT_OFF(modes, MCLX_DUMP_VALUES)
         ;  break
         ;

            case MY_OPT_DUMP_RLINES
         :  mode_dump = MCLX_DUMP_LINES
         ;  BIT_ON(modes, MCLX_DUMP_NOLEAD)
         ;  break
         ;

            case MY_OPT_DUMP_VLINES
         :  mode_dump = MCLX_DUMP_LINES
         ;  BIT_ON(modes, MCLX_DUMP_LEAD_VALUE)
         ;  break
         ;

            case MY_OPT_DUMP_LINES
         :  mode_dump = MCLX_DUMP_LINES
         ;  break
         ;

            case MY_OPT_OMIT_EMPTY
         :  BIT_ON(modes, MCLX_DUMP_OMIT_EMPTY)
         ;  break
         ;

            case MY_OPT_SORT
         :  sort_mode = opt->val
         ;  break
         ;

            case MY_OPT_NO_LOOPS
         :  mode_loop = MCLX_DUMP_LOOP_NONE
         ;  break
         ;

            case MY_OPT_CAT_LIMIT
         :  n_max = atoi(opt->val)
         ;  break
         ;

            case MY_OPT_SPLIT_STEM
         :  split_stem = opt->val
         ;  sep_cat_g = NULL
         ;  break
         ;

            case MY_OPT_FORCE_LOOPS
         :  mode_loop = MCLX_DUMP_LOOP_FORCE
         ;  break
         ;

            case MY_OPT_SKEL
         :  skel = TRUE
         ;  break
         ;

            case MY_OPT_WRITE_TABC
         :  write_tabc = TRUE
         ;  break
         ;

            case MY_OPT_DIGITS
         :  digits = strtol(opt->val, NULL, 10)
         ;  break
         ;

            case MY_OPT_WRITE_TABR
         :  write_tabr = TRUE
         ;  break
         ;

            case MY_OPT_DUMP_RDOM
         :  transpose = TRUE
         ;  skel = TRUE
         ;  mode_dump = MCLX_DUMP_LINES
         ;  break
         ;

            case MY_OPT_DUMP_CDOM
         :  skel = TRUE
         ;  mode_dump = MCLX_DUMP_LINES
         ;  break
         ;

            case MY_OPT_IMX
         :  mcxIOnewName(xf_mx, opt->val)
         ;  break
         ;

            case MY_OPT_ICL
         :  mcxIOnewName(xf_mx, opt->val)
         ;  mode_dump = MCLX_DUMP_LINES
         ;  BIT_ON(modes, MCLX_DUMP_NOLEAD)
         ;  BIT_OFF(modes, MCLX_DUMP_VALUES)
         ;  break
         ;

            case MY_OPT_TREECAT
         :  mcxIOnewName(xf_mx, opt->val)
         ;  tree = TRUE
         ;  cat_bits |= MCLX_PRODUCE_DOMSTACK
         ;  break
         ;

            case MY_OPT_CAT
         :  mcxIOnewName(xf_mx, opt->val)
         ;  cat = TRUE
         ;  break
         ;

            case MY_OPT_DUMP_MATRIX
         :  mode_matrix |= MCLX_DUMP_MATRIX
         ;  break
         ;

            case MY_OPT_TRANSPOSE
         :  transpose = TRUE
         ;  break
         ;

            case MY_OPT_DUMP_UPPER
         :  mode_part = MCLX_DUMP_PART_UPPER
         ;  break
         ;

            case MY_OPT_DUMP_UPPERI
         :  mode_part = MCLX_DUMP_PART_UPPERI
         ;  break
         ;

            case MY_OPT_DUMP_LOWER
         :  mode_part = MCLX_DUMP_PART_LOWER
         ;  break
         ;

            case MY_OPT_DUMP_LOWERI
         :  mode_part = MCLX_DUMP_PART_LOWERI
         ;  break
         ;

            case MY_OPT_DUMP_NOLEAD
         :  BIT_ON(modes, MCLX_DUMP_NOLEAD)
         ;  break
         ;

            case MY_OPT_NEWICK_MODE
         :  if (strchr(opt->val, 'N'))
            newick_bits |= (MCLX_NEWICK_NONL | MCLX_NEWICK_NOINDENT)
         ;  if (strchr(opt->val, 'I'))
            newick_bits |= MCLX_NEWICK_NOINDENT
         ;  if (strchr(opt->val, 'B'))
            newick_bits |= MCLX_NEWICK_NONUM
         ;  if (strchr(opt->val, 'S'))
            newick_bits |= MCLX_NEWICK_NOPTHS
         ;  newick = TRUE
         ;  break
         ;

            case MY_OPT_DUMP_NEWICK
         :  newick = TRUE
         ;  break
         ;

            case MY_OPT_DUMP_TABLE
         :  mode_dump = MCLX_DUMP_TABLE
         ;  break
         ;

            case MY_OPT_TABLE_NFIELDS
         :  table_nfields = atoi(opt->val)
         ;  break
         ;

            case MY_OPT_TABLE_NLINES
         :  table_nlines = atoi(opt->val)
         ;  break
         ;

            case MY_OPT_DUMP_PAIRS
         :  mode_dump = MCLX_DUMP_PAIRS
         ;  break
      ;  }
      }

   ;  if (skel)
      cat_bits |= MCLX_READ_SKELETON

   ;  modes |= mode_loop | mode_dump | mode_part | mode_matrix

   ;  xfout = mcxIOnew(fndump, "w")
   ;  mcxIOopen(xfout, EXIT_ON_FAIL)

   ;  mcxIOopen(xf_mx, EXIT_ON_FAIL)

   ;  if (cat || tree)
      catmax = n_max ? n_max : 0

   ;  if ((write_tabc || write_tabr) && !xf_tab)
      mcxDie(1, me, "need a single tab file (-tab option) with --write-tabc or --write-tabr")

   ;  if (xf_tab && mcxIOopen(xf_tab, RETURN_ON_FAIL))
      mcxDie(1, me, "no tab")
   ;  else
      {  if (xf_tabr && mcxIOopen(xf_tabr, RETURN_ON_FAIL))
         mcxDie(1, me, "no tabr")
      ;  if (xf_tabc && mcxIOopen(xf_tabc, RETURN_ON_FAIL))
         mcxDie(1, me, "no tabc")
   ;  }

      {  if (xf_restrict_tab && mcxIOopen(xf_restrict_tab, RETURN_ON_FAIL))
         mcxDie(1, me, "no restriction tab")
      ;  else
         {  if (xf_restrict_tabr && mcxIOopen(xf_restrict_tabr, RETURN_ON_FAIL))
            mcxDie(1, me, "no restriction tabr")
         ;  if (xf_restrict_tabc && mcxIOopen(xf_restrict_tabc, RETURN_ON_FAIL))
            mcxDie(1, me, "no restriction tabc")
      ;  }
                              /* fixme: below is pretty boilerplate, happens in other places as well */
         if (xf_restrict_tab)
         {  if (!(restrict_tabr = mclTabRead (xf_restrict_tab, NULL, RETURN_ON_FAIL)))
            mcxDie(1, me, "error reading restriction tab")
         ;  restrict_tabc = restrict_tabr
         ;  mcxIOclose(xf_restrict_tab)
      ;  }
         else
         {  if (xf_restrict_tabr)
            {  if (!(restrict_tabr = mclTabRead(xf_restrict_tabr, NULL, RETURN_ON_FAIL)))
               mcxDie(1, me, "error reading restriction tabr")
            ;  mcxIOclose(xf_restrict_tabr)
         ;  }
            if (xf_restrict_tabc)
            {  if (!(restrict_tabc = mclTabRead(xf_restrict_tabc, NULL, RETURN_ON_FAIL)))
               mcxDie(1, me, "error reading restriction tabc")
            ;  mcxIOclose(xf_restrict_tabc)
         ;  }
         }
      }

                        /* fixme: restructure code to include bit below */

      if (write_tabc || write_tabr)
      {  mclv* dom_cols = mclvInit(NULL)
      ;  mclv* dom_rows = mclvInit(NULL)
      ;  mclv* dom = write_tabc ? dom_cols : dom_rows

      ;  if (!(tabc =  mclTabRead(xf_tab, NULL, RETURN_ON_FAIL)))
         mcxDie(1, me, "error reading tab file")

      ;  if (mclxReadDomains(xf_mx, dom_cols, dom_rows))
         mcxDie(1, me, "error reading matrix file")
      ;  mcxIOclose(xf_mx)

                                       /* fixme check status */
      ;  mclTabWrite(tabc, xfout, dom, RETURN_ON_FAIL) 

      ;  mcxIOclose(xfout)
      ;  return 0
   ;  }

      if (newick)
      {  mcxTing* thetree
      ;  mclxCat  cat

      ;  if (xf_tab && !(tabr =  mclTabRead(xf_tab, NULL, RETURN_ON_FAIL)))
         mcxDie(1, me, "error reading tab file")

      ;  mclxCatInit(&cat)

      ;  if
         (  mclxCatRead
            (  xf_mx
            ,  &cat
            ,  0
            ,  NULL
            ,  tabr ? tabr->domain : NULL
            ,  MCLX_CATREAD_CLUSTERTREE | MCLX_ENSURE_ROOT
            )
         )
         mcxDie(1, me, "failure reading file")
      ;  thetree = mclxCatNewick(&cat, tabr, newick_bits)
      ;  fwrite(thetree->str, 1, thetree->len, xfout->fp)
      ;  fputc('\n', xfout->fp)
      ;  mcxIOclose(xfout)
      ;  return 0
   ;  }

      while (1)
      {  mclxIOdumper dumper
      ;  mclxCat    cat
      ;  dim i

      ;  if (xf_tab && !lazy_tab)
         cat_bits |= MCLX_REQUIRE_GRAPH

      ;  mclxCatInit(&cat)

      ;  if (mclxCatRead(xf_mx, &cat, catmax, NULL, NULL, cat_bits))
         break

      ;  for (i=0;i<cat.n_level;i++)
         {  mclx* mx = cat.level[i].mx

         ;  if (restrict_tabr || restrict_tabc)
            {  mclx* sub
            ;  sub
               =  mclxSub
                  (  mx
                  ,  restrict_tabc
                     ?  restrict_tabc->domain
                     :  mx->dom_cols
                  ,  restrict_tabr
                     ?  restrict_tabr->domain
                     :  mx->dom_rows
                  )
            ;  mx = sub
         ;  }
            /* noteme fixme dangersign mx now may violate some 'cat' invariant */

            if (sort_mode)
            {  if (!strcmp(sort_mode, "size-ascending"))
               mclxColumnsRealign(mx, mclvSizeCmp)
            ;  else if (!strcmp(sort_mode, "size-descending"))
               mclxColumnsRealign(mx, mclvSizeRevCmp)
            ;  else
               mcxErr(me, "unknown sort mode <%s>", sort_mode)
            ;  if (catmax != 1)
               mcxErr(me, "-sort option and cat mode may fail or corrupt")
         ;  }

            if (xf_tab && !tabr)
            {  if (!(  tabr = mclTabRead
                       (xf_tab, lazy_tab ? NULL : mx->dom_rows, RETURN_ON_FAIL)
                  ) )
               mcxDie(1, me, "consider using --lazy-tab option")
            ;  tabc = tabr
            ;  mcxIOclose(xf_tab)
         ;  }
            else
            {  if (!tabr && xf_tabr)
               {  if (!(tabr =  mclTabRead
                        (xf_tabr, lazy_tab ? NULL : mx->dom_rows, RETURN_ON_FAIL)
                     ) )
                  mcxDie(1, me, "consider using --lazy-tab option")
               ;  mcxIOclose(xf_tabr)
            ;  }
               if (!tabc && xf_tabc)
               {  if (!( tabc = mclTabRead
                        (xf_tabc, lazy_tab ? NULL : mx->dom_cols, RETURN_ON_FAIL)
                     ) )
                  mcxDie(1, me, "consider using --lazy-tab option")
               ;  mcxIOclose(xf_tabc)
            ;  }
            }

         ;  if (transpose)
            {  mclx* tp = mclxTranspose(mx)
            ;  mclxFree(&mx)
            ;  mx = tp
            ;  if (tabc || tabr)
               {  mclTab* tabt = tabc
               ;  tabc = tabr
               ;  tabr = tabt
            ;  }
            }

            if (mode_dump == MCLX_DUMP_TABLE)
            BIT_ON(modes, MCLX_DUMP_TABLE_HEADER)

         ;  mclxIOdumpSet(&dumper, modes, sep_lead_g, sep_row_g, sep_val_g)
         ;  dumper.table_nlines  = table_nlines
         ;  dumper.table_nfields = table_nfields
         ;  dumper.prefixc = prefixc_g

         ;  if (split_stem)
            {  mcxTing* ting = mcxTingPrint(NULL, "%s.%03d", split_stem, split_idx)
            ;  mcxIOclose(xfout)
            ;  mcxIOrenew(xfout, ting->str, "w")
            ;  split_idx += split_inc
         ;  }

            if
            (  mclxIOdump
               (  mx
               ,  xfout
               ,  &dumper
               ,  tabc
               ,  tabr
               ,  digits
               ,  RETURN_ON_FAIL
             ) )
            mcxDie(1, me, "something suboptimal")

         ;  mclxFree(&mx)

         ;  if (sep_cat_g && i+1 < cat.n_level)
            fprintf(xfout->fp, "%s\n", sep_cat_g)
      ;  }
         break
   ;  }

      mcxIOfree(&xf_mx)
   ;  mcxIOfree(&xfout)
   ;  mcxIOfree(&xf_tab)
   ;  mcxIOfree(&xf_tabr)
   ;  mcxIOfree(&xf_tabc)
   ;  mcxTingFree(&line)
   ;  return 0
;  }
Beispiel #14
0
void get_attr
(  mclx* mx
,  mclTab* tab
,  mcxIO* xfattr
)
   {  mclx* tp = mclxTranspose(mx)
   ;  mclx* G  = mclxAdd(mx, tp)
   ;  mclv* fwd = mclxColSizes(mx, MCL_VECTOR_COMPLETE)
   ;  mclv* bwd = mclxColSizes(tp, MCL_VECTOR_COMPLETE)
   ;  mclx* cc = clmComponents(G, NULL)
   ;  mclx* node2cc = mclxTranspose(cc)
   ;  dim i, n_cycle = 0

   ;  fprintf(xfattr->fp, "node\tup\tdown\tnparent\tnchild\tndag\n")

   ;  for (i=0;i<bwd->n_ivps;i++)
      {  mclv* seenpp1 = NULL, *seenpp2 = NULL

      ;  ofs level_up = fire_node(mx, i, &seenpp1)
      ;  ofs level_dn = fire_node(tp, i, &seenpp2)
      ;  ofs ccidx = node2cc->cols[i].ivps[0].idx
      ;  dim ccsize = cc->cols[ccidx].n_ivps

      ;  mclvFree(&seenpp1)
      ;  mclvFree(&seenpp2)

      ;  if ((i+1) % 500 == 0)
         fputc('.', stderr)
      ;  if (tab)
         {  const char* label = mclTabGet(tab, mx->cols[i].vid, NULL)
         ;  fputs(label, xfattr->fp)
         ;  fputc('\t', xfattr->fp)
      ;  }
         else
         fprintf
         (  xfattr->fp
         ,  "%lu\t"
         ,  (ulong) mx->cols[i].vid
         )

      ;  fprintf
         (  xfattr->fp
         ,  "%ld\t%ld\t%lu\t%lu\t%lu\n"
         ,  (long) level_up
         ,  (long) level_dn
         ,  (ulong) fwd->ivps[i].val
         ,  (ulong) bwd->ivps[i].val
         ,  (ulong) ccsize
         )

      ;  if (level_up < 0 || level_dn < 0)
            fputc('.', stderr)
         ,  n_cycle++
   ;  }

      if (n_cycle)
      fputc('\n', stderr)
   ;  mclvFree(&bwd)
   ;  mclvFree(&fwd)
   ;  mclxFree(&tp)
;  }