[CoinUtils] CoinPackedMatrix and default extraGap (propose change to zero)

Matthew Galati matthew.galati at gmail.com
Sat Jan 22 15:14:05 EST 2011


The default should definitely be zero gaps. I have been burned on that
before too.


On Sat, Jan 22, 2011 at 2:55 PM, Lou Hafer <lou at cs.sfu.ca> wrote:

> Folks,
>
>        The default constructor for CoinPackedMatrix will use .25 for
> extraMajor
> and extraGap.  If one uses the default constructor to initialise a
> column-ordered matrix and then later uses, for example,
> reverseOrderedCopyOf to
> make a row-ordered matrix, the row-ordered matrix will have extra space in
> each
> major vector.
>
>        Unfortunately, this will break code that uses the following loop
> construct (to traverse major vector i)
>
>        for (CoinBigIndex kk = majStart[i] ; kk < majStart[i+1] ; kk++)
>
> More generally, any code that uses majStart[i+1]-majStart[i] to calculate
> the
> length of a major vector.
>
>        Why am I mentioning this?  Because I've been working on CglProbing
> and
> fell over this bug last evening.  The above construct is common.  My guess
> is
> that this problem also exists in other chunks of COIN code and is an
> accident
> waiting to happen.
>
>        If you look over the constructors for CoinPackedMatrix, of the ones
> that
> do not have explicit gap parameters, only the default constructor sets
> nonzero
> values for the gaps.  I'm proposing to change this so that the default
> constructor also sets zero gaps.
>
>        This isn't a fix for code that assumes no gaps (the only way to fix
> the
> code is to find it and rewrite it) but it will remove a trap for the
> unwary.
>
>        Opinions?  If I hear no objections by the 29th, I'm going to make
> this
> change so that the constructor behaviour is uniform.
>
>                                                        Lou
>
> _______________________________________________
> CoinUtils mailing list
> CoinUtils at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coinutils
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/coinutils/attachments/20110122/948dd342/attachment.html 


More information about the CoinUtils mailing list