next up previous contents
Next: Fixed size matrix/vector multiplication Up: Fixed size matrices Previous: Transposing a fixed size   Contents

Fixed size vector outer products

The outer product operation on two fixed size vectors ${\bf x}$ and ${\bf y}$ is the matrix

\begin{displaymath}A = {\bf x}{\bf y}^{\top}

In Gandalf, any pair of vectors can be combined in this way3.1. The operation on a 3-vector and a 4-vector produces a $3\times 4$ matrix, using either of the routines
      Gan_Vector3 v3x;
      Gan_Vector4 v4y;
      Gan_Matrix34 m34A;

      /* ... set up v3x and v4y using e.g. gan_vec[34]_fill_q() ... */
      gan_vec34_outer_q ( &v3x, &v4y, &m34A ); /* macro, or */
      m34A = gan_vec34_outer_s ( &v3x, &v4y ); /* function call */
Similar routines gan_vec33_outer_[qs]() enable the computation of the outer product of two 3-vectors, resulting in a $3\times 3$ matrix. If ${\bf x}={\bf y}$, the result of the outer product is a symmetric matrix

\begin{displaymath}S = {\bf x}{\bf x}^{\top}

Gandalf has special routines for this case:
      Gan_Vector3 v3x;
      Gan_SquMatrix33 sm33S;

      /* ... set up v3x using e.g. gan_vec3_fill_q() ... */
      gan_vec33_outer_sym_q ( &v3x, &sm33S ); /* macro, or */
      sm33S = gan_vec33_outer_sym_s ( &v3x ); /* function call */