The default should definitely be zero gaps. I have been burned on that before too.<br>
<br><br><div class="gmail_quote">On Sat, Jan 22, 2011 at 2:55 PM, Lou Hafer <span dir="ltr">&lt;<a href="mailto:lou@cs.sfu.ca">lou@cs.sfu.ca</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Folks,<br>
<br>
        The default constructor for CoinPackedMatrix will use .25 for extraMajor<br>
and extraGap.  If one uses the default constructor to initialise a<br>
column-ordered matrix and then later uses, for example, reverseOrderedCopyOf to<br>
make a row-ordered matrix, the row-ordered matrix will have extra space in each<br>
major vector.<br>
<br>
        Unfortunately, this will break code that uses the following loop<br>
construct (to traverse major vector i)<br>
<br>
        for (CoinBigIndex kk = majStart[i] ; kk &lt; majStart[i+1] ; kk++)<br>
<br>
More generally, any code that uses majStart[i+1]-majStart[i] to calculate the<br>
length of a major vector.<br>
<br>
        Why am I mentioning this?  Because I&#39;ve been working on CglProbing and<br>
fell over this bug last evening.  The above construct is common.  My guess is<br>
that this problem also exists in other chunks of COIN code and is an accident<br>
waiting to happen.<br>
<br>
        If you look over the constructors for CoinPackedMatrix, of the ones that<br>
do not have explicit gap parameters, only the default constructor sets nonzero<br>
values for the gaps.  I&#39;m proposing to change this so that the default<br>
constructor also sets zero gaps.<br>
<br>
        This isn&#39;t a fix for code that assumes no gaps (the only way to fix the<br>
code is to find it and rewrite it) but it will remove a trap for the unwary.<br>
<br>
        Opinions?  If I hear no objections by the 29th, I&#39;m going to make this<br>
change so that the constructor behaviour is uniform.<br>
<br>
                                                        Lou<br>
<br>
_______________________________________________<br>
CoinUtils mailing list<br>
<a href="mailto:CoinUtils@list.coin-or.org">CoinUtils@list.coin-or.org</a><br>
<a href="http://list.coin-or.org/mailman/listinfo/coinutils" target="_blank">http://list.coin-or.org/mailman/listinfo/coinutils</a><br>
</blockquote></div><br>