(ignore previous) On 8/25/2011 11:14 AM, address@hidden wrote: hi george: > > Yet, I think there are a lot of possibilities in ucar.ma where it is possible > to use generics. > > Make a new generic Class <T> Array > Hold in this class empty arrays float , short , long  etc. > In constructor reflect type T.getclass() and initialize corresponding array . > > Another point is the dimensionality of the matrices. First of all, I wonder > that you are not making use of any 'final' statements. I think you should use > them whenever possible to improve performance. this is what they said to do in the early days, to avoid runtime class substitution. then the hotspot compiler guys said this wasnt needed. i havent actually done any timing on it for a long time. > And then I wonder why you have implementation D0..D7 and not just use an > access-method with loops over their dimensions. A constructor Array(<T>, int > d) would initialize the final dimension. At the time i was on the jsr for multidimensional arrays, and thats what the IBM guys insisted on. i think the main effect is that one can optimize the stride index arithmetic when you know what the rank is. again, i havent revisted the actual performance in many years, and compilers have changed a lot. > > And then the most delicate part has to be implemented, think about all the > methods, which parts of them are necessary (for example, I would prefer > omitting the getDouble(), getFloat() methods etc) and replace it by > getValue(), according to the initialized Array<T>), whenever there is > something type-specific in the code it probably can be replaced by T or ?. that would be interesting! > > After all I would implement a new version with probably different API and > deprecate the old one. I hope that you are not frightened and think about it. > Letting the compiler do as much type-checking as possible is not a bad idea. > Maybe the code can be also reduced a lot. > If you thought about it a while , please let me know! it would be interesting to try a design based on your ideas, and see how it performed against current one, and against raw java arrays, > > Best regards, > Georg > > > > > > -----UrsprÃngliche Nachricht----- > Von: Unidata netCDF Java Support [mailto:address@hidden > Gesendet: Freitag, 19. August 2011 18:12 > An: Steidl, Georg > Cc: address@hidden > Betreff: [netCDFJava #KSI-560385]: Generics in ucar.ma2 > > > Hi Georg: > > As you can tell, the Array classes preceded java generics. I use them > wherever I can, but I dont understand them deep enough to actually write > classes that implement them. > > So the short answer is i'd love to have you contribute to that. However, I > would guess that it would be hard to make this backwards compatible (?) If > so, I would have to think carefully about how/if we could do this, or if we > would need to make a new version with a different API. > > What do you think? > > John > >> Hello NetCDF-Developers! >> >> I am really glad that there are projects like NetCDF-Java that you have >> created. Since I got more familiar with Java Generics now I thought >> whether you think about implementing ucar.ma2 and all the Array Stuff >> with templates. >> >> Is there something planned? If yes, I would like to contribute to that. >> >> Regards, >> Georg Steidl >> >> -- >> M.Sc. Comp. Engineering >> >> Deutsches Zentrum fÃr Luft- und Raumfahrt e. V. | German Aerospace Center >> Institut fÃr Aerodynamik und StrÃmungstechnik | Institute of >> Aerodynamics and Flow Technology >> Abteilung Hubschrauber | Department Helicopters >> >> Lilienthalplatz 7, 38108 Braunschweig, Germany >> Tel : +49 (0)531 295 3306 >> >> >> > > Ticket Details > =================== > Ticket ID: KSI-560385 > Department: Support netCDF Java > Priority: High > Status: Open > > > > Ticket Details > =================== > Ticket ID: KSI-560385 > Department: Support netCDF Java > Priority: High > Status: Open > Link: > https://www.unidata.ucar.edu/esupport/staff/index.php?_m=tickets&_a=viewticket&ticketid=18590 Ticket Details =================== Ticket ID: KSI-560385 Department: Support netCDF Java Priority: High Status: Open
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.