SourceForge logo
SourceForge logo
Menu

Re: [matplotlib-devel] irregularly spaced grids and imshowm: PATCH for bilinear interp

From: Christopher B. <Chr...@no...> - 2008年08月28日 18:46:55
Michael Droettboom wrote:
> I think we want to use std::vector where possible for new code, and 
> convert as we go through old code. Manual malloc/free is just too error 
> prone. (We're forced to do some by interfacing with Python, but it 
> should be kept to a minimum).
My understanding is that this is exactly the issue -- with std::vector 
and friends you can't both get the data pointer and create a vector with 
a data pointer, which would be what you'd want to do to interface 
efficiently with numpy arrays.
I've been looking for a way to address this problem, but my C++ is 
pretty week. maybe smart pointers and/or other boost classes could help.
I do have an idea, though. The goal is a set of classes for working with 
data that are convenient to use with pure C++, but also play with numpy 
arrays.
I imagine a simple vector/array set of classes build on top of a simple 
object: a reference counted data block. This data block object would 
simply hold a pointer to a block of data, maybe know how large it is, 
maybe know what type the data is, and hold a reference count. when that 
count drops to zero it deletes itself.
The vector/array classes built on top of it would use the data block to 
store their data, and increment/decrement the reference count as need 
be. This would allow them to share data, have one array that is a subset 
of another, using the same data block, etc.
It should be easy to build numpy arrays from a system like this.
Ideally (but I'm not sure how), the data blocks reference counting 
system could be integrated with Python's, so that when a numpy array was 
constructed from one, its reference count would be managed by python as 
well as your C++ code.
But maybe that's all just too much work...
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /