help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HELP with octave-to-cpp conversion


From: grg
Subject: HELP with octave-to-cpp conversion
Date: Wed, 23 Feb 2011 01:31:45 -0800 (PST)

Hi there,

I have been working for a while on a very computationally demanding
optimization using octave.
I have optimized my code as much as possible (I think), minimizing the use
of for loops, defining vectors outside loops, etc.
 
Recently, however, I had to include a new function that slowed down
dramatically (x10) the execution time.

I was wondering if there is any good soul out there willing to help me
converting this function into C++, which, if I understood right should speed
up the execution of the function.

I have no knowledge at all of C++, that is why I would need help.


Here is the relatively simple function:

function qc_acs=Qc_acs(D, lambda_vac, cost)

    global theta x Qscat S11 sin_theta theta0_acs 

    lambda=lambda_vac/1000/1.339;    % [um]  
    XX=D*pi/lambda;
    [m n]=size(XX);
     
    fm=find(x>max(XX),1);

    Qc = interp1( x(1:fm), Qscat(1:fm), XX, 1);
    S_11 = interp1( x(1:fm), S11(1:fm,:), XX, 1);  
     S_11_sin_theta= 2*pi*S_11'.*sin_theta; 
     S11_fwd_ACs=trapz(theta(theta0_acs:end,:), S_11_sin_theta(
theta0_acs:end,:))';

    qc_acs=Qc.*S11_fwd_ACs;

endfunction





Any help will be greatly appreciated
thanks a lot in advance

Cheers,
grg
-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/HELP-with-octave-to-cpp-conversion-tp3320720p3320720.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]