[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] matrix size and allocation
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] matrix size and allocation |
Date: |
Sun, 13 Jan 2008 19:56:25 +0300 |
> I allocate my matrix with the size I need (and not with something like
> ia[1000+1], ja[1000+1], as shown in the first example of the doc).
> But, later in my algorithm, I add some more columns:
> glp_add_cols() and glp_set_mat_col()
> Should I have allocated my matrix with a larger size?
No, you should not. Once glp_load_matrix has loaded the constraint
matrix, the arrays ia, ja, and ar are no longer needed (and can be
deallocated), because the constraint matrix itself is stored in the
glp_prob program object. Note that you could load the constraint
matrix elements by rows or by columns with routines glp_set_mat_row
and glp_set_mat_col rather than use glp_load_matrix.