Example #1
0
File: BP.py Project: birm/Elemental
        # The dense last column
        #A.QueueUpdate( s, width-1, -10/height );

    A.ProcessLocalQueues()
    return A


A = ConcatFD2D(n0, n1)
b = El.DistMultiVec()
#El.Gaussian( b, n0*n1, 1 )
El.Ones(b, n0 * n1, 1)
if display:
    El.Display(A, "A")
    El.Display(b, "b")

ctrl = El.BPCtrl_d(isSparse=True)
ctrl.useSOCP = False
ctrl.lpIPMCtrl.mehrotraCtrl.system = El.NORMAL_KKT
#ctrl.lpIPMCtrl.mehrotraCtrl.system = El.AUGMENTED_KKT
ctrl.lpIPMCtrl.mehrotraCtrl.progress = True
ctrl.lpIPMCtrl.mehrotraCtrl.qsdCtrl.progress = True
ctrl.socpIPMCtrl.mehrotraCtrl.time = True
ctrl.socpIPMCtrl.mehrotraCtrl.progress = True
ctrl.socpIPMCtrl.mehrotraCtrl.outerEquil = False
ctrl.socpIPMCtrl.mehrotraCtrl.innerEquil = True
ctrl.socpIPMCtrl.mehrotraCtrl.qsdCtrl.progress = True
startBP = El.mpi.Time()
x = El.BP(A, b, ctrl)
endBP = El.mpi.Time()
if worldRank == 0:
    print "BP time:", endBP - startBP, "seconds"
Example #2
0

def Rectang(height, width):
    A = El.DistMatrix()
    El.Uniform(A, height, width)
    return A


A = Rectang(m, n)
b = El.DistMatrix()
El.Gaussian(b, m, 1)
if display:
    El.Display(A, "A")
    El.Display(b, "b")

ctrl = El.BPCtrl_d(isSparse=False)
ctrl.ipmCtrl.mehrotraCtrl.progress = True
startBP = El.mpi.Time()
x = El.BP(A, b, ctrl)
endBP = El.mpi.Time()
if worldRank == 0:
    print "BP time:", endBP - startBP, "seconds"
if display:
    El.Display(x, "x")

xOneNorm = El.EntrywiseNorm(x, 1)
e = El.DistMatrix()
El.Copy(b, e)
El.Gemv(El.NORMAL, -1., A, x, 1., e)
if display:
    El.Display(e, "e")