in

.NET Opensource

Community for opensource projects by Christoph Rüegg

Sets and Actions

Last post 03-05-2008 15:10 by Christoph Rüegg. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-12-2008 16:39

    Sets and Actions

    Small question for anyone who cares:

     Sets have the ForEach function, which takes an Action.  I've been dinking around trying to see how to perform a Cosine of a Set<Complex> using the ForEach function.  Utter failure so far.

     Is this even the appropriate way to go about it?  Or is there a better way to make an 'array' of Complex numbers and perform inline operations on them?  Think Matlab style array calculations...

    Stuff like: (totally random Matlab code, just for example's sake)

    t=0:6e-6:(1024-1)*6e-6;

    f= 1e6;

    power(1:1024) = sqrt(10^(-30/10) * 50 * 0.001);

    result = powers.*cos(2.*pi.*f.*t);

     

    Thanks-

     

    j.

    Filed under: , ,
  • 03-05-2008 15:10 In reply to

    Re: Sets and Actions

    For the cosine you could use the ConvertAll Method, but that creates a new list instead of doing it inplace. ConvertAll doesn't work for the matlab ".*" operation though. The Matrix type supports it with the ArrayMultiply method, but has no method similar to ConvertAll. But we can certainly add such support for such scenarios.

Page 1 of 1 (2 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems