On Wed, Apr 23, 2014 at 11:31 PM, Kannappan Sampath <kntri...@gmail.com>wrote:

>
>
>
> On Wed, Apr 23, 2014 at 11:19 PM, Vincent Delecroix <
> 20100.delecr...@gmail.com> wrote:
>
>> Me again...
>>
>> If you correct the code, please provide a piece of code that does not
>> work with the current implementation (otherwise, it can not be
>> considered as a bug).
>>
>> Well, OK. My fault. Pass any non-square 0, 1 matrix to it and you would
> see: for example,
>
> IncidenceStructureFromMatrix(Matrix(ZZ, 2, 3, [1]*2*3))
>
>
Sorry, actually:  IncidenceStructureFromMatrix(Matrix(ZZ, 3, 2, [1]*2*3))

>  If you do correct it please change
>> {{{
>>     v = len(M.rows())
>>     b = len(M.columns())
>> }}}
>> by
>> {{{
>>    v = M.nrows()
>>    b = M.ncols()
>> }}}
>>
>>
> Will do!
>
>
>> Best
>> Vincent
>
>
>>
> 2014-04-23 19:42 UTC+02:00, Kannappan Sampath <kntri...@gmail.com>:
>> > :-)
>> >
>> >
>> > On Wed, Apr 23, 2014 at 11:07 PM, Vincent Delecroix <
>> > 20100.delecr...@gmail.com> wrote:
>> >
>> >> What is the problem? You just copy/paste the definition of a function.
>> >>
>> >> 2014-04-23 19:31 UTC+02:00, Kannappan Sampath <kntri...@gmail.com>:
>> >> > Hello group,
>> >> >
>> >> > I think this is probably an embarrassing bug:
>> >> >
>> >> > def IncidenceStructureFromMatrix(M, name=None):
>> >> >     """
>> >> >     Builds and incidence structure from a matrix.
>> >> >
>> >> >     INPUT:
>> >> >
>> >> >     - ``M`` -- a binary matrix. Creates a set of "points" from the
>> rows
>> >> and
>> >> > a
>> >> >       set of "blocks" from the columns.
>> >> >
>> >> >     EXAMPLES::
>> >> >
>> >> >         sage: from sage.combinat.designs.block_design import
>> >> > BlockDesign
>> >> >         sage: BD1 =
>> >> >
>> BlockDesign(7,[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
>> >> >         sage: M = BD1.incidence_matrix()
>> >> >         sage: BD2 = IncidenceStructureFromMatrix(M)
>> >> >         sage: BD1 == BD2
>> >> >         True
>> >> >     """
>> >> >     nm = name
>> >> >     v = len(M.rows())
>> >> >     b = len(M.columns())
>> >> >     #points = range(v)
>> >> >     blocks = []
>> >> >     for i in range(b):
>> >> >         B = []
>> >> >         for j in range(v):
>> >> >             if M[i, j] != 0:
>> >>
>> >
>> > As I tried to explain, the indexing is ballsed up: v is the number of
>> rows,
>> > b is the number of columns. Since i is in range(b), i is a column index
>> and
>> > similarly, j is a row index. So, the code should have looked at M[j, i]
>> as
>> > opposed M[i, j] in the if condition.
>> >
>> > Kannappan.
>> >
>> >> >                 B.append(j)
>> >> >         blocks.append(B)
>> >> >     return IncidenceStructure(range(v), blocks, name=nm)
>> >> >
>> >> >
>> >> > The problem is with the indexing "if M[i, j] != 0". Of course, this
>> >> > will
>> >> not
>> >> > be a problem for square 2-designs like the Hadamard design or
>> >> > ProjectivePlaneDesign (thanks to Fisher Type counting), but this
>> should
>> >> > cause problem for designs that are not square. I was bitten by this
>> bug
>> >> when
>> >> > I tried to implement Hadamard 3-design from a Hadamard matrix.
>> >> >
>> >> > I will open a ticket if somebody does a sanity check for me.
>> >> >
>> >> > With Sincere Regards,
>> >> > Kannappan.
>> >> >
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups
>> >> > "sage-devel" group.
>> >> > To unsubscribe from this group and stop receiving emails from it,
>> send
>> >> > an
>> >> > email to sage-devel+unsubscr...@googlegroups.com.
>> >> > To post to this group, send email to sage-devel@googlegroups.com.
>> >> > Visit this group at http://groups.google.com/group/sage-devel.
>> >> > For more options, visit https://groups.google.com/d/optout.
>> >> >
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "sage-devel" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> an
>> >> email to sage-devel+unsubscr...@googlegroups.com.
>> >> To post to this group, send email to sage-devel@googlegroups.com.
>> >> Visit this group at http://groups.google.com/group/sage-devel.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >>
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "sage-devel" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an
>> > email to sage-devel+unsubscr...@googlegroups.com.
>> > To post to this group, send email to sage-devel@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/sage-devel.
>> > For more options, visit https://groups.google.com/d/optout.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sage-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to sage-devel+unsubscr...@googlegroups.com.
>> To post to this group, send email to sage-devel@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sage-devel.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to