[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: oct file: multiply a matrix by a vector
From: |
David Bateman |
Subject: |
Re: oct file: multiply a matrix by a vector |
Date: |
Sat, 02 Jul 2005 19:28:18 +0200 |
User-agent: |
Mozilla Thunderbird 0.8 (X11/20040923) |
To reduce the number of cache misses you should traverse the matrix in
the way it is stored in memory. Octave uses Fortran conventions for the
storage and so you should reverse the for loops like
for (int j=0; j<mat1.cols(); j++)
{
double val = mat2(j)
for (int i=0; i<mat1.rows(); i++)
mat1(i,j) /= val;
}
this should give you a significant speed increase...
D.
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax)
91193 Gif-Sur-Yvette FRANCE
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
-------------------------------------------------------------
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
-------------------------------------------------------------