Up: Contents
Next: Efficient Memory Allocation
Previous: Profiling
Performing operations on chunks of data rather than a single element
at a time can significantly enhance performance.
- Insert several (many) elements of a matrix or vector at once, rather
than looping and inserting a single value at a time. In order to
access elements in of vector repeatedly, employ VecGetArray() to allow
direct manipulation of the vector elements.
- When using MatSetValues(), if the column indices of the values being
inserted have been sorted in monotonically increasing order, call
the routine MatSetOption(mat,MAT_COLUMNS_SORTED) before setting the values
to reduce the insertion time significantly.
- When possible, use VecMDot() rather than a series of calls to VecDot().
Up: Contents
Next: Efficient Memory Allocation
Previous: Profiling