Vector vs. list

User 1867 | 5/7/2015, 5:56:26 PM

Flex_type has a recursive list type and a "vector of doubles" type and both can fit in SFrame columns.

I have an array of doubles that I want to associate with each of my vertices.

What is the difference between having a "recursive list type" of type list<double> and using the "vector of double" types in terms of representation and performance? It seems like the "vector of double" is actually an SArray, is that right? My array is not very big. My triple_applys need random access to the list elements which I know SArrays may not be ideal for. Is there one type of array or another that is better than this?

Also, it seemed that I was able to access elements of the vector of doubles inside a triple_apply, but the recursive list type access didn't work for me.

Thanks as always.


User 91 | 5/7/2015, 6:07:41 PM

The recursive list type can store anything i.e it can be [0, "foo", {"foo": 1}, ["foo", "bar", 1]} while the vector of doubles is only numbers i.e [0, 1, 2, 3].

An SArray is an entire array of flexible types (of a fixed type) i.e an SArray of vectors would be an array where each element is an array in itself.

Could you share your code with us, we will be able to look into why the list access isn't work. I think I have a hunch about why, but I would like to give you more specific guidance.

User 1867 | 5/7/2015, 6:22:17 PM

Sure, thanks a lot. The below is not my actual code, but a simplified example that also breaks. This is in the SDK. pretend that ["x"] column was initialized in the Python code to be a list of 6 0 values. The .apply() changes that to be a list vs. vector, and then it crashes in the triple_apply.

Edit: Because i had trouble posting the code here, I moved it over to Pastebin.