next up previous contents
Next: Single precision fixed size Up: Fixed size matrices Previous: Fixed size matrix file   Contents

Conversion from general to fixed size matrix

Functions are provided to convert a general matrix Gan_Matrix Gan_Matrix34, provided that the general matrix has actually been created with size three. So for instance
      Gan_Matrix *pmMatrix;

      pmMatrix = gan_mat_alloc(3,4);
      gan_mat_fill_va ( pmMatrix, 3, 4, 1.0,  2.0,  3.0,  4.0,
                                        5.0,  6.0,  7.0,  8.0,
                                        9.0, 10.0, 11.0, 12.0 );
      gan_mat34_from_mat_q ( pmMatrix, &m34A );
      m34A = gan_mat34_from_mat_s ( pmMatrix );
fill m34A with the same values as the general matrix. Calling these functions with a general matrix pmMatrix not having the same size as the fixed size matrix is an error.

Error detection: The conversion routines return the pointer to the filled fixed size matrix, or NULL on failure, invoking the Gandalf error handle in the latter case.