next up previous contents
Next: Coordinate pair ordering Up: Conventions and style Previous: Variable argument list functions   Contents

Dynamic self-modification

Another important design feature of Gandalf is the ability of many Gandalf objects to dynamically modify themselves. Thus Gandalf matrices, vectors and images can be redefined at any time to a new type and/or size. This feature has many benefits, among which are:
  1. Results of computations may be overwritten in-place on the input arguments, in many cases without any memory or computational overhead. For instance, the Cholesky factorisation of a positive-definite symmetric matrix is a lower triangular matrix factor. In Gandalf the operation can be performed in-place on the symmetric matrix input argument, producing a lower triangular matrix. See the function gan_squmat_cholesky_i().

  2. The same structure can be used to store the results of several computations, whether or not the sizes and types of the output results vary. This saves many calls to malloc() and free().



2006-03-17