예제 #1
0
 def compute_gprimeterm(ngrads, vval, vcomp, wshape, wcomp):
     # Apply gradients directly to argument vval,
     # and get the right indexed scalar component(s)
     kk = indices(ngrads)
     Dvkk = apply_grads(vval)[vcomp + kk]
     # Place scalar component(s) Dvkk into the right tensor positions
     if wshape:
         Ejj, jj = unit_indexed_tensor(wshape, wcomp)
     else:
         Ejj, jj = 1, ()
     gprimeterm = as_tensor(Ejj * Dvkk, jj + kk)
     return gprimeterm
예제 #2
0
 def compute_gprimeterm(ngrads, vval, vcomp, wshape, wcomp):
     # Apply gradients directly to argument vval,
     # and get the right indexed scalar component(s)
     kk = indices(ngrads)
     Dvkk = apply_grads(vval)[vcomp+kk]
     # Place scalar component(s) Dvkk into the right tensor positions
     if wshape:
         Ejj, jj = unit_indexed_tensor(wshape, wcomp)
     else:
         Ejj, jj = 1, ()
     gprimeterm = as_tensor(Ejj*Dvkk, jj+kk)
     return gprimeterm
예제 #3
0
def test_unit_tensor(self):
    E2_1, ii = unit_indexed_tensor((2, ), (1, ))
    E3_1, ii = unit_indexed_tensor((3, ), (1, ))
    E22_10, ii = unit_indexed_tensor((2, 2), (1, 0))