You can subscribe to this list here.
2000 |
Jan
(8) |
Feb
(49) |
Mar
(48) |
Apr
(28) |
May
(37) |
Jun
(28) |
Jul
(16) |
Aug
(16) |
Sep
(44) |
Oct
(61) |
Nov
(31) |
Dec
(24) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(56) |
Feb
(54) |
Mar
(41) |
Apr
(71) |
May
(48) |
Jun
(32) |
Jul
(53) |
Aug
(91) |
Sep
(56) |
Oct
(33) |
Nov
(81) |
Dec
(54) |
2002 |
Jan
(72) |
Feb
(37) |
Mar
(126) |
Apr
(62) |
May
(34) |
Jun
(124) |
Jul
(36) |
Aug
(34) |
Sep
(60) |
Oct
(37) |
Nov
(23) |
Dec
(104) |
2003 |
Jan
(110) |
Feb
(73) |
Mar
(42) |
Apr
(8) |
May
(76) |
Jun
(14) |
Jul
(52) |
Aug
(26) |
Sep
(108) |
Oct
(82) |
Nov
(89) |
Dec
(94) |
2004 |
Jan
(117) |
Feb
(86) |
Mar
(75) |
Apr
(55) |
May
(75) |
Jun
(160) |
Jul
(152) |
Aug
(86) |
Sep
(75) |
Oct
(134) |
Nov
(62) |
Dec
(60) |
2005 |
Jan
(187) |
Feb
(318) |
Mar
(296) |
Apr
(205) |
May
(84) |
Jun
(63) |
Jul
(122) |
Aug
(59) |
Sep
(66) |
Oct
(148) |
Nov
(120) |
Dec
(70) |
2006 |
Jan
(460) |
Feb
(683) |
Mar
(589) |
Apr
(559) |
May
(445) |
Jun
(712) |
Jul
(815) |
Aug
(663) |
Sep
(559) |
Oct
(930) |
Nov
(373) |
Dec
|
From: George S. <geo...@gm...> - 2006-11-13 03:25:08
|
Tim Hochberg wrote: > George Sakkis wrote: > > def index(a, value): > > return N.where(a==value)[0][0] > > > Or > > def index(a, value): > return argmax(a == value) That's a bit easier to write and a bit harder to grok; that's ok, I can live with it. > > This works but seems clunky and less efficient than necessary. If there > > isn't a better alternative, I would welcome a new index() > > function/method in the next numpy release. > > > > > > Without commenting on the desirability of this particular function, > people seem awfully eager to add functions and methods everywhere. These > aren't free you know. They cost in terms of maintenance and potential > bugs, and in terms of making the already large function set even harder > to wrap ones head around. That's partly an organizational problem but > partly an issue of sheer size, neither of which are helped by adding a > bunch more stuff. > > Not every two-line Python function has to come pre-written > --Tim Peters I think the organizational problem is more serious in Numpy's case; any package with about 200 functions (according to http://www.scipy.org/Numpy_Example_List) in an almost flat namespace would feel the maintainability problem build up. > In the case of this particular function, what are the use cases? Are > they common (not just with you but with other numpy users)? Are the uses > speed critical? Is it a good building block for other numeric > functions? I'm skeptical of the above implementation as it doesn't fit > well with other similar numpy functions (argmin and argmax for example) > and I personally don't see much in the way of compelling uses for this, > but feel free to try to convince me otherwise. > > -tim As I said, I would welcome the addition of this function and I would use it if it was there, but I'm not particularly fervent about it. If I were to convince you, I'd argue about how numpy arrays can be considered generalizations of (1-d) sequences in many ways and how convenient would it be for users whose code expects python lists to work as is (thanks to duck typing) with 1-d numpy arrays. Another (indirect) argument would be the addition of functions that implement set-theoretic operations, and certainly lists are far more common than sets. I have to agree though that the flat namespace at its current size makes me uneasy too; I typically use "import numpy as N" instead of "from numpy import *". George |
From: A. M. A. <per...@gm...> - 2006-11-13 03:18:44
|
On 12/11/06, Erin Sheldon <eri...@gm...> wrote: > Actually, there is a problem with that approach. It first converts > the entire array to a single type, by default a floating type. For > very large integers this precision is insufficient. For example, I > have the following integer in my arrays: > 94137100072000193L > which ends up as > 94137100072000192 > after going to a float and then back to an integer. That's an unfortunate limitation of numpy; it views double-precision floats as higher precision than 64-bit integers, but of course they aren't. If you want to put all your data in a record array, you could try transposing the lists using a list comprehension - numpy is not always as much faster than pure python as it looks. You could then convert that to a list of four arrays and do the assignment as appropriate. Alternatively, you could convert your array into a higher-precision floating-point format (if one is available on your machine) before transposing and storing in a record array. A. M. Archibald |
From: Erin S. <eri...@gm...> - 2006-11-13 03:17:23
|
On 11/12/06, Tim Hochberg <tim...@ie...> wrote: > I haven't been following this too closely, but if you need to transpose > your data without converting all to one type, I can think of a couple of > different approaches: > > 1. zip(*yourlist) > 2. numpy.transpose(numpy.array(yourlist, dtype=object) > > I haven't tested them though (particularly the second one), so caveat > emptor, etc, etc. Its not that I want to transpose data. I'm trying to convert the output of a pgdb postgres query into an array with fields and types corresponding to the columns I have selected. The problem is pgdb does not return a list of tuples as it should according to DB 2.0, but instead a list of lists. So numpy.array(lol, dtype=) fails, and so will your solution #2. I don't want to copy the data more than once obviously, so I'm looking for a way to call array() with a lists of lists. Erin |
From: Tim H. <tim...@ie...> - 2006-11-13 03:08:06
|
Erin Sheldon wrote: > On 11/12/06, Erin Sheldon <eri...@gm...> wrote: > >> On 11/12/06, Pierre GM <pgm...@gm...> wrote: >> >>> You could try the fromarrays function of numpy.core.records >>> >>> >>>>>> mydescriptor = {'names': (a','b','c','d'), 'formats':('f4', 'f4', 'f4', >>>>>> >>> 'f4')} >>> >>>>>> a = N.core.records.fromarrays(N.transpose(yourlist), dtype=mydescriptor) >>>>>> >>> The 'transpose' function ensures that 'fromarrays' sees 4 arrays (one for each >>> column). >>> > > Actually, there is a problem with that approach. It first converts > the entire array to a single type, by default a floating type. For > very large integers this precision is insufficient. For example, I > have the following integer in my arrays: > 94137100072000193L > which ends up as > 94137100072000192 > after going to a float and then back to an integer. > I haven't been following this too closely, but if you need to transpose your data without converting all to one type, I can think of a couple of different approaches: 1. zip(*yourlist) 2. numpy.transpose(numpy.array(yourlist, dtype=object) I haven't tested them though (particularly the second one), so caveat emptor, etc, etc. -tim |
From: Abhishek R. <fin...@ya...> - 2006-11-13 03:06:32
|
--- Robert Kern <rob...@gm...> wrote: > Also add g2c to your library list, then. It is g77's FORTRAN runtime library Okay I put libg2c.a in the atlas directory and made the line in site.cfg, atlas_libs = lapack, f77blas, cblas, atlas, g2c Now numpy imports but numpy.linalg.test() as well as any linalg function gives, >>> numpy.linalg.test() Found 32 tests for numpy.linalg Found 0 tests for __main__ .. ** On entry to DGEEV parameter number 13 had an illegal value I am using prebuilt a lapack library from netlib.org. Thanks for all your help, Abhishek Send instant messages to your online friends http://uk.messenger.yahoo.com |
Междyнаpодные cтандаpты бyхгалтеpcкого yчета. 0знакoмлeнue c прuнцuпамu фoрмuрoванuя фuнанcoвoй oтчeтнocтu пo MСФ0 (MСБУ) u фoрмамu прeдcтавлeнuя oтчeтнocтu. Прuoбрeтeнue практuчecкux навыкoв yчeта oтдeльныx вuдoв актuвoв u oбязатeльcтв в cooтвeтcтвuu c MСБУ. Прuмeры cocтавлeнuя фuнанcoвыx oтчeтoв. Дата прoвeдeнuя: 14 - I5 Hoябpя, пo 8 акадeмuчecкux чаcoв в дeнь, c пeрeрывoм на oбeд u кoфe-брэйк. Mecтo прoвeдeнuя: г. Mocква Meтoдuчecкue u раздатoчныe матeрuалы, oбeды-кoфe-брэйкu включeны в cтouмocть. Кyрc oрueнтuрoван на рyкoвoдuтeлeй фuнанcoвo-экoнoмuчecкux cлyжб oрганuзацuй, главныx бyxгалтeрoв, а такжe вcex жeлающux пoлyчuть практuчecкue знанuя пo прuмeнeнuю MСФ0. Сoдeржанue: 0бщee знакoмcтвo c Meждyнарoднымu cтандартамu фuнанcoвoй oтчeтнocтu u бyxгалтeрcкoгo yчeта. Прuнцuпы фoрмuрoванuя cтандартoв u cтрyктyра cтандартoв. Сucтeма нoрматuвныx дoкyмeнтoв Сoвeта пo MСФ0: 0бщue прuнцuпы (IFRS Frameworks) Meждyнарoдныe cтандарты фuнанcoвoй oтчeтнocтu (MСФ0 / IFRS) Meждyнарoдныe cтандарты бyxгалтeрcкoгo yчeта (MСБУ / IAS) Интeрпрeтацuu к cтандартам, выпyщeнныe Кoмuтeтoм пo uнтeрпрeтацuu мeждyнарoднoй фuнанcoвoй oтчeтнocтu (IFRIC) Интeрпрeтацuu к cтандартам Пocтoяннoгo кoмuтeта пo uнтeрпрeтацuu (SIC) Прoeкты дoкyмeнтoв Дucкyccuoнныe матeрuалы o Сooтнoшeнue MСФ0 u US GAAP Элeмeнты фuнанcoвoй oтчeтнocтu пo MСФ0 (MСБУ 1, MСБУ 8, MСБУ 10, MСБУ 18): Бyxгалтeрcкuй баланc (Balance Sheet) 0тчeт o прuбыляx u yбыткаx (ProfitLoss Statement) 0тчeт o двuжeнuu дeнeжныx cрeдcтв (Cash Flow Statement) 0тчeт oб uзмeнeнuu coбcтвeннoгo капuтала (Changes of Equity Statement) Прuмeчанuя / Пoяcнuтeльная запucка к фuнанcoвoй oтчeтнocтu (Disclosures) o Учeтная пoлuтuка (Accounting Policies) Фoрмы прeдcтавлeнuя фuнанcoвoй oтчeтнocтu Баланc Чucтыe актuвы (актuвы - oбязатeльcтва) = Капuтал Актuвы = Капuтал + 0бязатeльcтва 0тчeт o прuбыляx u yбыткаx Пo мeтoдy xарактeра раcxoдoв Пo мeтoдy фyнкцuй раcxoдoв 0тчeт o двuжeнuu дeнeжныx cрeдcтв Прямoй мeтoд Кocвeнный мeтoд 0тчeт oб uзмeнeнuu coбcтвeннoгo капuтала 0cнoвнoй пoдxoд ("таблuца uзмeнeнuя рeзeрвoв") Альтeрнатuвный пoдxoд (агрeгuрoванный c раcкрытuямu в Пoяcнuтeльнoй запucкe) Прuмeр кoмплeкта фoрм фuнанcoвoй oтчeтнocтu Tрeбoванuя MСФ0 прu фoрмuрoванuu фuнанcoвoй oтчeтнocтu пo мeждyнарoдным cтандартам впeрвыe. MСФ0 1 Учeт oтдeльныx вuдoв актuвoв u oбязатeльcтв 0бщue прuнцuпы yчeта Пoрядoк прuзнанuя u oцeнкu oтдeльныx вuдoв актuвoв u oбязатeльcтв Сравнeнue c рoccuйcкuмu cтандартамu бyxгалтeрcкoгo yчeта Пoрядoк раcкрытuя uнфoрмацuu oб oтдeльныx вuдаx актuвoв u oбязатeльcтв в пoяcнuтeльнoй запucкe Учeт внeoбoрoтныx актuвoв 0cнoвныe cрeдcтва, uнвecтuцuoнная coбcтвeннocть u внeoбoрoтныe актuвы, прeдназначeнныe для прoдажu (MСБУ 16, MСБУ 40, MСФ0 5) Учeт нeматeрuальныx актuвoв (MСБУ 38) Амoртuзацuя внeoбoрoтныx актuвoв Пeрeoцeнка / 0бecцeнeнue внeoбoрoтныx актuвoв (MСБУ 36) Учeт запаcoв (MСБУ 2) Пeрвoначальная oцeнка Дальнeйшая пeрeoцeнка запаcoв (MСБУ 36) Спucанue прu прoдажe u выбытuu запаcoв Раcчeты c дeбuтoрамu u крeдuтoрамu Учeт займoв u крeдuтoв (MСБУ 23) Bырyчка u налoг на прuбыль Bырyчка (MСБУ 18) Учeт кyрcoвыx разнuц (MСБУ 21) Чucтая прuбыль / yбытoк за oтчeтный пeрuoд (MСБУ 8) Учeт налoга на прuбыль (MСБУ 12) Раcкрытue uнфoрмацuu o coбытuяx, прoucшeдшux пocлe oтчeтнoй даты (MСБУ 10) Капuтал u Рeзeрвы (MСБУ 37) Прuмeры cocтавлeнuя фuнанcoвыx oтчeтoв в cooтвeтcтвuu c MСФ0 Прuмeр 1: Прouзвoдcтвeнная кoмпанuя Прuмeр 2: Toргoвo-cбытoвая кoмпанuя Прuнцuпы u практuчecкue пoдxoды к транcфoрмацuu рoccuйcкoй бyxгалтeрcкoй oтчeтнocтu в фuнанcoвыe oтчeты пo MСФ0 Фoрмuрoванue рабoчeгo плана cчeтoв Tранcфoрмацuя oбoрoтнoгo баланcа Пoрядoк yчeта кoррeктuрoвoк прu прoвeдeнuu транcфoрмацuu oбoрoтнoгo баланcа Прuмeр транcфoрмацuu u фoрмuрoванuя фuнанcoвыx oтчeтoв в cooтвeтcтвuu c MСФ0 для тoргoвo-cбытoвoй кoмпанuu Пo вoпрocам рeгucтрацuu oбращайтecь пo тeл: (495) 2З5-58-88, (495) 2З5-I2З5 сышш |
From: Erin S. <eri...@gm...> - 2006-11-13 01:20:36
|
On 11/12/06, Charles R Harris <cha...@gm...> wrote: > > 94137100072000193L > > which ends up as > > 94137100072000192 > > after going to a float and then back to an integer. > > Out of curiosity, where does that large integer come from? It is a unique object identifier. It is a combination of various numbers related to an astronomical object detected by the sloan digital sky survey. (www.sdss.org). cheers, Erin |
From: Charles R H. <cha...@gm...> - 2006-11-13 01:15:13
|
On 11/12/06, Erin Sheldon <eri...@gm...> wrote: > > On 11/12/06, Erin Sheldon <eri...@gm...> wrote: > > On 11/12/06, Pierre GM <pgm...@gm...> wrote: > > > > > > You could try the fromarrays function of numpy.core.records > > > > > > >>> mydescriptor = {'names': (a','b','c','d'), 'formats':('f4', 'f4', > 'f4', > > > 'f4')} > > > >>> a = N.core.records.fromarrays(N.transpose(yourlist), > dtype=mydescriptor) > > > > > > The 'transpose' function ensures that 'fromarrays' sees 4 arrays (one > for each > > > column). > > Actually, there is a problem with that approach. It first converts > the entire array to a single type, by default a floating type. For > very large integers this precision is insufficient. For example, I > have the following integer in my arrays: > 94137100072000193L > which ends up as > 94137100072000192 > after going to a float and then back to an integer. Out of curiosity, where does that large integer come from? Chuck |
From: Erin S. <eri...@gm...> - 2006-11-13 01:10:18
|
On 11/12/06, Erin Sheldon <eri...@gm...> wrote: > On 11/12/06, Pierre GM <pgm...@gm...> wrote: > > > > You could try the fromarrays function of numpy.core.records > > > > >>> mydescriptor = {'names': (a','b','c','d'), 'formats':('f4', 'f4', 'f4', > > 'f4')} > > >>> a = N.core.records.fromarrays(N.transpose(yourlist), dtype=mydescriptor) > > > > The 'transpose' function ensures that 'fromarrays' sees 4 arrays (one for each > > column). Actually, there is a problem with that approach. It first converts the entire array to a single type, by default a floating type. For very large integers this precision is insufficient. For example, I have the following integer in my arrays: 94137100072000193L which ends up as 94137100072000192 after going to a float and then back to an integer. Erin |
From: Erin S. <eri...@gm...> - 2006-11-13 00:50:42
|
On 11/12/06, Pierre GM <pgm...@gm...> wrote: > > You could try the fromarrays function of numpy.core.records > > >>> mydescriptor = {'names': (a','b','c','d'), 'formats':('f4', 'f4', 'f4', > 'f4')} > >>> a = N.core.records.fromarrays(N.transpose(yourlist), dtype=mydescriptor) > > The 'transpose' function ensures that 'fromarrays' sees 4 arrays (one for each > column). > That worked as advertised. Thanks. Erin |
From: Pierre GM <pgm...@gm...> - 2006-11-13 00:15:02
|
You could try the fromarrays function of numpy.core.records >>> mydescriptor = {'names': (a','b','c','d'), 'formats':('f4', 'f4', 'f4', 'f4')} >>> a = N.core.records.fromarrays(N.transpose(yourlist), dtype=mydescriptor) The 'transpose' function ensures that 'fromarrays' sees 4 arrays (one for each column). |
From: Erin S. <eri...@gm...> - 2006-11-13 00:09:27
|
I have to not ammend my statement a bit: DBI 2.0 actually returns a lists of tuples, which would work. It appears to just be pgdb, the postgres interface, that is returning lists of lists. Still, I need to interact with this database. Erin On Sun, Nov 12, 2006 at 06:56:29PM -0500, Erin Sheldon wrote: > Hi all- > > I want to take the result from a database query, > and create a numpy array with field names and types > corresponding to the returned columns. > > The DBI 2.0 compliant interfaces return lists > of lists. E.g. > > > [[94137100072000193L, 94, 345.57215100000002, -0.83673208099999996], > [94137100072000368L, 94, 345.60217299999999, -0.83766954299999996], > .... > [94137100083000157L, 94, 347.21668099999999, -0.83572582399999995], > [94137100084000045L, 94, 347.45524799999998, -0.829750074]] > > > But the only examples I have found for creating an inhomogeneous > array with fields involves lists of tuples. e.g. > > >>> mydescriptor = {'names': ('gender','age','weight'), 'formats':('S1', > >>> 'f4', 'f4')} > >>> a = array([('M',64.0,75.0),('F',25.0,60.0)], dtype=mydescriptor) > > Trying something like this with a list of lists results in > the following error: > > TypeError: expected a readable buffer object > > Now I could create the array and run a loop, copying > in, but this would be less efficient. Is there a way > to do this in one step? > > Thanks, > Erin > |
From: Erin S. <eri...@gm...> - 2006-11-12 23:56:33
|
Hi all- I want to take the result from a database query, and create a numpy array with field names and types corresponding to the returned columns. The DBI 2.0 compliant interfaces return lists of lists. E.g. [[94137100072000193L, 94, 345.57215100000002, -0.83673208099999996], [94137100072000368L, 94, 345.60217299999999, -0.83766954299999996], .... [94137100083000157L, 94, 347.21668099999999, -0.83572582399999995], [94137100084000045L, 94, 347.45524799999998, -0.829750074]] But the only examples I have found for creating an inhomogeneous array with fields involves lists of tuples. e.g. >>> mydescriptor = {'names': ('gender','age','weight'), 'formats':('S1', >>> 'f4', 'f4')} >>> a = array([('M',64.0,75.0),('F',25.0,60.0)], dtype=mydescriptor) Trying something like this with a list of lists results in the following error: TypeError: expected a readable buffer object Now I could create the array and run a loop, copying in, but this would be less efficient. Is there a way to do this in one step? Thanks, Erin |
From: Robert K. <rob...@gm...> - 2006-11-12 23:15:08
|
Abhishek Roy wrote: > --- Robert Kern <rob...@gm...> wrote: >> Are your ATLAS libraries shared or static (i.e., are they libatlas.so or >> libatlas.a)? ldd(1) only lists the shared libraries that are linked. ATLAS is >> usually installed as static libraries. > They are static. Thanks, I was mindlessly copying a suggestion I saw elsewhere. > >> Does that module import? > I got, > ImportError: /usr/lib/python2.4/site-packages/numpy/linalg/lapack_lite.so: > undefined symbol: s_cat Also add g2c to your library list, then. It is g77's FORTRAN runtime library. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco |
From: Pierre GM <pgm...@gm...> - 2006-11-12 23:09:50
|
On Sunday 12 November 2006 17:08, A. M. Archibald wrote: > On 12/11/06, Keith Goodman <kwg...@gm...> wrote: > > Is anybody interested in making x.max() and nanmax() behave the same > > for matrices, except for the NaN part? That is, make > > numpy.matlib.nanmax return a matrix instead of an array. Or, you could use masked arrays... In the new implementation, you can add a mask to a subclassed array (such as matrix) to get a regular masked array. If you fill this masked array, you get an array of the same subclass. >>> import numpy as N >>> import numpy.matlib as M >>> import maskedarray as MA >>> x=M.rand(3,3) >>> assert isinstance(x.max(0), M.matrix) >>> assert isinstance(N.max(x,0), M.matrix) >>> assert isinstance(MA.max(x,0).filled(0), M.matrix) >>> assert isinstance(MA.max(x,0)._data, M.matrix) >>> x[-1,-1] = N.nan >>> tmp = MA.max(MA.array(x,mask=N.isnan(x)), 0) >>> assert (tmp == N.nanmax(x,0)).all() >>> assert isinstance(tmp.filled(0), M.matrix) |
From: Colin J. W. <cj...@sy...> - 2006-11-12 22:54:03
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> <br> <br> Tim Hochberg wrote: <blockquote cite="mid...@ie..." type="cite"> <pre wrap="">George Sakkis wrote: </pre> <blockquote type="cite"> <pre wrap="">def index(a, value): return N.where(a==value)[0][0] </pre> </blockquote> <pre wrap=""><!---->Or def index(a, value): return argmax(a == value) </pre> <blockquote type="cite"> <pre wrap="">This works but seems clunky and less efficient than necessary. If there isn't a better alternative, I would welcome a new index() function/method in the next numpy release. </pre> </blockquote> <pre wrap=""><!----> Without commenting on the desirability of this particular function, people seem awfully eager to add functions and methods everywhere. These aren't free you know. They cost in terms of maintenance and potential bugs, and in terms of making the already large function set even harder to wrap ones head around. </pre> </blockquote> +1<br> There is already a need to thoughtfully weed out the existing namespace.<br> <br> from X import * is deprecated by some.<br> <br> Colin W.<br> <blockquote cite="mid...@ie..." type="cite"> <pre wrap="">That's partly an organizational problem but partly an issue of sheer size, neither of which are helped by adding a bunch more stuff. Not every two-line Python function has to come pre-written --Tim Peters In the case of this particular function, what are the use cases? Are they common (not just with you but with other numpy users)? Are the uses speed critical? Is it a good building block for other numeric functions? I'm skeptical of the above implementation as it doesn't fit well with other similar numpy functions (argmin and argmax for example) and I personally don't see much in the way of compelling uses for this, but feel free to try to convince me otherwise. -tim ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo <a class="moz-txt-link-freetext" href="http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642">http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642</a> _______________________________________________ Numpy-discussion mailing list <a class="moz-txt-link-abbreviated" href="mailto:Num...@li...">Num...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/numpy-discussion">https://lists.sourceforge.net/lists/listinfo/numpy-discussion</a> </pre> </blockquote> </body> </html> |
From: A. M. A. <per...@gm...> - 2006-11-12 22:09:17
|
On 12/11/06, Keith Goodman <kwg...@gm...> wrote: > Is anybody interested in making x.max() and nanmax() behave the same > for matrices, except for the NaN part? That is, make > numpy.matlib.nanmax return a matrix instead of an array. Sounds good to me; maybe put a patch in the tracker? A. M. Archibald |
From: Keith G. <kwg...@gm...> - 2006-11-12 21:57:19
|
Is anybody interested in making x.max() and nanmax() behave the same for matrices, except for the NaN part? That is, make numpy.matlib.nanmax return a matrix instead of an array. Example ===== >> import numpy.matlib as M >> x = M.rand(3,2) >> x.max(0) matrix([[ 0.91749823, 0.94942954]]) >> M.nanmax(x, 0) array([ 0.91749823, 0.94942954]) |
From: Tim H. <tim...@ie...> - 2006-11-12 21:39:56
|
George Sakkis wrote: > def index(a, value): > return N.where(a==value)[0][0] > Or def index(a, value): return argmax(a == value) > This works but seems clunky and less efficient than necessary. If there > isn't a better alternative, I would welcome a new index() > function/method in the next numpy release. > > Without commenting on the desirability of this particular function, people seem awfully eager to add functions and methods everywhere. These aren't free you know. They cost in terms of maintenance and potential bugs, and in terms of making the already large function set even harder to wrap ones head around. That's partly an organizational problem but partly an issue of sheer size, neither of which are helped by adding a bunch more stuff. Not every two-line Python function has to come pre-written --Tim Peters In the case of this particular function, what are the use cases? Are they common (not just with you but with other numpy users)? Are the uses speed critical? Is it a good building block for other numeric functions? I'm skeptical of the above implementation as it doesn't fit well with other similar numpy functions (argmin and argmax for example) and I personally don't see much in the way of compelling uses for this, but feel free to try to convince me otherwise. -tim |
From: Abhishek R. <fin...@ya...> - 2006-11-12 20:37:03
|
--- Robert Kern <rob...@gm...> wrote: > Are your ATLAS libraries shared or static (i.e., are they libatlas.so or > libatlas.a)? ldd(1) only lists the shared libraries that are linked. ATLAS is > usually installed as static libraries. They are static. Thanks, I was mindlessly copying a suggestion I saw elsewhere. > Does that module import? I got, ImportError: /usr/lib/python2.4/site-packages/numpy/linalg/lapack_lite.so: undefined symbol: s_cat even after changing the order of libraries in site.cfg to, > lapack,f77blas,cblas,atlas Abhishek Send instant messages to your online friends http://uk.messenger.yahoo.com |
From: George S. <geo...@gm...> - 2006-11-12 20:19:12
|
Keith Goodman wrote: > On 11/12/06, George Sakkis <geo...@gm...> wrote: > > This must be pretty trivial but I couldn't find it in the docs: what's > > the "numpythonic" way to find the (first) index of an element, i.e. the > > equivalent to list.index ? > > Does where work? def index(a, value): return N.where(a==value)[0][0] This works but seems clunky and less efficient than necessary. If there isn't a better alternative, I would welcome a new index() function/method in the next numpy release. George |
From: Keith G. <kwg...@gm...> - 2006-11-12 20:18:56
|
On 11/12/06, Keith Goodman <kwg...@gm...> wrote: > >> x = M.matrix([[1, 2], [3, 4]]) > >> x > matrix([[1, 2], > [3, 4]]) > > >> y = M.matrix([[5], [6]]) > >> y > matrix([[5], > [6]]) > > >> idx = M.where(x[:,0].A < 100)[0] > >> idx > array([0, 1]) > > > >> x[idx,0] # <---- This works > matrix([[1], > [3]]) > > >> x[idx,0] = y # <---- But this doesn't work. How can I make it work? > > ValueError: array is not broadcastable to correct shape Awkward, but it works: >> idx = M.asmatrix(idx) >> idx matrix([[0, 1]]) >> idx = idx.T >> idx matrix([[0], [1]]) >> x[idx,0] = y But it does seem odd to me that the array idx in the original example works for a slice but for not an assignment. |
From: Keith G. <kwg...@gm...> - 2006-11-12 20:12:54
|
>> x = M.matrix([[1, 2], [3, 4]]) >> x matrix([[1, 2], [3, 4]]) >> y = M.matrix([[5], [6]]) >> y matrix([[5], [6]]) >> idx = M.where(x[:,0].A < 100)[0] >> idx array([0, 1]) >> x[idx,0] # <---- This works matrix([[1], [3]]) >> x[idx,0] = y # <---- But this doesn't work. How can I make it work? ValueError: array is not broadcastable to correct shape |
From: Keith G. <kwg...@gm...> - 2006-11-12 19:21:55
|
On 11/12/06, George Sakkis <geo...@gm...> wrote: > This must be pretty trivial but I couldn't find it in the docs: what's > the "numpythonic" way to find the (first) index of an element, i.e. the > equivalent to list.index ? Does where work? |
From: George S. <geo...@gm...> - 2006-11-12 19:16:31
|
This must be pretty trivial but I couldn't find it in the docs: what's the "numpythonic" way to find the (first) index of an element, i.e. the equivalent to list.index ? Thanks, George |