help-octave
[Top][All Lists]
Advanced

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

Can .oct files do in-place matrix operations?


From: Dirk Laurie
Subject: Can .oct files do in-place matrix operations?
Date: Tue, 12 May 1998 18:56:17 +0200 (SAT)

I have some old Matlab 3.5 files in which row and column rotations
are done in-place using .mex files.  I.e. the .mex file for
  rotate(A,ij,R,job)
does the equivalent of
     A(ij,:)=R*A(ij,:);   (job=1)
or   A(:,ij)=A(:,ij)*R;   (job=2) 
or   both (job=3), 
where R is a 2x2 matrix and ij is a two-component index vector.

This speeded up my program by about 50%, I recall.

Now I get the impression that Octave will not allow me to do
this by an .oct file.  It seems to require my returning the
changed A as an octave_value, which as far as I can make out
involves two full matrix assignments: one to make the local
copy of A that I modify, and one to assign it back to my
original matrix.  Since rotation is an O(n) operation I will
probably not gain by doing this, or am I wrong?

Dirk



reply via email to

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