Re: [eigen] How can we do in-place calculation for log(x)
• To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
• Subject: Re: [eigen] How can we do in-place calculation for log(x)
• From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
• Date: Thu, 30 Jul 2020 16:30:31 +0200
• Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=5eHnsFGk4XQyfJhwAd0ruhbhNIMnGdrhE/+n/b101fs=; b=VXAGbtLfBeOXqYVPJPQLXoxBSxBKeltFbdo2+qH/oMQokJ20sasFXIIEQL648C+UYt /OukI8sRMN1PYnEtVoYD/65ePpmCTBIttnoeD2A7w7KD/vczfig5zL+CsbtRxTdYjLa5 myqYueHwzd7bp5x9cnNZy9kwt2wtqYwhPGC/yjpMVY+Wjj46HbhKZNZ5I9zGHYwgFsnI 0Io7T4F18PGKmD/jFa7Rk2k722UzRrO/434lJv2QMdpHX7aYMNgjhdV2iNF0VlT1l84E Qke0vjHjpV17sRXWxq44q6q8MMPVo4LMRXRduK3vpidCxOI6sxyS6k+/blwo26Uq9ZwL 495Q==

Hi,

yes, with "x = x.array().log()" the operation is done inplace, no temporary.

Gaël

On Wed, Jul 29, 2020 at 12:22 AM Hung Dang <hungptit@xxxxxxxxx> wrote:
Hi,

I need to compute x = log(x) in-place, with x can be either a vector or a matrix. This task can be done using either a simple for-loop or x = x.array().log(). The second solution is vectorized, however, I am not sure if it can be done in-place. Is there any better solution?

Regards,
Hung

 Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/