예제 #1
0
 def test_GroupAdjointAction(self, disp=False):
     hM = common.RandField(self.sz,
                           nSig=5.0,
                           gSig=4.0,
                           mType=ca.MEM_HOST,
                           sp=self.imSp)
     hV = common.RandField(self.sz,
                           nSig=5.0,
                           gSig=4.0,
                           mType=ca.MEM_HOST,
                           sp=self.imSp)
     hPhi = common.RandField(self.sz,
                             nSig=5.0,
                             gSig=4.0,
                             mType=ca.MEM_HOST,
                             sp=self.imSp)
     tmp = ca.Field3D(self.grid, ca.MEM_HOST)
     # compute < m, Ad_\phi v >
     ca.Ad(tmp, hPhi, hV)
     rhs = ca.Dot(tmp, hM)
     # compute < Ad^*_\phi m,  v >
     ca.CoAd(tmp, hPhi, hM)
     lhs = ca.Dot(tmp, hV)
     #print "a=%f b=%f" % (rhs, lhs)
     self.assertLess(abs(rhs - lhs), 2e-6)
예제 #2
0
 def test_SplatAdjoint(self, disp=False):
     hI = common.RandImage(self.sz,
                           nSig=1.0,
                           gSig=0.0,
                           mType=ca.MEM_HOST,
                           sp=self.imSp)
     hJ = common.RandImage(self.sz,
                           nSig=1.0,
                           gSig=0.0,
                           mType=ca.MEM_HOST,
                           sp=self.imSp)
     hPhi = common.RandField(self.sz,
                             nSig=5.0,
                             gSig=4.0,
                             mType=ca.MEM_HOST,
                             sp=self.imSp)
     tmp = ca.Image3D(self.grid, ca.MEM_HOST)
     # compute < I(Phi(x)), J(x) >
     ca.ApplyH(tmp, hI, hPhi)
     phiIdotJ = ca.Dot(tmp, hJ)
     # compute < I(y), |DPhi^{-1}(y)| J(Phi^{-1}(y)) >
     ca.Splat(tmp, hPhi, hJ)
     IdotphiJ = ca.Dot(tmp, hI)
     #print "a=%f b=%f" % (phiIdotJ, IdotphiJ)
     self.assertLess(abs(phiIdotJ - IdotphiJ), 2e-6)
예제 #3
0
 def randHSetUp(self):
     self.hRandH = \
         common.RandField(self.sz, nSig=5.0, gSig=4.0,
                          mType = MEM_HOST, sp = self.imSp)
     VtoH_I(self.hRandH)
     self.dRandH = self.hRandH.copy()
     self.dRandH.toType(MEM_DEVICE)
예제 #4
0
 def randVPair(self):
     hV = common.RandField(self.sz,
                           nSig=5.0,
                           gSig=4.0,
                           mType=MEM_HOST,
                           sp=self.imSp)
     dV = hV.copy()
     dV.toType(MEM_DEVICE)
     return hV, dV