Re: [eigen] On a flexible API for submatrices, slicing, indexing, masking, etc.

[ Thread Index | Date Index | More Archives ]

On Fri, Dec 23, 2016 at 9:04 AM, Peter <list@xxxxxxxxxxxxxxxxx> wrote:
Dear Yuanchen Zhu,

Am 22.12.2016 um 17:29 schrieb Yuanchen Zhu:

Regarding API naming and convention, I also much prefer a matlab/STL like syntax of normalized(v) instead of v.normalized(), as well as writing cwise_max instead of cwiseMax, so I also have those aliases in my plugin. But I guess
those are for another thread.

The syntax like v.normalized() allows to chain expressions, and speaking for myself,
I find it very convenient to write long one-liner and I rather prefer

W.row(x).segment(0, M-1).normalize()

compared to

  normalize(segment( row( W, x)), 0, M-1))

where one would always mess with the number of brackets.

my opinion is that we need both, because using free functions is only way to write generic code for both scalar, arrays, and other custom type. E.g.:


could boils done to sign(x) if x is a scalar.

For binary operators, does not reflect that the role of a and b is symmetric, so I agree that dot(a,b) might look better.


Mail converted by MHonArc 2.6.19+