Re: put some elements to zero
- To: mathgroup at smc.vnet.net
- Subject: [mg101470] Re: [mg101438] put some elements to zero
- From: Tomas Garza <tgarza10 at msn.com>
- Date: Wed, 8 Jul 2009 07:10:11 -0400 (EDT)
- References: <200907071146.HAA27467@smc.vnet.net>
You might try mat/.{x_=2C y_}->{x=2CIf[y<x0=2C 0=2C y]} Not too bad=2C is it? mat=Table[{RandomInteger[{0=2C99}]=2CRandomInteger[{0=2C99}]}=2C{100000}]= =3B AbsoluteTiming[mat/.{x_=2C y_}->{x=2C If[y<25=2C 0=2C y]}=3B] {0.2652000=2CNull} Tomas Garza > Dear All=2C > I have a matrix with only two columns and many rows. For instance > {xi=2Cyi}. > For those xi<x0=2C I would like to set yi=0. > I can only think of a very inefficient loop... > > thanks > -Luigi- >
- References:
- put some elements to zero
- From: Luigi B <L.Balzano@gmail.com>
- put some elements to zero