|The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....|
|Home MathPack Matrix Classes TIntMatrix, TMatrix and TMat3D Methods CreateSparse|
|See also: Create, ArrayToSparse, TSpMatElemInt|
The call to the constructor CreateSparse instantiates an object of the class TIntMatrix as a sparse matrix and allocates the necessary heap memory. If there is not enough memory space on the heap, an exception is generated ('not enough memory on heap').
Sparse matrices have the advantage that they are much more memory efficient for matrices which mainly consist of zeroes. In addition, sparse matrices need not to be dimensioned prior to using them. On the other hand, the major drawback of a sparse matrix is the (much) slower access to its elements.
The parameter AllocBy specifies the number of elements for which memory is allocated in advance. AllocBy should be set approx. 10 % higher than the expected number of non-zero elements in order to ensure maximum performance. The minimum amount of memory required by a sparse matrix is given by 12*AllocBy for TIntMatrix.