6. Error Checking.

The VecMat software provides basic error checking for its classes and functions. Rather than throwing exceptions, I have used the simpler and more straightforward method of simply aborting with a run-time error when something undefined happens. Most of the error checking incurs no significant performance hit, and is enabled all of the time. Bounds-checking when indexing vectors and matrices can be a very inefficient process, though, so this is by default enabled only for debug builds. No error checking is done for iterators, with the exception that the rbegin(), rend(), cbegin(), and cend() matrix member functions will generate an error if you attempt to create an iterator to a row or column that does not exist.

There are three types of errors that the VecMat software can produce.

6.1. Memory allocation error.

This occurs when the software attempts to allocate memory for a block of data, and fails.

6.2. Size mismatch error.

This occurs when a function or operator requires that two objects have the same size (or in the case of the MatMult() functions, when a relationship between dimensions must exist), and this requirement is not met. An error will also be returned if functions are called for empty objects that don't make any sense for such objects, such as sum(), min(), and max().

6.3. Index out of bounds error.

This occurs when you attempt to create a view of an object that would end up viewing outside of the boundaries of the original object. If bounds-checking is enabled, then it will also occur if you attempt to index a vector or matrix out of bounds.

Next Section

Back to Index