Warning of complex arguments and Armijo failure?

Hello everyone, Can anyone tell me what does this error mean?
Armijo failure, too many reductions
1.0e+04 *
0 2.6314 0 0 0
0.0001 2.2707 0.0001 0.0001 0.0002
0.0002 1.4105 0.0001 0.0001 0
0.0003 0.3922 0.0002 0.0000 0
0.0004 0.1087 0.0003 0.0000 0
0.0005 0.0368 0.0012 0.0000 0
0.0006 0.0132 0.0010 0.0000 0
0.0007 0.0055 0.0014 0.0000 0
0.0008 0.0053 0.0022 0.0001 0.0003
0.0009 0.0053 0.0007 0.0001 0.0019
Warning: Imaginary parts of complex X and/or Y arguments ignored > In myoz at 203

Answers (1)

Matt J
Matt J on 22 Sep 2014
Edited: Matt J on 22 Sep 2014
Not with any firm authority. You show no code, and the warning message you've shown is thrown by a function myoz() that isn't a stock MATLAB function.
However, it may help to know that the Armijo rule is used in some function minimization algorithms to search for a sufficiently large step downhill along some search direction. It involves trying successively smaller steps until a sufficient descent criterion is satisfied. The warning message seems to say that it has tried many more step reductions than it thinks should be required, and still not been able to satisfy the criterion.
The 2nd warning is letting you know that complex values are being generated somewhere. Since you are presumably minimizing a function, the function should be real-valued, so complex values are probably not what you want.

4 Comments

