Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c++ pivot table implementation

Similar to this question Pivot Table in c#, I'm looking to find an implementation of a pivot table in c++. Due to the project requirements speed is fairly critical and the rest of the performance critical part project is written in c++ so an implementation in c++ or callable from c++ would be highly desirable. Does anyone know of implementations of a pivot table similar to the one found in Excel or open office?

I'd rather not have to code such a thing from scratch, but if I was to do this how should I go about it? What algorithms and data structures would be good to be aware of? Any links to an algorithm would be greatly appreciated.

like image 392
shuttle87 Avatar asked Dec 25 '11 12:12

shuttle87


1 Answers

I am sure you are not asking full feature of pivot table in Excel. I think you want simple statistics table based on discrete explanatory variables and given statistics. If you do, I think this is the case that writing from scratch might be faster than looking at other implementations.

Just update std::map (or similar data structure) of key representing combination of explanatory variables and value of given statistics when program reading each data point.

After done with the reading, it's just matter of organizing output table with the map which might be trivial depending on your goal.

I believe most of C# examples in that question you linked do this approach anyway.

like image 159
Tae-Sung Shin Avatar answered Oct 19 '22 03:10

Tae-Sung Shin