Fixed size matrix subtraction (original) (raw)

next up previous contents
Next: Rescaling a fixed size Up: Fixed size matrices Previous: Fixed size matrix addition Contents

Fixed size matrix subtraction

To subtract $3\times 4$ matrices use the equivalent macros and functions

  gan_mat34_sub_q ( &m34A, &m34B, &m34C ); /* macro */
  m34C = gan_mat34_sub_s ( &m34A, &m34B ); /* function call */
  gan_mat34_sub_i1 ( &m34A, &m34B ); /* result in-place in m34A */
  gan_mat34_sub_i2 ( &m34A, &m34B ); /* result in-place in m34B */
  gan_mat34_decrement ( &m34A, &m34B ); /* result in-place in m34A */

For general $3\times 3$ matrices we have the options

  Gan_Matrix33 m33A, m33B, m33C;

  /* ... set up m33A, m33B using e.g. gan_mat33_fill_q() ... */
  gan_mat33_sub_q ( &m33A, &m33B, &m33C ); /* macro, OR */
  m33C = gan_mat33_sub_s ( &m33A, &m33B ); /* function call */
  gan_mat33_sub_i1 ( &m33A, &m33B ); /* macro, result in-place in m33A */
  gan_mat33_sub_i2 ( &m33A, &m33B ); /* macro, result in-place in m33B */
  gan_mat33_decrement ( &m33A, &m33B ); /* equivalent to gan_mat33_sub_i1() */

For symmetric $3\times 3$ matrices we have

  Gan_SquMatrix33 sm33Sa, sm33Sb, sm33Sc;

  /* ... set up sm33Sa, sm33Sb using e.g. gan_symmat33_fill_q() ... */
  gan_symmat33_sub_q ( &sm33Sa, &sm33Sb, &sm33Sc ); /* macro, OR */
  sm33Sc = gan_symmat33_sub_s ( &sm33Sa, &sm33Sb ); /* function call */
  gan_symmat33_sub_i1 ( &sm33Sa, &sm33Sb ); /* macro, result in-place in sm33Sa */
  gan_symmat33_sub_i2 ( &sm33Sa, &sm33Sb ); /* macro, result in-place in sm33Sb */
  gan_symmat33_decrement ( &sm33Sa, &sm33Sb ); /* equivalent to gan_symmat33_sub_i1() */

Finally for lower triangular $3\times 3$ matrices we have

  Gan_SquMatrix33 sm33La, sm33Lb, sm33Lc;

  /* ... set up sm33La, sm33Lb using e.g. gan_ltmat33_fill_q() ... */
  gan_ltmat33_sub_q ( &sm33La, &sm33Lb, &sm33Lc ); /* macro, OR */
  sm33Lc = gan_ltmat33_sub_s ( &sm33La, &sm33Lb ); /* function call */
  gan_ltmat33_sub_i1 ( &sm33La, &sm33Lb ); /* macro, result in-place in sm33La */
  gan_ltmat33_sub_i2 ( &sm33La, &sm33Lb ); /* macro, result in-place in sm33Lb */
  gan_ltmat33_decrement ( &sm33La, &sm33Lb ); /* equivalent to gan_ltmat33_sub_i1() */

2006-03-17