help-octave
[Top][All Lists]
Advanced

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

liboctave Matrix class speed questions.


From: Douglas Eck
Subject: liboctave Matrix class speed questions.
Date: Mon, 10 Dec 2001 11:39:13 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.6) Gecko/20011120

I'm trying to speed up my neural network code a bit and am reaching
the limits of my own knowledge of liboctave internals and good
c++ programming. (My knowledge of bad c++ programming has no limits).

I have a laundry bag of questions:

1) If you know the data is one-dimensional, are RowVectors
and ColumnVectors faster than Matrices?

2) Are pointers in general faster than references?

3) Is inserting a Matrix of the same size faster than
using "=". That is, assuming a and b are the same size, which is better:
a.insert(b,0,0);
a=b;

Here is a snippet of code from the forward pass of the network. I don't really
care how ugly this inner loop is... I'd use pointers, pull out data() from the
Matrix, whatever. But I'd like it to be as fast as possible.

There's no real reason to understand the semantics of the snippet (i.e. "what 
on earth
is cellToBlockMat")... the code works. I just want to manipulate the matrices
as fast as possible. That includes basic matrix arithmetic as well as calling
mapping functions.

netsFGate=wgtsFGate*actsP + wgtsPeepFGate*statesP;
actsFGate=netsFGate.map(logc);
netsCell=wgtsCell*actsP;
squashCell=fCell.map(logc);
states=product((cellToBlockMat*actsFGate),statesP) + 
product((cellToBlockMat*actsIGate),squashCell);

Any hints?

Cheers,
Doug



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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