Question: Sparse matrices to eigen solve

Hi,

I’ve [K] & [M] matrices in sparse format for FE code. How do I convert them to be able to do eigensolution?

restart;

with(LinearAlgebra);

stiffness_data := ImportMatrix("d:/Simulation_1_STIF1.csv");

stiffness_matrix := Matrix(max(stiffness_data[() .. (), 1]), max(stiffness_data[() .. (), 2]), sparse = [seq([stiffness_data[i, 1], stiffness_data[i, 2], stiffness_data[i, 3]], i = 1 .. nops(stiffness_data))]);

Error, (in Matrix) argument `sparse = [[1, 1, 328.0000000], [1, 5, -20434.40000], [5, 1, -20434.40000]]` is incorrect or out of order

Even if I try with a simple matrix example it gave an error.

with(LinearAlgebra);

A := Matrix(5, 5, sparse = [[1, 1, 328.0], [1, 5, -20434.4], [5, 1, -20434.4]]);

Error, (in Matrix) argument `sparse = [[1, 1, 328.0], [1, 5, -20434.4], [5, 1, -20434.4]]` is incorrect or out of order

Please help.

Thanks,

Shashi

Please Wait...