« first day (1621 days earlier)   

1:44 AM
@Szabolcs Thanks for your explanation. However, when m is a tensor like this:
{{{0, 0, 0}, {0, 1, 0}, {0, 2, 0}, {0, 3, 0}}, {{1, 0, 0}, {1, 1, 1}, {1, 2, 1}, {1, 3, 0}}, {{2, 0, 0}, {2, 1, 1}, {2, 2, 1}, {2, 3, 0}}, {{3, 0, 0}, {3, 1, 0}, {3, 2, 0}, {3, 3, 0}}}
How to calculate the flattened index of m[[i, j, k]]? Or in this case, is there more convenient(rather than use *, a pointer) method to deal with it?
 
 
5 hours later…
6:23 AM
@ShutaoTANG Yes, check LibraryLink/tutorial/Reference#326657761. You can use MTensor_getReal. But it's cumbersome and probably slow.
The way this is meant to be done is that you compute the index into the flat storage yourself. Get the size of the tensor once, with MTensor_getDimensions, then use it repeatedly for index calculations.
 
 
2 hours later…
8:15 AM
@MichaelE2 Thanks for your input. I reported this and included your version of M and OS X as well.
 
 
4 hours later…
12:03 PM
0
Q: Computational mathematics vs Applied Mathematics?

physicsmajorHello Mathematica community, I have a question about a choice that I need to make soon. I'm not sure if this is the right place to ask, but I am asking here because Mathematica falls under Computational mathematics and I would like some opinions from the community. So I am double majoring in phys...

 

« first day (1621 days earlier)