What is the most efficient way to enumerate vertices of k dimensional hypercube in C++?
Basic Question: I have a k dimensional box. I have a vector of upper bounds and lower bounds. What is the most efficient way to enumerate the coordinates of the vertices? Background: As an example, say I have a 3 dimensional box. What is the most efficient algorithm / code to obtain: vertex[0] = ( 0, 0, 0 ) -> ( L_0, L_1, L_2 ) vertex[1] = ( 0, 0, 1 ) -> ( L_0, L_1, U_2 ) vertex[2] = ( 0, 1, 0 ) -> ( L_0, U_1, L_2 ) vertex[3] = ( 0, 1, 1 ) -> ( L_0, U_1, U_2 ) vertex[4] = ( 1, 0, 0 ) -> ( U_0, L_1, L_2 ) vertex[5] = ( 1, 0, 1 ) -> ( U_0, L_1, U_2 ) vertex[6] = ( 1, 1, 0 ) -> ( U_0, U_1, L_2 )