Re: reduction

2016-06-01 Thread Fillmore
<- Black sheep!!! ['a','b','c','m'] => 1 ['a','b','c','n'] => 1 ['a','b','c','o'] => 1 ['a','b','c','p'] => 1 I can check a bit of

Re: reduction

2016-06-01 Thread Lawrence D’Oliveiro
On Thursday, June 2, 2016 at 10:07:21 AM UTC+12, MRAB wrote: > What is "this_list"? The main 'for' loop has "entry". Sorry. :) for entry in \ ( ['a','b','c','l'], ['a','b','c'], ) \ : flag = int(not any(m == "l" for m in entry)) ...

Re: reduction

2016-06-01 Thread MRAB
On 2016-06-01 22:44, Lawrence D’Oliveiro wrote: On Wednesday, June 1, 2016 at 2:22:42 AM UTC+12, Fillmore wrote: ['a','b','c','l'] => 0 # If "l" is in my data I have a zero ['a','b','c'] => 1 # or a more generic match will do the job for entry in \ ( ['a','b','c',

Re: reduction

2016-06-01 Thread Lawrence D’Oliveiro
On Wednesday, June 1, 2016 at 2:22:42 AM UTC+12, Fillmore wrote: > ['a','b','c','l'] => 0 # If "l" is in my data I have a zero > ['a','b','c'] => 1 # or a more generic match will do the job for entry in \ ( ['a','b','c','l'], ['a','b','c'], ) \

Re: reduction

2016-05-31 Thread Steven D'Aprano
On Wed, 1 Jun 2016 12:22 am, Fillmore wrote: > > My problem. I have lists of substrings associated to values: > > ['a','b','c','g'] => 1 > ['a','b','c','h'] => 1 > ['a','b','c','i'] => 1 > ['a','b','c','j'] => 1 > ['a','b','c','k'] => 1 > ['a','b','c','l'] => 0 # <- Black sheep!!! > ['a','b','c

RE: reduction

2016-05-31 Thread Dan Strohl via Python-list
> ['a','b','c','n'] => 1 > ['a','b','c','o'] => 1 > ['a','b','c','p'] => 1 > > I can check a bit of data against elements in this list and determine whether

Re: reduction

2016-05-31 Thread Ben Bacarisse
#x27;] => 0 # <- Black sheep!!! >> ['a','b','c','m'] => 1 >> ['a','b','c','n'] => 1 >> ['a','b','c','o'] => 1 >> ['a','

Re: reduction

2016-05-31 Thread Ian Kelly
x27;b','c','m'] => 1 > ['a','b','c','n'] => 1 > ['a','b','c','o'] => 1 > ['a','b','c','p'] => 1 > > I can check a bit of data a

reduction

2016-05-31 Thread Fillmore
x27;n'] => 1 ['a','b','c','o'] => 1 ['a','b','c','p'] => 1 I can check a bit of data against elements in this list and determine whether the value to be associated to the data is 1 or 0. I would like to m

Re: source reduction using Python

2006-06-22 Thread Roger Miller
[EMAIL PROTECTED] wrote: > Intel has introduced something called CESR, written in Python, to aid > C, C++, and Fortran programmers in reducing the sizes of programs > included in bug reports. Here is a brief description from > http://cache-www.intel.com/cd/00/00/21/93/219320_relnotes_10.pdf : > ...

source reduction using Python

2006-06-21 Thread beliavsky
Intel has introduced something called CESR, written in Python, to aid C, C++, and Fortran programmers in reducing the sizes of programs included in bug reports. Here is a brief description from http://cache-www.intel.com/cd/00/00/21/93/219320_relnotes_10.pdf : "Compiler Error Source Reducer (CESR)

Re: PIL & image size reduction script

2006-03-27 Thread Philippe Martin
Many thanks nikie wrote: > Philippe Martin wrote: >> PS: where can I find those extra parameters in the doc (ex: quality) ... >> I must be blind. > In the http://www.pythonware.com/library/pil/handbook/formats.htm page. > Look in the "JPEG" section. Different file formats support different > opt

Re: PIL & image size reduction script

2006-03-27 Thread nikie
Philippe Martin wrote: > PS: where can I find those extra parameters in the doc (ex: quality) ... I > must be blind. In the http://www.pythonware.com/library/pil/handbook/formats.htm page. Look in the "JPEG" section. Different file formats support different options. -- http://mail.python.org/mail

Re: PIL & image size reduction script

2006-03-27 Thread Philippe Martin
PS: where can I find those extra parameters in the doc (ex: quality) ... I must be blind. Philippe nikie wrote: > Philippe Martin wrote: >> Hi, >> >> Thanks to the NG, I got the script hereunder working. >> >> 1) I am not certain that the call to convert does much (checking the doc) > > I thi

