Example

Hello everybody,

i have an algorithm which need as an input lattice basis b_1,...,b_2 ]in Z. The programm starts with

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;
// determine dimension n = Number of vectors
const int n =3;
// dimension of vectors b, determine element R^d
const int d = 3;
// declare matrix, vectors level
int sa_matrix[d][n];

My question is: How can i define a matrix

2 4
3 5

Is it n=2, d=2,4,3,5 ?

Hope someone can help me please.


regards

tundrablume



n and d are 3, so sa_matrix is a 3 x 3 array, which you can treat as a 3 x 3 matrix.

If you want a 2 x 2 matrix implemted as a 2D array, you'll need to declare a 2 x 2 array. For example:
 
int 2darray[2][2] = { { 2, 4 }, { 3, 5 } };
@kbw

You cannot declare/use variable with name starting with digit.
int twodarray[2][2] = { { 2, 4 }, { 3, 5 } }; is proper syntax.
Topic archived. No new replies allowed.