TSparseMtx.RandomSparse Method

void RandomSparse(TVec X, TVec Y, Boolean Symmetric, Double FillInPercent, Int32 MaxNonZeroCount)

Creates quadratic non-complex non-singular sparse matrix.

#NameTypeDescription
1XTVecsource TVec
2YTVecsource TVec
3SymmetricBoolean
4FillInPercentDoublescalar
5MaxNonZeroCountInt32

Result: stored in self (calling object)

Remarks:

Creates general/symmetric quadratic non-complex non-singular sparse matrix. It returns the right hand side in vector Y and the solution in vector X. If Symmetric is true the method will generate a matrix with symmetric pattern. The FillInPercent parameter defines the percentage of non-zero in the sparse matrix. The MaxNonZeroCount parameter defines an upper limit to prevent against excessive memory usage (consequence of invalid user parameters) and consecutive system lock up.

Note:
You have to set Dew.Math.TSparseMtx.Cols property to definethe size of the matrix before calling this routine.

Examples
using Dew.Math;
using Dew.Math.Units;
using Dew.Math.Tee;

namespace Dew.Examples
{
    private void Example(MtxGridSeries GridSeries)
    {
        //  ...
        SparseA.Size(7500,4000,4000,false);
        SparseA.RandomSparse(v1,v2);
        SparseA.PixelDownSample(A);
        MtxVecTee.DrawValues(A,GridSeries); // showing A
    }
}