Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Code optimization
Date: Thu, 23 Aug 2007 13:42:51 +0000 (UTC)
Organization: Boston University
Lines: 44
Message-ID: <fak2sr$arg$1@fred.mathworks.com>
References: <fajmoa$3nv$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1187876571 11120 172.30.248.38 (23 Aug 2007 13:42:51 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 23 Aug 2007 13:42:51 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 844160
Xref: news.mathworks.com comp.soft-sys.matlab:425201



I am also not entirely sure how the code is supposed to
work. What's the goal of this function, and what are the
types for the inputs, specifically -- i.e. is 'in' a vector
and is 'vw' really a type 'string' or 'char', used as a
function as indicated below, or is it something else?

and then, what is the function vw ...

etc.


"Martin " <macin@o2.pl> wrote in message
<fajmoa$3nv$1@fred.mathworks.com>...
> Dear All,
> 
> I am struggling with my algorithm to work fast enough. Is
> there any possibility to make this work faster?
> Thank you very much for any advice:
> 
> function o = netoutput( vw, in, n )
> % n - number of hidden neurons
> % vw - weights string
> % in - input neurons values
> 
> sIn = max( size( in, 2 ) ); % number of input neurons
> 
> Y = in';
> k = 1;
> j = 1;
> 
> for i = sIn : sIn + n - 1
> 
> tmp = sum(vw( k : k + i -1 )'.*Y );
> k = k + i;
> 
> tmp = exp( 2 * tmp );
> tmp = ( tmp - 1 )./ ( tmp + 1 );
> 
> Y( i+1, 1 ) = tmp;
> j = j + 1;
> end
> 
> o = Y( end, 1 );