def dyad(d, *iota): "TODO: Develop this concept, can e.g. write A[i,j]*dyad(j,i) for the transpose." from ufl.constantvalue import Identity from ufl.operators import outer # a bit of circular dependency issue here I = Identity(d) i = iota[0] e = as_vector(I[i, :], i) for i in iota[1:]: e = outer(e, as_vector(I[i, :], i)) return e
def dyad(d, *iota): "TODO: Develop this concept, can e.g. write A[i,j]*dyad(j,i) for the transpose." from ufl.constantvalue import Identity from ufl.operators import outer # a bit of circular dependency issue here Id = Identity(d) i = iota[0] e = as_vector(Id[i, :], i) for i in iota[1:]: e = outer(e, as_vector(Id[i, :], i)) return e
def unit_indexed_tensor(shape, component): from ufl.constantvalue import Identity from ufl.operators import outer # a bit of circular dependency issue here r = len(shape) if r == 0: return 0, () jj = indices(r) es = [] for i in range(r): s = shape[i] c = component[i] j = jj[i] e = Identity(s)[c, j] es.append(e) E = es[0] for e in es[1:]: E = outer(E, e) return E, jj
def outer(self, o, a, b): a, ap = a b, bp = b return (o, outer(ap, b) + outer(a, bp)) # FIXME: Not valid for derivatives w.r.t. nonscalar variables!
def outer(self, o, a, b): a, ap = a b, bp = b return ( o, outer(ap, b) + outer(a, bp) ) # FIXME: Not valid for derivatives w.r.t. nonscalar variables!