## #2559 Computing complex eigenvectors

None
closed
nobody
None
5
2015-01-03
2013-03-06
Andrei
No

To whom it may concern

I'm trying to compute complex eigenvectors without success from
http://www.math.utexas.edu/pipermail/maxima/2011/026938.html

Thus I spent a lot of time to load(lapack)

build_info("5.29.1","2013-03-06 18:22:12","i386-apple-darwin11.4.0","SBCL","1.0.57")

Finally I managed by following the idea from

and I remove the .maxima subdirectory in the home and I have tried again
then from
http://www.math.utexas.edu/pipermail/maxima/2012/029328.html
in command line I did:
Maxima.app/Contents/Resources/maxima.sh -X '--dynamic-space-size 2000'
because with 1000 didn't work

I tried to get the complex eigenvectors
http://www.math.utexas.edu/pipermail/maxima/2011/026938.html

A:matrix([-3.97-5.04%i, -4.11+3.7%i, -.34+1.01%i, 1.29-.86%i],
[.34-1.5%i, 1.52-.43%i,1.88-5.38%i, 3.36+.65%i], [3.31-3.85%i,
2.5+3.45
%i, .88-1.08%i, .64-1.48%i]
, [-1.1+.82%i, 1.81-1.59%i,
3.25+1.33%i, 1.57-3.44%i]
);

with the following output

zgeev(A, true);

Maxima encountered a Lisp error:
Value of 0.0 in
(LET ((LAPACK::ALPHA #C(0.0 0.0)) (LAPACK::I 0) (LAPACK::DCONJG\$ 0.0))
(DECLARE (TYPE (SINGLE-FLOAT) LAPACK::DCONJG\$)
(TYPE (F2CL-LIB:COMPLEX16) LAPACK::ALPHA)
(TYPE (F2CL-LIB:INTEGER4) LAPACK::I))
(TAGBODY
(SETF LAPACK::INFO 0)
(COND ((< LAPACK::N 0) (SETF LAPACK::INFO -1))
((OR (< LAPACK::ILO 1)
(> LAPACK::ILO
(MAX (THE F2CL-LIB:INTEGER4 1)
(THE F2CL-LIB:INTEGER4 LAPACK::N))))
(SETF LAPACK::INFO -2))
((OR
(< LAPACK::IHI
(MIN (THE F2CL-LIB:INTEGER4 LAPACK::ILO)
(THE F2CL-LIB:INTEGER4 LAPACK::N)))
(> LAPACK::IHI LAPACK::N))
(SETF LAPACK::INFO -3))
((< LAPACK::LDA
(MAX (THE F2CL-LIB:INTEGER4 1)
(THE F2CL-LIB:INTEGER4 LAPACK::N)))
(SETF LAPACK::INFO -5)))
(COND
((/= LAPACK::INFO 0)
(BLAS:XERBLA "ZGEHD2" (F2CL-LIB:INT-SUB LAPACK::INFO))
(GO LAPACK::END_LABEL)))
(F2CL-LIB:FDO (LAPACK::I LAPACK::ILO (F2CL-LIB:INT-ADD LAPACK::I 1))
((> LAPACK::I
NIL)
(TAGBODY
(SETF LAPACK::ALPHA
(F2CL-LIB:FREF LAPACK::A-%DATA%
LAPACK::I)
((1 LAPACK::LDA) (1 ))
LAPACK::A-%OFFSET%))
(MULTIPLE-VALUE-BIND
(LAPACK::VAR-0 LAPACK::VAR-1 LAPACK::VAR-2
LAPACK::VAR-3 LAPACK::VAR-4)
(LAPACK::ZLARFG
(F2CL-LIB:INT-SUB LAPACK::IHI LAPACK::I)
LAPACK::ALPHA
(F2CL-LIB:ARRAY-SLICE LAPACK::A-%DATA%
F2CL-LIB:COMPLEX16
((MIN
2)
LAPACK::N)
LAPACK::I)
((1 LAPACK::LDA) (1
))
LAPACK::A-%OFFSET%)
1
(F2CL-LIB:FREF LAPACK::TAU-%DATA% (LAPACK::I)
((1 )) LAPACK::TAU-%OFFSET%))
(DECLARE
(IGNORE LAPACK::VAR-0 LAPACK::VAR-2 LAPACK::VAR-3))
(SETF LAPACK::ALPHA LAPACK::VAR-1)
(SETF (F2CL-LIB:FREF LAPACK::TAU-%DATA% (LAPACK::I)
((1
)) LAPACK::TAU-%OFFSET%)
LAPACK::VAR-4))
(SETF (F2CL-LIB:FREF LAPACK::A-%DATA%
LAPACK::I)
((1 LAPACK::LDA) (1 ))
LAPACK::A-%OFFSET%)
LAPACK::ONE)
(LAPACK::ZLARF "Right" LAPACK::IHI
(F2CL-LIB:INT-SUB LAPACK::IHI LAPACK::I)
(F2CL-LIB:ARRAY-SLICE LAPACK::A-%DATA%
F2CL-LIB:COMPLEX16
((+ LAPACK::I 1)
LAPACK::I)
((1 LAPACK::LDA)
(1
))
LAPACK::A-%OFFSET%)
1
(F2CL-LIB:FREF LAPACK::TAU-%DATA%
(LAPACK::I) ((1 ))
LAPACK::TAU-%OFFSET%)
(F2CL-LIB:ARRAY-SLICE LAPACK::A-%DATA%
F2CL-LIB:COMPLEX16
(1
LAPACK::I 1))
((1 LAPACK::LDA)
(1
))
LAPACK::A-%OFFSET%)
LAPACK::LDA LAPACK::WORK)
(LAPACK::ZLARF "Left"
(F2CL-LIB:INT-SUB LAPACK::IHI LAPACK::I)
(F2CL-LIB:INT-SUB LAPACK::N LAPACK::I)
(F2CL-LIB:ARRAY-SLICE LAPACK::A-%DATA%
F2CL-LIB:COMPLEX16
((+ LAPACK::I 1)
LAPACK::I)
((1 LAPACK::LDA)
(1 ))
LAPACK::A-%OFFSET%)
1
(F2CL-LIB:DCONJG
(F2CL-LIB:FREF LAPACK::TAU-%DATA%
(LAPACK::I) ((1
))
LAPACK::TAU-%OFFSET%))
(F2CL-LIB:ARRAY-SLICE LAPACK::A-%DATA%
F2CL-LIB:COMPLEX16
((+ LAPACK::I 1)
LAPACK::I 1))
((1 LAPACK::LDA)
(1 ))
LAPACK::A-%OFFSET%)
LAPACK::LDA LAPACK::WORK)
(SETF (F2CL-LIB:FREF LAPACK::A-%DATA%
LAPACK::I)
((1 LAPACK::LDA) (1
))
LAPACK::A-%OFFSET%)
LAPACK::ALPHA)
LAPACK::LABEL10))
(GO LAPACK::END_LABEL)
LAPACK::END_LABEL
(RETURN (VALUES NIL NIL NIL NIL NIL NIL NIL LAPACK::INFO))))
is
0.0,
not a
SINGLE-FLOAT.
Automatically continuing.
To enable the Lisp debugger set debugger-hook to nil.

## Discussion

• Raymond Toy - 2013-03-07

This appears to be a bug in how those files were generated. As a work around, you can change the 0.0 (near dconjg\$) to 0f0.

The files ought to be regenerated again.

• Andrei - 2013-03-07

Thanks for response

I made the changes like you said

lapack/zgehd2.lisp: (prog ((alpha #C(0.0d0 0.0d0)) (i 0) (dconjg\$ 0.0))
lapack/zlahqr.lisp: (dconjg\$ 0.0))
lapack/zlaqr2.lisp: (dconjg\$ 0.0))
lapack/zlaqr3.lisp: (dconjg\$ 0.0))
lapack/ztrexc.lisp: (wantq nil) (dconjg\$ 0.0))

dconjg\$ 0.0 with dconjg\$ 0f0

