0

in eigen, the construct:

(R.array() < s).select(P,Q); 

works when either one or both of P,Q are vectors (of the same length as R). But as soon as both of them are scalars, I get a compilation error.

My question is; is the behavior of select in the presence of two scalars a way for eigen to warn me that there are more efficient constructs? If so, what are they?

user189035
  • 5,589
  • 13
  • 52
  • 112

2 Answers2

6

You can workaround by using VectorXd::Constant(size,value) for one argument.

ggael
  • 28,425
  • 2
  • 65
  • 71
  • 1
    yes, that's what I did. But I was wondering if by throwing a warning eigen was 'trying' to tell me that I'm not using the best construct for the job... – user189035 Jan 29 '14 at 19:58
  • 1
    Nope, it's just that this shortcut does not exist. – ggael Jan 29 '14 at 19:59
0

Please ref the definition of select() in Eigen: http://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#a65e78cfcbc9852e6923bebff4323ddca

enter image description here

Gavin Gao
  • 309
  • 3
  • 6