multidimensional vector with 9 dimension

I want to create a 9 dimensional vector for my computer vision project. I have learned how to create 2 and 3 dimensional vectors with its size initialized but don't know how to make a 9 dimensional vector. I created 3d vector as;
vector<vector<vector<int> > > p(5,vector<vector<int> >(3,vector <int>(2,4)));
p[d1][d2][d1d]=x;
cout<<p[d1][d2][d1d]<<endl;
Now i need similar expression for 9d vector, but don't know how.
Last edited on
well my code outputs lot of p0 points belonging to same object and same index which has got same p1 and p2 at same distance d1,d2,d1d or say i want to save an index of point int ip0 in a vector of whose elements are the points p1 and p2 of given rgb color at distance d1,d2 from p0. the main reason of using this vector is so that whenever a machine choose any point p0, than p1 at distance d1, than p2 at distance d2 with given color values of p1 and p2, it will easily extract that among the lot of already saved objects which point of which object has got similar configuration i.e pattern in its body. so that pattern matching will be fast and any 3d object will be recognized from the 2d color vision. i.e if machine analyses few points from given image and uses their relative distances and colors than easily machine will analyze which object has got such pattern and hence recognize that object. it maybe little new concept in computer vision. so when we do : p[4][3]5][255][0][0][255][0][0].. it will give all the names and index of point which has got such pattern or say all those point which color is green, which has got red pixel at distance >4 mm, and another red dot at >3mm from p2 and >5mm from p0. at first it will give lots of points which belong to certain object but as we continue this process and keep on filtering after some iteration only one objects name will remain which given point p0 was chosen from. so thats the theory.
Last edited on
I confess that I really didn't understand much of that explanation, but from what little I do follow of it you appear to require ONE-DIMENSIONAL OBJECTS with approx 9 data members (index + x,y,z + r,g,b, + couple of other pieces of information?). That is not the same as a 9-dimensional vector.

Any chance of a simplified explanation of what you are trying to do?
Well their is an integer belonging to a particular values of d1,d2,d1d,rp0,gp0,bp0... now somehow when the same values of d1,d2 is encountered by computer it has to show that integers which it points to. eg. p[3][4][2]...=3; this values of d1,d2.. are analyzed in the color image by computer, so whenever p[3][4][2].. is found the integer which it is pointing should be shown. we have already saved particular value of integer for particular values of d1,d2.. i tried array but an error is showing that size is too big.
Well, if you want to use brute force you could try tuple<int, int, int, int, int, int, int, int, int> (assuming all 9 elements are int's) and then place these tuples in a vector or some other container but I'm not sure it would be a very efficient solution. Try and explore more on the lines of what, I think, @lastchance is alluding to above, viz. using these 9 data points as data members to instantiate struct or class objects.

Also, if/when you reply can you please break up your text into smaller paragraphs and/or bullet points? Your written format is very difficult to read, and understand, as it stands and remember the more effort you put in explaining your issues clearly the better the quality of responses you're likely to fetch. Thanks!
Ok i got how i can do it. By using dynamic memory allocation method i can easily create any dimension of array. eg.
#define p0(i,j,k,l) (array[100000000])
double * array = (double *)malloc(100000000*sizeof(double));
cin>>p0(3,4,5,6); // to write data
cout<<p0(3,4,5,6); // to read data
Topic archived. No new replies allowed.