help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] Installing GLPKMEX, the glp_long problem


From: Giorgio Sartor
Subject: [Help-glpk] Installing GLPKMEX, the glp_long problem
Date: Tue, 23 Apr 2013 17:59:21 +0200

To whom it may concern.

The version 2.11 of GLPKMEX does not compile with GLPK 4.48 on Matlab. The reason is the struct glp_long as reported below:
glpkcc.cpp:374: error: `glp_long #39; was not declared in this scope 
glpkcc.cpp:374: error: expected `; #39; before "tpeak" 
glpkcc.cpp:375: error: `tpeak #39; was not declared in this scope
The code is:
glp_long tpeak;
glp_mem_usage(NULL, NULL, NULL, &tpeak);
*mem=(double)(4294967296.0 * tpeak.hi + tpeak.lo) / (1024);

In fact, I suppose that the declaration of glp_mem_usage is changed from the past and now is:

void glp_mem_usage(int *count, int *cpeak, size_t *total, size_t *tpeak);

A simple solution for this problem is by changing the code as:

size_t tpeak;
glp_mem_usage(NULL, NULL, NULL, &tpeak);
*mem=(double) tpeak / (1024);

I recall that *tpeak is the peak value of *total reached since the initialization of the GLPK library environment and *total is the total amount, in bytes, of currently allocated memory blocks. So, the division by 1024 has the only purpose to convert bytes in kilobytes.

I hope it can help someone.


Best,

Gioker




reply via email to

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