Reputation: 387
I am going through the documentation of Eigen library at http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
and I found the example given below
I could not understand the difference between v(1) and v[1] usage as one uses square bracket and other uses a different one.
What difference does it make ?
Thank you.
Upvotes: 1
Views: 4425
Reputation: 137770
[1]
is the same as (1)
when it's supported, but parens support multiple dimensions like (1,2)
and brackets are only available for one-dimensional Vector
objects.
For uniformity, it's usually better just to stick with ()
parens.
These are for general access. For initialization in particular, see also the <<
… ,
operator.
Upvotes: 2