If I'm not mistaken, your combination would only match 5 columns,
whereas Oleg's example matches 6, which is what I want.
-- Glenn
Leo Vo~handu wrote:
Sorry, but j has to be 0 2 3 5 6, exactly as k
Leo
Wow!!! That is very impressive! I tried pulling apart the line (by
executing tiny bits at a time and displaying the line in boxed format),
and I still don't fully understand it yet, but I was able to tweak it
slightly to get it to produce a result... Here's my minor tweak:
t
1 0 1 1 1 1 1 0
0 1 1 1 1 0 1 1
1 1 1 1 0 1 1 0
1 1 1 1 0 1 1 1
1 1 0 0 1 1 1 1
1 0 1 1 1 1 1 1
1 1 1 1 1 1 1 0
0 1 0 1 1 0 1 1
]j=. i,I.s{~i=.(i.>./)@:(+/) s=.(= >./@,)(-.=i.1{$t)*.+/@:="1/~t
0 5 6
]k=. I.*./ j{t
0 2 3 4 5 6
Thanks a bunch, Oleg! Hopefully before my next birthday I will have
figured out what you just wrote. :-)
-- Glenn
Oleg Kobchenko wrote:
If you mean length error, that's an exercise to the reader.
--- Leo Vo~handu <[EMAIL PROTECTED]> wrote:
Hei, Oleg,
try your J-line with a table
1 0 1 1 1 1 1 0
0 1 1 1 1 0 1 1
1 1 1 1 0 1 1 0
1 1 1 1 0 1 1 1
1 1 0 0 1 1 1 1
1 0 1 1 1 1 1 1
1 1 1 1 1 1 1 0
0 1 0 1 1 0 1 1
Leo
Sorry, not quite. Here it is:
]j=. i,I.s{~i=.(i.>./)@:(+/) s=.(= >./@,)(-.=i.6)*.+/@:="1/~ t
0 3
]k=. I.*./ j{t
1 2 5 7 8
(<j;k) { t
1 1 1 1 1
1 1 1 1 1
--- Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
i,I.s{~i=.(i.>./)@:(+/) s=.(= >./@,)(-.=i.6)*.+/@:="1/~ (#"1~
(=>./)@:(+/)) t
0 3
Are there more and interesting examples?
--- "Glenn M. Lewis" <[EMAIL PROTECTED]> wrote:
I apologize for replying to my own message, but I just realized
that
I must choose to either maximize the columns or maximize the
rows... not both. So let's say I wish to maximize the columns.
It appears that the three tied answers are still valid.
Thanks again!
-- Glenn
Glenn M. Lewis wrote:
Hi all!
Say I have a table with shape 'm n' (m rows, n columns)
populated
with ones and zeros.
Let's say I would like to create the largest table possible by
selecting the most rows and the most columns where all
intersections of said rows and columns consist of all ones.
I'm having difficulties coming up with an expression that
gives
me
two lists... one for the rows and one for the columns that
'selects' the rows/columns that would make up this maximal table.
Wow... I probably didn't explain that very well. Let me try
an
example.
t =. 6 10 $ 0 1 1 0 0 1
t
0 1 1 0 0 1 0 1 1 0
0 1 0 1 1 0 0 1 0 1
1 0 0 1 0 1 1 0 0 1
0 1 1 0 0 1 0 1 1 0
0 1 0 1 1 0 0 1 0 1
1 0 0 1 0 1 1 0 0 1
By inspection, it appears that one of three solutions is
possible
that all tie for the maximum-sized table of all-ones (in this
case, a shape '2 5' table.
rows 0 and 3 with columns 1,2,5,7,8 or in J:
(< 0 3 ; 1 2 5 7 8) { t
1 1 1 1 1
1 1 1 1 1
or
(< 1 4 ; 1 3 4 7 9) { t
1 1 1 1 1
1 1 1 1 1
or
(< 2 5 ; 0 3 5 6 9) { t
1 1 1 1 1
1 1 1 1 1
The problem I'm having is coming up with these lists
algorithmically...
Any ideas on how to solve this?
Thanks!
-- Glenn Lewis
----------------------------------------------------------------------
For information about J forums see
http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see
http://www.jsoftware.com/forums.htm
____________________________________________________________________________________
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367
----------------------------------------------------------------------
For information about J forums see
http://www.jsoftware.com/forums.htm
____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s
user panel and lay it on us.
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
----------------------------------------------------------------------
For information about J forums see
http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see
http://www.jsoftware.com/forums.htm
____________________________________________________________________________________
Sick sense of humor? Visit Yahoo! TV's
Comedy with an Edge to see what's on, when.
http://tv.yahoo.com/collections/222
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm