Error when calculating eigenvalues

Hello,

I am using the command eigh but I get the error message saying the following:

G0038 : Not all the eigenvalues can be computed [AFFINE2_simple.GAU, line 336]

I also read the following:

Error handling is controlled with the low bit of the trap flag.
trap 0 set _eigerr and terminate with message
trap 1 set _eigerr and continue execution

Is there any way I can implement this? that the execution will continue? could I trust the results if that is the case?

Thanks in advance.

 

 

 

1 Answer



0



The steps to use the trap in this context are:

  1. Set the first bit of the trap value to 1.
  2. Call eig or eigh.
  3. Check to see if the first value of the output is a scalar error code.
  4. If it is a scalar error code, decode the value to see which is the first correctly computed eigenvalue.

Here is an example, assuming that x is a matrix that has been created previously:

//Set trap to 1 
trap 1;

//Call 'eig' or 'eigh'
val = eig(x);

//Turn trap back off
trap 0;

//Check to see if the first element of the output is a scalar error code
if (scalerr(val[1]);
    print "The first calculated eigenvalue is element number" scalerr(val[1]);
endif;

aptech

1,773

Your Answer

1 Answer

0

The steps to use the trap in this context are:

  1. Set the first bit of the trap value to 1.
  2. Call eig or eigh.
  3. Check to see if the first value of the output is a scalar error code.
  4. If it is a scalar error code, decode the value to see which is the first correctly computed eigenvalue.

Here is an example, assuming that x is a matrix that has been created previously:

//Set trap to 1 
trap 1;

//Call 'eig' or 'eigh'
val = eig(x);

//Turn trap back off
trap 0;

//Check to see if the first element of the output is a scalar error code
if (scalerr(val[1]);
    print "The first calculated eigenvalue is element number" scalerr(val[1]);
endif;

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.