next | previous | forward | backward | up | index | toc

# contract(Matrix,Matrix) -- contract a matrix by a matrix

## Synopsis

• Function: contract
• Usage:
h = contract(m,n)
• Inputs:
• m, , a map m : F <--- P between free modules of ranks f and p.
• n, , a map n : G <--- Q between free modules of ranks g and q.
• Outputs:
• h, , the contraction of n by m, a matrix with the shape h : dual F ** G <--- dual P ** Q, whose entry in the slot hg*i+j,q*k+l is the result of contracting nj,l, by mi,k

## Description

The arguments can also be ring elements or vectors.
 i1 : R = ZZ[x,y,z] o1 = R o1 : PolynomialRing i2 : f = vars R ** vars R o2 = | x2 xy xz xy y2 yz xz yz z2 | 1 9 o2 : Matrix R <-- R i3 : contract(transpose vars R, f) o3 = {1} | x y z y 0 0 z 0 0 | {1} | 0 x 0 x y z 0 z 0 | {1} | 0 0 x 0 0 y x y z | 3 9 o3 : Matrix R <-- R i4 : contract(x, f) o4 = | x y z y 0 0 z 0 0 | 1 9 o4 : Matrix R <-- R i5 : contract(y, f) o5 = | 0 x 0 x y z 0 z 0 | 1 9 o5 : Matrix R <-- R i6 : contract(z, f) o6 = | 0 0 x 0 0 y x y z | 1 9 o6 : Matrix R <-- R

This function is identical to diff(Matrix,Matrix), except that the multiplication by integers that occurs during differentiation is omitted.

## Ways to use this method:

• contract(Matrix,Matrix) -- contract a matrix by a matrix
• contract(Matrix,Number)
• contract(Matrix,RingElement)
• contract(Matrix,Vector)
• contract(Number,Matrix)
• contract(Number,Number)
• contract(Number,RingElement)
• contract(Number,Vector)
• contract(RingElement,Matrix)
• contract(RingElement,Number)
• contract(RingElement,RingElement)
• contract(RingElement,Vector)
• contract(Vector,Matrix)
• contract(Vector,Number)
• contract(Vector,RingElement)
• contract(Vector,Vector)