« first day (1835 days earlier)      last day (2655 days later) » 

5:18 AM
@J.M. if you like to open that question that just got closed about intersection of planes, I can post an answer. I thought it was useful to show how to do this in Mathematica. But I leave up to you if you think it should stay closed ;)
 
@KevinDriscoll If it's long enough, prolly ask it on main.
@Nasser Mmm, let's wait for the OP to respond first. If he doesn't, but you still want to post your stuff, why not write a Q&A pair?
 
@J.M. sorry, I do not know what Q&A pair means. I think the question had enough info in it to answer it and I already did, but when I came to post it, it was just closed. Any way, not important, just thought to ask. Thanks.
 
@Nasser I mean, ask and answer a question yourself. If it's neat, why not?
 
@J.M. that is Ok, if the OP really wants an answer, they will come and ask again :)
 
 
5 hours later…
10:51 AM
I feel like I'm missing something basic, help me ;)
0
Q: Components rules from ArrayComponents

KubaWhat is the most efficient way to get component rules from ArrayComponents, so additionaly to ArrayComponents[{"a", "b", "a"}] {1,2,1} I'd like to know: {"a"->1, "b"->2} (or reversed), and the point is that the data is big and I don't want to compare it again to get those relations. Fail...

 
 
2 hours later…
12:42 PM
Is there anyone here who used RawArrays with LibraryLink? @halirutan @BenNiehoff @xslittlegrass ? I am trying to settle on a useful way of integrating them into LTemplate.
 
@Szabolcs Nope, sorry.
 
@Szabolcs I've only just begun playing with LibraryLink, no idea, sorry
What is a RawArray?
 
12:58 PM
@BenNiehoff Basically, it is just a C array of a specific WolframType that you can use directly.
22
Q: How can I work with RawArray?

SzabolcsRawArray seems to be able to efficiently hold integer and floating point data of various sizes. What is RawArray good for? How can we use it?

 
@BenNiehoff It's not documented. The LibraryLink interface was introduced in 10.4. A RawArray is an n-dimensional array that can hold most numerical types you would come across in C. You can't do much with them directly in Mathematica, except convert them to usual numerical arrays.
@BenNiehoff If you were to implement Image or Audio from scratch, you would want to use these to be able to store the data efficiently. We don't need 64-bit floating point numbers to store byte values.
@halirutan @BenNiehoff @xslittlegrass OK, let me ask a different question then. A usual LibraryLink array can be Integer, Real or Complex. But we can have a LibraryFunction which can take or return either of these three. I.e. we can have a generic array where the element type isn't specified. Did you ever need to use these?
 
No, in fact RawArray sounds a lot more like what I need...I just want C arrays of ints
 
In LTemplate I forbid these. With RawArrays we can't specify the element type, they're always generic. But I want to enforce specifying it. When I receive an array in C++, I don't want to have to manually check its type. I want to program in a way that I will always know in advance what type I will get.
 
I'm confused...in the above link you explained that RawArray requires you to specify a type?
 
@BenNiehoff Mathematica's integers are of $SystemWordLength width (i.e. 64 or 32 bit depending on which version of Mma you are using). RawArrays can use integers of any width from 8 bit to 64 bit. But you can't do even basic arithmetic with them within Mathematica. They are only for storage.
 
1:07 PM
ah, I see
I haven't actually started trying to get LibraryLink set up yet...I had most of my algorithms written up in Compile'd functions instead, so I was going to just finish what I'm doing there before porting the code to C
Although it's frustrating because MMA Compile is terrible at encapsulation, and my main algorithm is now about 700 lines long :(
 
@halirutan Are you planning to write up an advocacy for open sourcing the Workbench soon? I will soon write a post on Community about Mathematica and interoperability where I will advocate for open sourcing MathLink.
 
My main issue is I'm working with a lot of arrays...in C I could just pass pointers between functions, and it would be easy to break up the code. But Mathematica does not have any sort of pass-by-reference, so I've had to write code to avoid function calls in order to avoid a massive amount of array-copying in loops
 
@BenNiehoff LibraryLink has pass by reference. If you have a packed array of the correct type, and you don't want to modify it, use "Constant" passing. There's also "Shared" passing which allows modification, but that can cause a big mess ...
When you work in pure Mathematica (not passing between Mathematica and C), you don't need to be concerned with passing large arrays. It uses copy-on-write. Arrays won't be copied until they are modified.
 
Really? Even if a bunch of TensorCopy instructions turn up in the virtual machine code?
 
Ah, you're talking about Compile. I have less experience with that.
 
1:20 PM
yeah, and even "InlineExternal..." doesn't quite seem to do what it says
I seem to remember trying it, and getting a bunch of TensorCopy's
 
If you migrate to LibraryLink, you will have direct control over when copying happens.
 
of course, which is why I am planning to :)
 
2:12 PM
@Szabolcs I never did, no.
@Szabolcs I'm still thinking about it and wanted to let sink my thoughts about this.
For instance, I wanted to do some research about the pros and cons of open-sourcing first, making a list of arguments why it would harm Wolfram to open-source WB.
 
2:35 PM
Something weird:
In[119]:= ClearAll[f]
f[{1, x_} | {2, _}] := x^3

In[121]:= f[{1, z}]
f[{2, z}]

Out[121]= z^3

Out[122]= 3
It appears that x gets an empty value (empty like Sequence[]) and Power[3] evaluates to 3.
 
@Szabolcs I never used the RawArray. But it seems that it has been used extensively in the Neural Network framework in Mathematica. They are used to hold the weights of the neurons, the input output results, and as a bridge to the NDArray in MXNet (NDArray is similar to numpy.ndarray in python but more capable of GPU computations.) It appears that data from and to Mathematica is always converted to RawArray first.
Maybe you can get some ideas by looking at the NDArray implementation at SystemFiles/Components/MXNetLink/Kernels/NDArray.m
 
 
3 hours later…
5:29 PM
@yode - can you clarify your question for me. Are you simply looking for the longest path in the graph? Are you looking for the longest path with no repeated vertices? I don't understand what you mean by "contains as many vertices"
 
6:05 PM
6
Q: 2017 Moderator Election Q&A - Question Collection

Grace NoteMathematica Stack Exchange is scheduled for an election starting next week, January 30th. In connection with that election, we will be hosting a Q&A here for candidates. This will be an opportunity for members of the community to pose questions to the candidates on the topic of moderation. Parti...

 

« first day (1835 days earlier)      last day (2655 days later) »