Timeline for Internal`Bag inside Compile
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 10, 2014 at 11:23 | comment | added | Jacob Akkerboom | Faysal, thank you for the update. I probably should have notified you that I asked a new question about this, maybe you saw it already. | |
Mar 4, 2014 at 10:05 | comment | added | faysou | I've updated the answer, feel free to add any other example you may find relevant for the use of this third argument in Compile. | |
Mar 4, 2014 at 9:57 | history | edited | faysou | CC BY-SA 3.0 |
added 246 characters in body
|
Mar 3, 2014 at 17:32 | comment | added | faysou | I'll find a better example and will update the answer. | |
Mar 1, 2014 at 16:21 | comment | added | Oleksandr R. | For the record, I strongly feel that this answer is wrong and misleading in this context, i.e. I fully agree with @halirutan's reasoning. I don't really want to downvote you, because you're right that this is what the documentation claims. But I don't want people to be misled either. | |
Feb 28, 2014 at 13:13 | comment | added | Jacob Akkerboom |
Faysal, do you know any examples where adding a third argument to Compile has any effect? Would you consider updating your answer? I feel there should probably be a separate Q&A about this, but I was curious if you knew more.
|
|
Jan 28, 2012 at 21:02 | comment | added | halirutan |
But the simple example Compile[{}, Module[{y}, y], {{y, _Real, 1}}] fails. Indeed, it seems this type specification at the end is completely ignored and your example only works because of the y={} and because you chose type Real . Try this Compile[{}, Module[{y = {}}, AppendTo[y, 1]], {{y, _Integer, 1}}] and you see, that the type is {Real} although I specified Integer and appended an integer.
|
|
Jan 28, 2012 at 19:20 | comment | added | faysou | The y={} is just for this example, you don't need to always initialize your local variable when you declare it if you specify the type. I would be surprised that you could have a type related to bags, the only official ones are Integer, Real, Complex, and True | False. In such Mathematica experiments I don't know anything better then try and fail ... but never fail to try ! | |
Jan 28, 2012 at 14:37 | comment | added | halirutan |
+1 Although I new this, I never got this running with the declaration of local variables. I didn't know that you have to put y={} together with the type specification. How would I use this to define a Bag of integers, or a Bag of Bags of integers? I would have to know the true internal structure of the pattern or not?
|
|
Jan 28, 2012 at 8:32 | history | answered | faysou | CC BY-SA 3.0 |