MatrixLib provides several methods for resolving error conditions in your code. These consist of special debug versions of the library and a class member variable designed to hold an error code.

Three versions of MatrixLib are included in your purchase:

Obviously, when you are ready to deploy your application you will want to link it against the production library which will have better performance and not produce strange messages for your users! However, during the development process it is recommended that you use one of the debugging versions.

MatrixLib performs certain basic checks before most of its operations. These tests include verification that matrices selected for multiplication have appropriately matching inner dimensions, that an index selected for an operation is valid, that a function call will not result in division by zero, that strings to be parsed into matrices have valid formats, and other similar "sanity" checks. Practice has shown such errors to account for the majority of problems in matrix usage. When such an error occurs, or any other error handled by MatrixLib, several actions result. The library versions to which each action is application are listed first.

  1. (ALL) The error field is set to one of ml_matrix::ml_error_codes.
  2. (Warn, Abort) A message is printed to standard output listing the function in which the error occurred.</ li>
  3. (Abort) Execution halts. If running inside a debugging environment, a backtrace can be used to examine th e function call tree to determine exactly which user calls caused the error.

Maximum benefit is obtained from using the "abort" library in conjunction with a debugger such as "gdb" or th e debugger included with your IDE of choice, but it is possible that cases will arise in which that is not fe asible and only the warning library can be used for debugging. Furthermore, some applications may make it pos sible for error conditions to occur in production environments. If that is a possible issue, the error field in the matrix can be checked following operations to determine if the call resulted in an error condition.