def checkmat(m, name):
    """If run on one processor it will save m. If run on multiple processors it will load the one-proc m and compare it to the argument and complain if they don't match. """
    import pyCombBLAS as pcb

    if pcb._nprocs() == 1:
        m.save("checkfile_%s" % (name))
    else:
        one = pcb.pySpParMat()
        one.load("checkfile_%s" % (name))
        test = pcb.EWiseApply(m, one, pcb.equal_to())
        if test.Count(pcb.bind2nd(pcb.equal_to(), 1)) != test.getnee():
            if pcb.root():
                print "%s failed." % (name)
def checkvect(v, name):
    """If run on one processor it will save v. If run on multiple processors it will load the one-proc v and compare it to the argument and complain if they don't match. """
    import pyCombBLAS as pcb

    if pcb._nprocs() == 1:
        saveVect(v, "checkfile_%s" % (name))
    else:
        one = loadDenseVect("checkfile_%s" % (name), len(v))
        if len(one) != len(v):
            print "%s failed. length_1 = %d, lengh_p = %d" % (name, len(one), len(v))
            return
        one.EWiseApply(v, pcb.equal_to())
        if one.Count(pcb.bind2nd(pcb.equal_to(), 1)) != v.getnee():
            if pcb.root():
                print "%s failed." % (name)