help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Comments on version 3.1 API


From: Andrew Makhorin
Subject: Re: [Help-glpk] Comments on version 3.1 API
Date: Sat, 1 Jun 2002 10:23:42 +0400

Erik, thank you for your criticism.

>Firstly, there is no direct replacement for the function glp_new_aij().

This way to create a sparse matrix is extremely inefficient in most
cases. It just happened that old api data structures allow implement
this operation efficiently enough. However, in glpk 3.1 there is a
routine glp_load_mat3, using which you can attain the same effect as in
the case of glp_new_aij.

>Currently I am forced to do this:
>
>   lpx_set_mat_row (problem, row, 1, (&col) - 1, (&aij) - 1) ;

This will not work, because lpx_set_mat_row *replaces* a specified row,
i.e. all previous contents of the row is destroyed. Consider using
glp_load_mat3.

>Anyway, that brings me to my main point, the specification of the
>functions lpx_set_mat_row() and lpx_set_mat_col() which from the
>documentation seem to access arrays from index 1 through N rather than
>the normal C language 0 through N-1. 

Probably most C programmers would disagree with me, but I suppose that
it is natural way to index array elements by integers 1, ..., n. Zero
lower index simplifies implementation of C compilers, but undoubtely it
is a defect of the language. However I agree that this convention about
array indexing may confuse some users, so I will try to give more
detailed comments in the documentation.






reply via email to

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