help-octave
[Top][All Lists]
Advanced

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

Re: Problem interpreting Matlab code


From: Olaf Till
Subject: Re: Problem interpreting Matlab code
Date: Thu, 26 May 2011 10:57:29 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Thu, May 26, 2011 at 12:30:40PM +1000, Terry Duell wrote:
> Hullo All,
> I am trying to port some Matlab code to Octave, and have a problem
> that is a bit beyond my knowledge.
> 
> The original Matlab code
> --------------------
> % conjugate gradient
> x = minres(@compute_Ax_kernelEst,b(:),1e-4,maxiters,[],[],K(:),ang,
> stdnoise,filts, h, w, numSampOrientation);
> ...
> function Ax = compute_Ax_kernelEst(K,ang, stdnoise,filts, h, w,
> numSampOrientation)
> -------------------
> I found a minres function, which, on the surface looked pretty much
> like the Matlab minres doc description;
> function [x,flag,relres,itn,resvec] =  minres(A,b,rtol,maxit)
> 
> but this all caused Octave to throw an error re the function handle
> being passed to minres.
> I have tried to interpret how to best implement this in Octave and
> tried the following;
> 
> %TLD changes to avoid passing handle to minres
> ATLDx = compute_Ax_kernelEst(K(:),ang, stdnoise,filts, h, w,
> numSampOrientation);
> % conjugate gradient
> %was x =
> minres(@compute_Ax_kernelEst,b(:),1e-4,maxiters,[],[],K(:),ang,
> stdnoise,filts, h, w, numSampOrientation);
> [x,flag,relres,itn,resvec] = minres(ATLDx,b(:),1e-4,maxiters);
> 
> but this now causes errors in minres.
> Can anyone please say if my work-around to avoid passing the
> function handle makes sense?

It makes no sense, you are passing a single result instead of the
matrix to compute results, also your arguments to compute_Ax_kernelEst
seem weird.

I think you could use the function 'pgmres' of the package
'linear-algebra' of Octave-Forge. pgmres has a slightly different
interface than minres, you should look at the code in addition to the
help text. I don't understand the interface at first glance (restart
argument), but maybe the author Carlo could give you a tip; I have
CCed him to draw his attention to your mail.

Olaf


reply via email to

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