How to handle ragged-list type argument in LibraryLink?

Given that I have a ragged list as below,

raggedList = {U1, U2, ..., Un}


where, ui is a sublist($i=1,2,\cdots,n$) and their length are distinct. For example,

raggedList =
{{0.25, 0.25, 0.5, 0.5, 0.75, 0.75, 0.8},
{0.21, 0.25, 0.3, 0.6, 0.7, 0.8},
{0.25, 0.3, 0.7, 0.8};


Namely, raggedList is not a tensor. For this case, obviously, I cannot use MArgument_getMTensor(Args[0]) to get that input.

• You can use MathLink to pass such arguments. This is easy but slower than MTensors. Alternatively, you can flatten the array, then pass both its elements and the length of each sublist separately. This will be faster. I have used both approaches with LibraryLink. – Szabolcs Jul 31 '16 at 13:40
• Will this representation help? – happy fish Jul 31 '16 at 14:23
• Yes, that's what I meant. – Szabolcs Aug 1 '16 at 8:00

• That is not true, or at least not true on all platforms. On my machine I get a LibraryFunction::cfta message. Using things like Infinity appears to work sometimes, but in reality is not reliable and will result in random weird behaviour. – Szabolcs Aug 1 '16 at 8:10