Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: InputStream in version 3 vs version 4

  • To: mathgroup at
  • Subject: [mg18818] Re: InputStream in version 3 vs version 4
  • From: "David Bailey" <dave-bailey at>
  • Date: Thu, 22 Jul 1999 08:19:32 -0400
  • References: <7n1313$>
  • Sender: owner-wri-mathgroup at

ELLIS, Luci wrote in message <7n1313$bda at>...
>Failing this, can anyone suggest a robust way to turn a list of functions
>and a matrix of data into a matrix where the elements of each row are the
>elements of the original matrix transformed by the corresponding function?
>That is:
>functions= {f[#]&, g[#]&, h[#]&}
>data = {{data[1,1],data[1,2],data[1,3]},{data[2,1],data[2,2],data[2,3},
>output= {f[data[1,1]], g[data[1,2]], h[data[1,3]]}, {f[data[2,1]],
>g[data[2,2]], h[data[2,3]]}, {f[data[3,1]], g[data[3,2]], h[data[3,3]]},
>{f[data[4,1]], g[data[4,2]], h[data[4,3]]}, {f[data[5,1]], g[data[5,2]],
>I've tried various combinations of Map, MapThread, Thread and Inner without

First, we can neaten up your list of functions, but you could still use pure
functions if you need them of course.

functions = {f, g, h};

Now we define some data:

ss = Array[a, {5, 3}]

{{a[1, 1], a[1, 2], a[1, 3]}, {a[2, 1], a[2, 2], a[2, 3]}, {a[3, 1], a[3,
    a[3, 3]}, {a[4, 1], a[4, 2], a[4, 3]}, {a[5, 1], a[5, 2], a[5, 3]}}

This will apply the functions as you require. There are probably many other
ways of doing this!

Transpose[MapThread[Map, {functions, Transpose[ss]}]]

David Bailey
Salford Software
db at

  • Prev by Date: Re: HDF export
  • Next by Date: Re: ValueBoxes
  • Previous by thread: Re: InputStream in version 3 vs version 4
  • Next by thread: System Modelling with Mathematica