Re: PIL & image size reduction script

2006-03-27 Thread Philippe Martin
nikie wrote: > Philippe Martin wrote: >> Hi, >> >> Thanks to the NG, I got the script hereunder working. >> >> 1) I am not certain that the call to convert does much (checking the doc) > > I think you only need it if your source image comes in a format that > can't be stored into a jpeg file (e.g

Re: PIL & image size reduction script

2006-03-26 Thread nikie
Philippe Martin wrote: > Hi, > > Thanks to the NG, I got the script hereunder working. > > 1) I am not certain that the call to convert does much (checking the doc) I think you only need it if your source image comes in a format that can't be stored into a jpeg file (e.g. 8-bit paletted). You'll n

Re: image reduction script

2006-03-26 Thread Philippe Martin
Kamilche wrote: > Be sure and use mode = P instead of RGB, like you have in your other > code. P is for palettized images. Don't palettize if you're storing as > JPG, only if you're storing as PNG or some other format that can handle > 256 color images. My problem is this: 1) If I use a save to

Re: image reduction script

2006-03-26 Thread Kamilche
Be sure and use mode = P instead of RGB, like you have in your other code. P is for palettized images. Don't palettize if you're storing as JPG, only if you're storing as PNG or some other format that can handle 256 color images. -- http://mail.python.org/mailman/listinfo/python-list

PIL & image size reduction script

2006-03-26 Thread Philippe Martin
Hi, Thanks to the NG, I got the script hereunder working. 1) I am not certain that the call to convert does much (checking the doc) 2) Can this be improved as far as the final image size in (X,Y) ? For instance, passing a large .jpg with a target byte size of 7000, I get final (X,Y) results aro

Re: image reduction script

2006-03-26 Thread Philippe Martin
Kamilche, I am posting the code in another thread but am not certain that convert does anything to the picture color depth ... still searching in the doc. Philippe Kamilche wrote: > > To reduce the color depth of an image in PIL: > im = im.convert(mode="P", palette=Image.ADAPTIV

Re: image reduction script

2006-03-26 Thread Philippe Martin
Thanks, I'll give it a shot. Philippe Kamilche wrote: > > To reduce the color depth of an image in PIL: > im = im.convert(mode="P", palette=Image.ADAPTIVE) -- http://mail.python.org/mailman/listinfo/python-list

Re: image reduction script

2006-03-25 Thread Kamilche
To reduce the color depth of an image in PIL: im = im.convert(mode="P", palette=Image.ADAPTIVE) -- http://mail.python.org/mailman/listinfo/python-list

Re: image reduction script

2006-03-25 Thread Philippe Martin
Larry, I actually did not find what I needed in PIL (missed it ?) but found this package quite usefull: http://www.imagemagick.org/script/index.php Philippe Larry Bates wrote: > Philippe Martin wrote: >> Hi, >> >> I need to write a script to reduce the resolution/color depth of an image >>

Re: image reduction script

2006-03-24 Thread Larry Bates
Philippe Martin wrote: > Hi, > > I need to write a script to reduce the resolution/color depth of an image > (ex: .jpg) based on a target size. > > The point is for the target picture to still be "understandable" - yet I > target getting down to 5K. > > Are there libraries out there that could h

image reduction script

2006-03-24 Thread Philippe Martin
Hi, I need to write a script to reduce the resolution/color depth of an image (ex: .jpg) based on a target size. The point is for the target picture to still be "understandable" - yet I target getting down to 5K. Are there libraries out there that could help me start ? Thanks Philippe -- ht

Re: Sudoku solver: reduction + brute force

2006-01-20 Thread Anton Vredegoor
ago wrote: [Something I mostly agree with] > According to Anton the number of possible solutions can be reduced > using 1) number swapping, 2) mirroring, 3) blocks/rows/columns > swapping. All those operations create equivalent matrices. For a 9X9 > grid, this should give a redu

Re: Sudoku solver: reduction + brute force

2006-01-19 Thread ago
and you get the solution. According to Anton the number of possible solutions can be reduced using 1) number swapping, 2) mirroring, 3) blocks/rows/columns swapping. All those operations create equivalent matrices. For a 9X9 grid, this should give a reduction factor = (9!)*(48)*(6^12) minus the number

Re: Sudoku solver: reduction + brute force

2006-01-19 Thread Anton Vredegoor
ago wrote: > Do you think it is possible to reduce the set of all possible solutions > to a small enough set? I personally doubt it, but IF that was the case > an efficient solver could be easily created. No I don't think so, but it's a great idea :-) . Iff we would have some ultimate symmetry de

