| Re: [eigen] Scalar operation | 
[ Thread Index | 
Date Index
| More lists.tuxfamily.org/eigen Archives
] 
在 2015 二月 9 週一 13:22:08,Christoph Hertzberg 寫道:
> Am 09.02.2015 um 09:53 schrieb Matwey V. Kornilov:
> > Hi,
> >
> > What is the recommended way to perform Y = a * X + b ? where a and b are
> > scalars and X is Matrix or Vector. Now I use unaryExpr, but think that
> > it is odd.
> 
> I'm afraid, I don't understand your question. Why not just write
>    Y = a * X + b;
Addition between a matrix and a scalar is invalid.  I'd write
    Y.array() = a * X.array() + b;
Cheers,
Chen-Pang