Multilinear Algebra for Visual Geometry
Total Page:16
File Type:pdf, Size:1020Kb
multilinear algebra for visual geometry Alberto Ruiz http://dis.um.es/~alberto DIS, University of Murcia MVIGRO workshop Berlin, june 28th 2013 contents 1. linear spaces 2. tensor diagrams 3. Grassmann algebra 4. multiview geometry 5. tensor equations intro diagrams multiview equations linear algebra the most important computational tool: linear = solvable nonlinear problems: linearization + iteration multilinear problems are easy (' linear) visual geometry is multilinear (' solved) intro diagrams multiview equations linear spaces I objects are represented by arrays of coordinates (depending on chosen basis, with proper rules of transformation) I linear transformations are extremely simple (just multiply and add), and invertible in closed form (in least squares sense) I duality: linear transformations are also a linear space intro diagrams multiview equations linear spaces objects are linear combinations of other elements: i vector x has coordinates x in basis B = feig X i x = x ei i Einstein's convention: i x = x ei intro diagrams multiview equations change of basis 1 1 0 0 c1 c2 3 1 0 i [e1; e2] = [e1; e2]C; C = 2 2 = ej = cj ei c1 c2 1 2 x1 x1 x01 x = x1e + x2e = [e ; e ] = [e ; e ]C C−1 = [e0 ; e0 ] 1 2 1 2 x2 1 2 x2 1 2 x02 | 0{z 0 } [e1;e2] | {z } 2x013 4x025 intro diagrams multiview equations covariance and contravariance if the basis transforms according to C: 0 0 [e1; e2] = [e1; e2]C vector coordinates transform according to C−1: x01 x1 = C−1 x02 x2 in the previous example: 7 3 1 2 2 0;4 −0;2 7 = ; = 4 1 2 1 1 −0;2 0;6 4 intro diagrams multiview equations covariance and contravariance I things that transform like the basis are covariant (subindex, `row', `function-like') I things that transform `inversely' are contravariant (superindex, `column', `vector-like') vector coordinates are contravariant intro diagrams multiview equations scalar linear functions n the coordinates of linear functions R ! R (`covectors') are covariant: T 1 n k f(x) = a x = a1x + : : : anx = akx 0 a Tx0 = aTC C−1x |{z} | {z } a0T x0 0 r ak = ckar intro diagrams multiview equations linear transformations j in bases feig and fgig the transformation A has coordinates fai g j j i y = ai x in bases fe0 = Ceg and fg0 = Dgg: A0 = D−1AC 0t j i t t r r as = csajqi ; qi dt = δi the `input' is covariant and the `output' is contravariant intro diagrams multiview equations bilinear functions bilinear functions have two covariant (function-like) inputs. C(u; v) = uTCv conics (quadratic forms) are similar to bilinear functions: C(x) = xTCx = 0 line (dual) conics have two contravariant (vector-like) inputs, and so on. intro diagrams multiview equations multilinear functions several vector and covector arguments, linear in all of them I application and composition: contraction I partial application: produces a multilinear function of the remaining arguments I duality: no fixed input/output role a transformation of vectors transforms covectors in the opposite direction intro diagrams multiview equations matrix notation too many things are described by raw 2D arrays: I data sets (e.g. a collection of vectors) I linear transformations I bilinear functions, quadratic forms I homographies, Fundamental Matrix, etc.. matrix notation and manipulation tricks are not suitable for multilinear algebra alternative to algebraic indexed expressions: tensor diagrams intro diagrams multiview equations scalar, invariant same value s in all bases square edges intro diagrams multiview equations vector k coordinates x depend on chosen basis fekg k x = x ek contravariant slot: convex, `pointed' edge intro diagrams multiview equations linear function T 1 n k f(x) = a x = a1x + ::: + anx = akx 0 a Tx0 = aTCC−1x covariant slot: `concave' edge intro diagrams multiview equations function application T fa(x) = a x produces an invariant: index contraction = connecting complementary slots intro diagrams multiview equations transformation i j i y = FA(x) = Ax = ajx = y covariant and contravariant slots: intro diagrams multiview equations transformation works both ways intro diagrams multiview equations dual transformations intro diagrams multiview equations composition intro diagrams multiview equations identity intro diagrams multiview equations bilinear function e.g. an inner product given two vectors produces an invariant: a linear function is the inner product with some vector: intro diagrams multiview equations quadratic forms exercises: I conics I dual conics I tangent to a conic / polar lines intro diagrams multiview equations self-contraction? intro diagrams multiview equations tensor product creates a multilinear function from the product of the results of several multilinear functions: multiply function coordinates before the arguments are applied intro diagrams multiview equations trace any transformation can be decomposed as (sum of) there is an invariant: intro diagrams multiview equations contraction multilinear function application and/or composition tensor product followed by sum of `diagonal slice' of repeated indexes. implemented by `matrization' and normal matrix product intro diagrams multiview equations homogeneous coordinates projective geometry: geometric objects represented by subspaces n in P points and hyperplanes are dual points are contravariant, hyperplanes are covariant 2 in P points and lines are easy, e.g. incidence line-point: lT x = 0 3 in P points and planes are easy, lines are awkward we want a uniform representation of points, lines, planes, incidence, etc. for spaces of any dimension intro diagrams multiview equations symmetric tensors a multilinear function with undistinguished slots F (:::; x;:::; y;:::) = F (:::; y;:::; x;:::) commutative function symmetric coordinates intro diagrams multiview equations antisymmetric tensors F (:::; x;:::; y;:::) = −F (:::; y;:::; x;:::) F (:::; x;:::; x;:::) = 0 responds only to the linear independent component of the input F (:::; x + y;:::; x + z;:::) = F (:::; y;:::; z;:::) intro diagrams multiview equations full antisymmetric tensor Levi-Civita symbol 3 e.g. in R : when fully applied computes the `determinant' hypervolume of parallelepiped defined by the inputs undistinguished inputs (except sign) extremely useful: universal linear solver intro diagrams multiview equations exterior product antisymmetrized tensor product obtains an antisymmetric tensor represents the subspace spanned by the inputs ‘flat’, `blade', `r-vector', `multivector', `extensor' intro diagrams multiview equations exterior product representation of the subspace, independent of the `generators' (up to scale) intro diagrams multiview equations exterior product An r-vector can be represented as a dense multilinear array, or as coordinates in suitable basis: ei ^ ej = eij ei ^ ei = 0 eij = −eji Grassmann Algebra cf. geometric algebra, Pl¨ucker coordinates, etc. intro diagrams multiview equations example a 3D line T a = [1; 2; 0; 0] = e1 + 2e2 T b = [0; 3; 0; 4] = 3e2 + 4e3 a ^ b = 3e12 + 4e14 + 8e24 2 0 3 0 43 6−3 0 0 87 a ^ b = 6 7 4 0 0 0 05 −4 −8 0 0 intro diagrams multiview equations the whole space represented by the full contravariant antisymmetric tensor: intro diagrams multiview equations transformation of r-vectors intro diagrams multiview equations metric tensor vectors depicted as arrows in space are actually not very meaninful without an inner product, giving distances and angles. intro diagrams multiview equations metric tensor dual coordinates (raise/lower indexes): intro diagrams multiview equations inner product of r-vectors induced by the standard inner product for vectors: what does it mean? intro diagrams multiview equations inner product of r-vectors obtains the orthogonal complement of the projection x a a ^ b (a ^ b) · x b intro diagrams multiview equations Hodge dual there is an isomorphism between r-vectors and (n − r)-vectors e.g. dual of a line in 3D space: inner product with whole space gives `complementary' subspace (x ^ y is automatically computed by contraction with ) intro diagrams multiview equations cross product 3 in R : intro diagrams multiview equations [x]× k [x]× = ijkx = aij = 2 3 a 2 0 a b3 b 4 5 4−a 0 c5 c −b −c 0 intro diagrams multiview equations dualization universal tool for geometric constructions: I ijk::: transforms `span of points' into `generic intersection of hyperplanes' ijk::: I intersects (dual) hyperplanes to get `span of points' intro diagrams multiview equations normal vs dual representation P2 p ∗p l= p1 ^ p2 *l 3 × 3 3 × 3 3 3 point line P3 π= p1 ^ p2 ^ p3 4 × 4 × 4 ∗p p 4 × 4 × 4 l= p1 ^ p2 ∗l ∗π 4 × 4 4 × 4 4 4 point line plane intro diagrams multiview equations join (^) and meet (_) join meet l l p π _ l p π _ l l l is analogous to a NOR logic gate intro diagrams multiview equations cross product trick in P2 p1 p ∗l p 2 1 ∗l2 ∗l p1 ∗l1 ∗l2 ∗l p p 2 intro diagrams multiview equations incidence geometric objects Q = a ^ b ^ c ^ ::: and Q = x ^ y ^ ::: P is in Q: I Q ^ P = 0 I ∗Q · P = PQ = 0 example: incidence line (a ^ b) - point (x) 3 P2 P P4 = 0 ijk 03 03×3 intro diagrams multiview equations rule 1 dual of dual = identity (up to scale) intro diagrams multiview equations rule 2 transformation of whole space = whole space intro diagrams multiview equations inversion intro diagrams multiview equations preimage point reprojection line reprojection intro diagrams multiview equations nullspace the preimage of nothing intro diagrams multiview equations rank deficient nullspace intro diagrams multiview equations rank deficient generalization of rule 2 intro diagrams multiview equations