MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Thread function over matrix elements?


Hi,

Map[f,mat,{2}]

??
Regards
  Jens

"ben" <benjamin.friedrich at gmail.com> schrieb im 
Newsbeitrag news:efacnv$1v0$1 at smc.vnet.net...
| Dear all,
|
| how do I thread a function over all elements of 
a matrix?
| This piece of code works, but I doubt its the 
way i am supposed to do
| this
|
| mat=Table[i+j,{i,0,2},{j,0,2}]
|
| Map[Map[f[#]&,#]&,mat]
|
| I tried
|
| Map[f[#]&,mat,2]
| Apply[f[#]&,mat,2]
| Thread[f[mat]]
|
| but they give weird results.
|
| Cheers
| Ben
| 



  • Prev by Date: How to remove just the outermost braces of a list?
  • Next by Date: Re: Mapping Functions That Take More Than One Argument
  • Previous by thread: Re: Thread function over matrix elements?
  • Next by thread: Re: Thread function over matrix elements?