Here is the code. And can u please say how to solve this error problem
function [h,c]=myoz
%close all;
global L U rho iopt
%iopt = 0; % Hyper-netted Chain
iopt = 1; % Percus-Yevick
%iopt = 2; % Martynov Sarkisov
%iopt = 3; % Soft-Core MSA
%iopt = 4; % Vompe-Martynov
%iopt = 5; % Modified Verlet
%iopt = 6; % Ballone,Pastore,Galli and Gazzillo
n=4097;
eps11=1.0; eps12=0.7; eps22=0.5;
sig11=32.0; sig12=16.15; sig22=0.3;
q1=-12.0;q2=+1.0;
rho1= 0.000843*10^(-4);
rho2=(-rho1*q1)/q2;
beta=0.40093;
Lb= 0.718;
dx = sig11/40; L = (n-1)*dx; r=0:dx:L; r=r';
dt= pi./L;
dt
rho=[rho1',rho2']';
%
%U=elj(r,sigma,epsilon,beta);
U11=elj(r,sig11,eps11,beta,Lb,q1,q1);
U12=elj(r,sig12,eps12,beta,Lb,q1,q2);
U22=elj(r,sig22,eps22,beta,Lb,q2,q2);
U=[U11',U12',U22']';
tol=[1.d-8,1.d-8];
x=zeros(6*n,1);
parms=[40,80,-.9];
[sol, it_hist, ierr] = nsoli(x,'oz',tol);
%
%%Unpack h and c.
%
h11=sol(1:n);h12=sol(n+1:2*n); h22=sol(2*n+1:3*n);
c11=sol(3*n+1:4*n); c12=sol(4*n+1:5*n); c22=sol(5*n+1:6*n);
g11= h11+1; g12= h12+1; g22= h22+1;
cd=cdirect(c12,c22);
%
ceff=c11+cd;
if h11~=0.0
veff = h11-ceff-log(1.0+h11);
else
veff=0.0;
end
h111= (exp(-veff+h11-ceff))-1;
%%Saving to file
if (iopt == 0)
A= [r h11 h12 h22 c11 c12 c22 veff h111];
fileID = fopen('size_16_c_12_HNC_chk.txt', 'w');
fprintf(fileID, '%6s %12s %12s %12s %12s %12s %12s %12s %12s\r\n', 'r', 'h11', 'h12', 'h22', 'c11', 'c12', 'c22', 'Veff', 'h111');
fprintf(fileID, '%6.4f\t %12.8f\t %12.8f\t %12.8f\t %12.8f\t %12.8f\t %12.8f\t %12.8f\t %12.8f\r\n', A');
fclose(fileID);
B= [r g11 g12 g22];
fileID = fopen('g_size_16_c_12_HNC_chk.txt', 'w');
fprintf(fileID, '%6s %12s %12s %12s\r\n', 'r', 'g11', 'g12', 'g22');
fprintf(fileID, '%6.4f\t %12.8f\t %12.8f\t %12.8f\r\n', B');
fclose(fileID);
end
%%Plot the solution.
%
figure(1)
subplot(1,3,1)
plot(r,g22,'-');
%axis([-20,100,-1,10])
axis([-20,800,-1,10])
ylabel('g22','Rotation',1);
xlabel('r');
grid on;
subplot(1,3,2)
plot(r,h22,'-');
%axis([-20,100,-1,10])
axis([-20,800,-1,10])
ylabel('h22','Rotation',1);
xlabel('r');
grid on;
subplot(1,3,3)
plot(r,c22,'-');
%axis([-20,100,-1,10])
axis([-20,800,-1,10])
ylabel('c22','Rotation',1);
xlabel('r');
grid on;
figure(2)
subplot(1,3,1)
plot(r,g11,'-');
%axis([-20,100,-1,10])
axis([-20,800,-1,10])
%axis([-0.5 2.5 250]);
ylabel('g11','Rotation',1);
xlabel('r');
grid on;
subplot(1,3,2)
plot(r,h11,'-');
%axis([-20,100,-1,10])
axis([-20,800,-1,10])
ylabel('h11','Rotation',1);
xlabel('r');
grid on;
subplot(1,3,3)
plot(r,c11,'-');
%axis([-20,100,-1,10])
axis([-20,800,-1,10])
ylabel('c11','Rotation',1);
xlabel('r');
grid on;
figure(3)
subplot(1,3,1)
plot(r,g12,'-');
%axis([-20,100,-1,10])
axis([-20,800,-1,10])
ylabel('g12','Rotation',1);
xlabel('r');
grid on;
subplot(1,3,2)
plot(r,h12,'-');
%axis([-20,100,-1,10])
axis([-20,800,-1,10])
ylabel('h12','Rotation',1);
xlabel('r');
grid on;
subplot(1,3,3)
plot(r,c12,'-');
%axis([-20,100,-1,10])
axis([-20,800,-1,10])
ylabel('c12','Rotation',1);
xlabel('r');
grid on;
figure(4)
subplot(1,1,1)
plot(r/sig12,veff,'-',r/sig11,U11,'--');
axis([0, 90.0 -10, 10]);
ylabel('veff','Rotation',1);
xlabel('r/sig11');
grid on;
%
function u= elj(r,sigma,epsilon,beta,Lb,q1,q2)
n2=length(r);
ra=r(2:n2);
r12=(sigma./ra).^12; r6=(sigma./ra).^6;
%cb =((q1*q2)./(4*pi*epsilon0*ra*0.59616));
cb = ((Lb*q1*q2)./(beta*ra));
%if ra <= 0.336738
ua=exp((-4*beta*epsilon*(r12-r6))+ cb);
%else
%ua=exp(cb)
%end
u=[0,ua']';
%
function cd=cdirect(c12,c22)
global L U rho
Lx=1.0;
n=length(c12);
dr=Lx/n;
tc12=hank2(c12); tc22=hank2(c22); fc=(rho(1).*(tc12).^2)./(1-(rho(1).*tc22));
cd=ihank2(fc);
%%Hankel transform using the fast sine transform.
%
function hf=hank2(f)
nf=length(f); n=nf-1; m=nf-2;
h=1/n; beta=2*(m+1)*(h^3); ff=beta;
p=1:m; p=p';
hft=ff*lsint(p.*f(2:n))./p;
hf=[0,hft',0]';
%
%%Inverse Hankel transform using the fast sine transform.
%
function ihf=ihank2(f)
nf=length(f); n=nf-1; m=nf-2;
h=1/n; beta=2*(m+1)*(h^3); ff=2/(n*beta);
p=1:m; p=p';
hft=ff*lsint(p.*f(2:n))./p;
p1=1:n; p1=p1'; p1=p1.*p1; p1(n)=p1(n)/2;
ihf=[0,hft',0]';
%%LSINT
% Fast sine transform with MATLAB's FFT.
%
function lf=lsint(f)
n=length(f);
ft=-fft([0,f']',2*n+2);
lf=imag(ft(2:n+1));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
When I run your code, I get
Undefined function 'nsoli' for input arguments of type 'double'.
Error in test>myoz (line 38)
[sol, it_hist, ierr] = nsoli(x,'oz',tol);
Error in test (line 3)
[h,c]=myoz
Okay I have nsoli and oz file .
[sol, it_hist, ierr] = nsoli(x,'oz',tol);
In the above line it shows that nsoli is a file with function oz and variable x and the tolerances.
If you i can send the codes could you help me to solve this error?
Do we even know that it's an error? The messages you've shown are just warnings. In any case, you can use
>>dbstop if warning
to trap the cause.

Sign in to comment.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Asked:

on 22 Sep 2014

Commented:

on 25 Sep 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!