How to store a matrix of values and pick out certain elements and compute the difference?
This application does seem to be pushing the limits of the official software provided by LEGO. If you are interested in C/C++ (or any other programming language), check out http://www.ev3dev.org.

I like to say that ev3dev is not firmware since it runs from a microSD card and is not loaded into the flash memory on the EV3. Nevertheless, it is an alternate operating system for the EV3 with the goal of being able to program in any language that you like. You can find a list of existing programming libraries here.