Re: Sudoku solver: reduction + brute force

2006-01-19 Thread ago
>Your reduction-first approach makes short work of > them, though. On the other hand, my version probably didn't take as long > to write! Well, I started from the reduction-only algorithm so by the time I implemented the brute force solver I already had the code. Anyway the ful

Re: Sudoku solver: reduction + brute force

2006-01-19 Thread ago
Anton, Do you think it is possible to reduce the set of all possible solutions to a small enough set? I personally doubt it, but IF that was the case an efficient solver could be easily created. In reducing the set of all solutions for instance you could always swap the numbers (3rd axis) so that

Re: Sudoku solver: reduction + brute force

2006-01-18 Thread Carl Cerecke
am I sort-of lost interest. The first three sample boards included are all quite difficult, and take some time to solve (and verify no other solutions exist!) with a depth-first search. Your reduction-first approach makes short work of them, though. On the other hand, my version probably didn&#x

Re: Sudoku solver: reduction + brute force

2006-01-17 Thread Anton Vredegoor
ago wrote: > You can see my amended code in the link above. Thanks, I will look into it sometime. At the moment I'm at a library computer, which severely limits my Python options. Meanwhile I have been thinking about the sudoku problem, maybe it will prompt you, me or someone else to make some ki

Re: Sudoku solver: reduction + brute force

2006-01-17 Thread ago
he nice post. The issue with my code was not due to the reduction algorithms used. In fact we used exactly the same set of rules, my Cell.solve was equivalent to your Clean1 method and my Cell.skim was equivalent to your Clean3 method (except that my algorithm was only doing "for (o1, o2) in ((o

Re: Sudoku solver: reduction + brute force

2006-01-14 Thread Bas
There is more in this thread: http://groups.google.com/group/comp.lang.python/browse_frm/thread/479c1dc768f740a3/9252dab14e8ecabb?q=sudoku&rnum=2#9252dab14e8ecabb Enjoy, Bas -- http://mail.python.org/mailman/listinfo/python-list

Re: Sudoku solver: reduction + brute force

2006-01-14 Thread Pavol . Severa
ago wrote: > Inspired by some recent readings on LinuxJournal and an ASPN recipe, I > decided to revamp my old python hack... The new code is a combination > of (2) reduction methods and brute force and it is quite faster than > the > ASPN program. If anyone is interested I attac

Re: Sudoku solver: reduction + brute force

2006-01-14 Thread Pavol . Severa
ago wrote: > Inspired by some recent readings on LinuxJournal and an ASPN recipe, I > decided to revamp my old python hack... The new code is a combination > of (2) reduction methods and brute force and it is quite faster than > the > ASPN program. If anyone is interested I attac

Re: Sudoku solver: reduction + brute force

2006-01-13 Thread znx
bmitted by me:http://digg.com/programming/SudokuBan_Wins_%C2%A3300 -- end --On 13 Jan 2006 16:00:45 -0800, ago <[EMAIL PROTECTED]> wrote: Inspired by some recent readings on LinuxJournal and an ASPN recipe, Idecided to revamp my old python hack... The new code is a combinationof (2) reduction m

Sudoku solver: reduction + brute force

2006-01-13 Thread ago
Inspired by some recent readings on LinuxJournal and an ASPN recipe, I decided to revamp my old python hack... The new code is a combination of (2) reduction methods and brute force and it is quite faster than the ASPN program. If anyone is interested I attached the code in http

Re: FW: list reduction

2005-03-10 Thread Stephen Thorne
I think you mean, newlist = [y for y in industrylist if y.cap < x] otherwise you've got a list of caps, not a list of objects with the cap attribute. On Thu, 10 Mar 2005 12:10:31 -0800, James Stroud <[EMAIL PROTECTED]> wrote: > newlist = [y.cap for y in industrylist if y.cap < x] > > On Thursd

Re: FW: list reduction

2005-03-10 Thread James Stroud
newlist = [y.cap for y in industrylist if y.cap < x] On Thursday 10 March 2005 12:00 pm, Leeds, Mark wrote: > I have a structure in python that I think is a list > > with elements .Cap and .Ticker > > where Cap is a float and Ticker is string. > > > > So, I reference things like > > industrylist[i

FW: list reduction

2005-03-10 Thread Leeds, Mark
  I have a structure in python that I think is a list with elements .Cap and .Ticker where Cap is a float and Ticker is string.   So, I reference things like industrylist[i].cap and industrylist[i].ticker and this works fine.   What I want to do is reduce the list so that it only