-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array mods #113
Array mods #113
Conversation
that is allocated but not currently needed. An example would be if adding a Matrix of data onto a Cube. 2) Added "typedef T ElementType;" so that templates using an array can have access to the element type. (STL data structures usually do this).
I have a few comments. They have to be addressed in the code.
|
Reopening the pull request, so that improvements can be made in the existing pull request. |
Response to Ger's comments above: I have a few comments. They have to be addressed in the code.
|
Hi Jim, Thanks for the changes. I still think copyDataIfNeeded should be removed. The argument promises to I do not agree data_p is used a lot. In fact, about everything could be Now there is a test on nrefs()==1, I think the test on isContiguous makes Ger On Mon, Jun 15, 2015 at 7:24 PM, Jim notifications@github.com wrote:
|
Maybe I should change the name to copyIfResizing. My use case is if I can see where a user who radically changes shape might be confused Maybe there needs to be two different methods with slightly different On 06/16/2015 12:56 AM, Ger van Diepen wrote:
Jim Jacobs phone: 835-7235 |
…Base with needed template-specific info passed in as parameters.
and extend. The first method promised nothing about the data contained in the array while the second method always preserves it.
Created a new method, extend, which only allows changing the last dimension. The new method always preserves the relevant portion of the data. The old now method offers no guarantee about the underlying data. This allows removing the "copyIfNeeded" parameter and provides a clearer set of semantics for each call. The same ArrayBase method does the bulk of the work for both methods so the change is only to improve the quality of the Array API. |
I see your use case. But adding an element to another axis than the last But having a function extendArray also sounds very good to me. Do you On Wed, Jun 17, 2015 at 7:34 PM, Jim notifications@github.com wrote:
|
// Perform an exact resize | ||
|
||
resize (newShape, copyDataIfNeeded); | ||
resetEnd = False; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think setEndIter needs to be done by the caller when the array is resized.
Actually I use both aspects of the functionality, although the "extend" I think by splitting it into one call that reforms it to allow storage Maybe the "extend" method could be called "adjustLastAxis". "Extend" On 06/22/2015 12:12 AM, Ger van Diepen wrote:
Jim Jacobs phone: 835-7235 |
I sympathize with changing extend to a name that better covers the On Tue, Jun 23, 2015 at 8:04 PM, Jim notifications@github.com wrote:
|
The name change seems like a good idea. I was having the ArrayBase method return a bool to indicate to the On 6/23/2015 11:59 PM, Ger van Diepen wrote:
Jim Jacobs |
Issue #111: Added the capacity feature making it possible to resize without acquiring memory.
Finalized issue #111 |
you shouldn't merge PR's with failing travis tests, casacore now fails to build:
|
Fixed the error in tArray.cc. Probably needs to be repoened and remerged after travis passes on it? |
@JimNrao Could you just fix it on the master branch? |
I don't think you can add to an already merged PR, please make a new one with the fix. |
A new PR is indeed better, I'll merge it once it passes travis. |
I agree. I hadn't paid enough attention to it. A good lesson. On Thu, Jun 25, 2015 at 4:49 PM, Julian Taylor notifications@github.com
|
Modified Array object by adding a new method reformOrResize. This will allow an array with a large amount of memory allocated to change shape without forcing the memory to be reallocated.
Addted ElementType typedef to allow template users of Array to determin the element type; for example:
template
void f (T & x){
T tmp = x (0);
// etc.
}