in ztrevc.lisp (dcmplx\$ 0.0)) with (dcmplx\$ 0f0))

and
dble\$ 0.0) (dimag\$ 0.0)) with dble\$ 0f0) (dimag\$ 0f0))

it seems to work perfectly

zgeev(A, true);

[[-6.999843371570387%i-6.000425342949248,2.006027162316514%i-5.000033457596964,7.998194516208248-
.9963650913928996%i,3.002264284337972-3.999818699353223%i]
,

matrix([.8457221269095605,.1732346317429521%i-.3865491118384048,.2668960805541836%i-.1729741214922218,-.1782180414203164*%i-.03561357879442444],[.3036074022088088%i-.01772275253765543,.4528809670358095%i-.3539288131601223,.6924232122846427,.2666323741075225*%i+.1263742620790907],[.3114528298152489%i+.08752124466951977,.6123700548961366,.4959799871283028%i+.3324022684534099,.01293256133328227-.2965682030735418*%i],[-.2905979861233139%i-.05614722089937191,-.3283626113415364%i-0.0859283582589069,.2503883898017165-.01465500310353839*%i,.8898240137592393])

Another question or bug within MAC
(where I have tried in both versions 5.29.1 and 5.28)
build_info("5.29.1","2013-03-06 18:22:12","i386-apple-darwin11.4.0","SBCL","1.0.57")

/ [wxMaxima: input start ] /
integrate(cos(a)/sqrt((tan(a))^2 +1),a,-%pi/2,%pi/2),intanalysis:false;
"Is "cos(a)" positive or negative?"pos;
"Is "sin(g9903)" positive or negative?"pos;
"Is "cos(g10435)" positive or negative?"pos;
"Is "sin(g10896)" positive or negative?"pos;
(%o21) (%ilog(2))/2-(%ilog(-2))/2
/ [wxMaxima: input end ] /
/ [wxMaxima: input start ] /
rectform(%);
%pi/2
/ [wxMaxima: input end ] /

build_info("5.28.0","2012-09-10 10:33:40","i386-apple-darwin11.4.0","SBCL","1.0.55.0-abb03f9")

/ [wxMaxima: input start ] /
integrate(cos(a)/sqrt((tan(a))^2+1),a,-%pi/2,%pi/2),intanalysis:false;
"Is "cos(a)" positive or negative?"pos;
"Is "sin(a)" positive, negative, or zero?"pos;
(%o11) (%ilog(2))/2-(%ilog(-2))/2
/ [wxMaxima: input end ] /
rectform(%);
%pi/2

• Raymond Toy - 2013-03-07

That's great. Thanks for testing. I will try to fix the lapack code soon.

For the integration bug, please file that as a new bug instead of adding it to this. No one be able to find that bug if you don't file a new bug.

• Raymond Toy - 2013-03-08

Fix in git. Code was regenerated with the correct assumption for read-default-float-format. I this test using sbcl and the correct eigenvalues were produced.

• Raymond Toy - 2013-03-08
• status: open --> closed

• Robert Dodier - 2013-03-09

With current Git version, works for me w/ GCL. For the record, I get:

```    [[-6.99984337157039*%i-6.000425342949255,
2.006027162316515*%i-5.000033457596972,7.99819451620824-0.9963650913929*%i,
3.002264284337972-3.999818699353224*%i],
matrix([0.84572212690956,0.17323463174295*%i-0.3865491118384,
0.26689608055418*%i-0.17297412149222,
-0.17821804142032*%i-0.035613578794424],
[0.30360740220881*%i-0.017722752537655,
0.45288096703581*%i-0.35392881316012,0.69242321228464,
0.26663237410752*%i+0.12637426207909],
[0.31145282981525*%i+0.08752124466952,0.61237005489614,
0.4959799871283*%i+0.33240226845341,
0.012932561333282-0.29656820307354*%i],
[-0.29059798612331*%i-0.056147220899372,
-0.32836261134154*%i-0.085928358258907,
0.25038838980172-0.014655003103538*%i,0.88982401375924]),false]\$
```