// Test IQagent
System.out.println("Testing IQagent");
IQagent iq = new IQagent();
Ran myran = new Ran(17);
for (j=0;j<M;j++) {
for (i=0;i<N;i++) iq.add(myran.doub());
}
// Percentiles for Ran
sbeps=3.e-3;
for (j=0;j<11;j++) {
y[j]=0.1*j;
x[j]=iq.report(y[j]);
}
localflag = (maxel(vecsub(x,y)) > sbeps);
globalflag = globalflag || localflag;
if (localflag) {
fail("*** IQagent: Percentiles of uniform distribution are suspiciously nonuniform");
}
// Artificial distribution
IQagent iq2 = new IQagent();
for (j=0;j<M;j++) {
for (i=0;i<N;i++) iq2.add((double)(i%100+1));
}
for (j=0;j<5;j++) {
var=0.25*j;
z[j]=iq2.report(var);
}
localflag = (maxel(vecsub(u,z))!= 0.0);
globalflag = globalflag || localflag;
if (localflag) {
fail("*** IQagent: Distribution with perfectly known percentiles failed");