Hi,

I am using APCK model for reliability analysis. The reliability problem has 17 random variables. I use this apptions for this problem:

```
APCKMCSOpts.Type = 'Reliability';
APCKMCSOpts.Method = 'AKMCS';
APCKMCSOpts.AKMCS.MetaModel = 'PCK';
APCKMCSOpts.AKMCS.IExpDesign.Sampling = 'LHS';
APCKMCSOpts.AKMCS.MaxAddedED = 45;
APCKMCSOpts.AKMCS.IExpDesign.N = 15;
APCKMCSOpts.AKMCS.PCK.Kriging.Corr.Family = 'Gaussian';
APCKMCSOpts.AKMCS.LearningFunction = 'U';
APCKMCSOpts.AKMCS.Convergence='stopPf';
APCKMCSOpts.Simulation.MaxSampleSize = 1e6;
myAPCKMCSAnalysis = uq_createAnalysis(APCKMCSOpts);
```

also I added this line in *uq.lar* :

`M=pinv(Psi(:,a_coeff)'*Psi(:,a_coeff));`

but I see this **error** in some runs,

```
something went extremely wrong while trying to evaluate the analysis
You may find additional information in the catched exeption:
NaN's cannot be converted to logicals.
Error in uq_lar (line 239)
s(~s) = 1;
Error in uq_PCE_lars (line 60)
lar_results = uq_lar(Psi, Y, lar_options);
Error in uq_PCE_calculate_coefficients_regression (line
197)
lars_results = uq_PCE_lars(univ_p_val,
current_model);
Error in uq_PCE_calculate_coefficients (line 47)
uq_PCE_calculate_coefficients_regression(current_model);
Error in uq_calculateMetamodel (line 18)
success =
uq_PCE_calculate_coefficients(current_model);
Error in uq_initialize_uq_metamodel (line 358)
success = uq_calculateMetamodel(current_model);
Error in uq_PCK_calculate_coefficients (line 88)
myPCE = uq_createModel(popts, '-private');
Error in uq_calculateMetamodel (line 24)
success =
uq_PCK_calculate_coefficients(current_model);
Error in uq_initialize_uq_metamodel (line 358)
success = uq_calculateMetamodel(current_model);
Error in uq_akmcs (line 110)
myMetamodel = uq_createModel(metaopts,
'-private');
Error in uq_reliability (line 62)
results = uq_akmcs(CurrentAnalysis);
Error in uq_initialize_uq_reliability (line 633)
uq_runAnalysis(current_analysis);
Error in Pilot_without_copula_F (line 440)
myAPCKMCSAnalysis = uq_createAnalysis(APCKMCSOpts);
```

Furthermore, I checked other candidate options (all 4 combinations) of both learning function and stop citerion:

- Learning function:U & EFF
- stop criteria:stopU & stopPf

Do you know what is the reseaon of it?

Besides, its worth mentioning that when I use **AKMCS** method,not **APCKMCS**, every thing is right!

Please help me to find my problem with APCKMCS method?

Many thanks

Azam