how to save sparse matrix

Special Question Page

Hi is saving sparse matrix same as normal matrix? I used " save xx" but the saved file is zero kb. Is there any special command for sparse matrix? Thanks.

1 Answer



0



You can save a sparse matrix inside of a GAUSS Data Archive (GDA). Here is a simple example:

//Declare 'a' to be a sparse matrix
sparse matrix a;

//Create sparse matrix with random data
a = densetosp(rndu(10, 5), 0.25);

//Save sparse matrix 'a' to file 'mysparsedata.gda'
ret = gdaSave("mysparsedata.gda", "a", 0, 1, 0);

//Declare 'a_copy' to be a sparse matrix
sparse matrix a_copy;

//Load sparse data from 'mysparsedata.gda'
a_copy = gdaReadSparse("mysparsedata.gda", "a");

if (a == a_copy);
    print "success!";
else;
    print "matrices are different";
endif;

aptech

1,193

Your Answer


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

REQUEST A FREE QUOTE

Thank you for your interest in the GAUSS family of products.

© Aptech Systems, Inc. All rights reserved.

Privacy Policy | Sitemap