help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Why 3 arrays in glp_load_matrix()


From: Dušan Plavák
Subject: [Help-glpk] Why 3 arrays in glp_load_matrix()
Date: Fri, 23 Jan 2015 05:32:24 +0100

Hi there,
Why we have to use 3 arrays to define table?

from documentation:

ia[1] = 1, ja[1] = 1, ar[1] = 1.0; /* a[1,1] = 1 */
ia[2] = 1, ja[2] = 2, ar[2] = 1.0; /* a[1,2] = 1 */
ia[3] = 1, ja[3] = 3, ar[3] = 1.0; /* a[1,3] = 1 */
ia[4] = 2, ja[4] = 1, ar[4] = 10.0; /* a[2,1] = 10 */
ia[5] = 3, ja[5] = 1, ar[5] = 2.0; /* a[3,1] = 2 */
ia[6] = 2, ja[6] = 2, ar[6] = 4.0; /* a[2,2] = 4 */
ia[7] = 3, ja[7] = 2, ar[7] = 2.0; /* a[3,2] = 2 */
ia[8] = 2, ja[8] = 3, ar[8] = 5.0; /* a[2,3] = 5 */
ia[9] = 3, ja[9] = 3, ar[9] = 6.0; /* a[3,3] = 6 */

what about:
a[1][1] = 1
a[1][2] = 1
a[1]3] = 1

a[2][1] = 10
a[2][2] = 4
a[2][3] = 5

a[3][1] = 2
a[3][2] = 2
a[3][3] = 6

???

It is 27 vs 9 assignments;

Thanks

--
S pozdravom Dušan Plavák

reply via email to

[Prev in Thread] Current Thread [Next in Thread]