Re: [eigen] find command or equivalent |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] find command or equivalent
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Fri, 3 Sep 2010 09:19:45 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=nDp1DgueWLQ0rc894U9zDfykL0aKPNgiX9yb/qzODY4=; b=SeO8rlGhvN4oA0T1xOAgvLI0/CJCRKd2veZefGZjxmGBkVPliezHpkJZjyNsI7ABsp TLN5VLk+14XZa0GF8rOtMqq8V3i16zyfHyHbnbWMQ6LXSUAXodSBCMB2QYxZpNK6xNij Z0Nr6o9SjvmykNZSq+zketQo99O+U+o9Ehe4Y=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=pUZSuCJ20Sop93MPAclTA/NQeLXwLVpZEdlTVgzg3t7w+PjCGlvfdQwM/twZgKBNoe oe6vOdMNApAleOIuxVYiT6J7x76VsGoAlBjLGDHa8S1Zh+Gdg6YONYRMGOGMuxeF48N8 pM5C2fAX0lqhg40TH6TSnuLcR9IrXvR6fz+IA=
you can do:
A = (A.array()<0.0001).select(0,A);
where the "select" method mimics the c++ ?: operator.
gael
On Fri, Sep 3, 2010 at 6:40 AM, Suresh Kumar
<suresh.amritapuri@xxxxxxxxx> wrote:
> Hi
> I want to replace all elements of a matrix, which are less than a threshold
> by zero. How to do it without writing a nested for loop?
> I am looking for something like this in matlab. A(A < 0.001) = 0 where A is
> a matrix.
> Thanks
> suresh
>
> --
> R Suresh Kumar,
> http://www.ee.ucr.edu/~sramachandranna
> --
> Dhyaana–moolam Guror murtih
> Puja-moolam Guroh padam
> Mantra – moolam Guror vakyam
> Moksha – moolam Guroh krpa.
>