I have a simple program that takes a .csv file and produces a vector. I am then hoping to manipulate this vector in many different ways.
The matrix is linked to a list of tasks, which I am changing the order of in the hope of finding the most efficient system.
I am struggling with swapping the columns in a Vector, rather than just the rows, and also with counting only the upper triangle parts of the vector, i.e all the numbers on the first row, all but one of the numbers on the second row, etc.
I suppose I want to do a countif function, based on whether the column number is greater than the row number and if the value is greater than 1, just not sure how to code that. I can do the non zero bit its just the column number being greater than the row that im struggling with
I currently have a very rudimentary solution that adds all the numbers in the range i want, literally an int = csv+csv..+csv+...+csv[n][n]. I was just hoping there was a much more efficient way to do this process
If every row has the same number of fields, perhaps it would be a good idea to switch to some matrix library (such as boost.ublas, or even boost. multi array) - they have easy ways to access individual column. Even std::valarray has one.