Does codegen handle qz?

I have an m-file that I'm trying to run through codegen to create a mex file that uses the QZ decomposition. I get the following error: "??? Undefined function or variable 'qz'." I include the %#codegen tag, and the editor doesn't notice any problems in the file. Does anybody know of a workaround? I guess I could code my own version of qz, but this seems like it should be unnecessary.

 Respuesta aceptada

Arnaud Miege
Arnaud Miege el 26 de Abr. de 2011

1 voto

Unfortunately, qz is not listed in the Functions Supported for Code Generation, so yes, you'll need to write your own version of qz, using supported functions.
HTH,
Arnaud

4 comentarios

Ian
Ian el 26 de Abr. de 2011
I knew there had to be a list like that somewhere...
QZ looks rather annoying to build. It would be nice if mathworks added support for it. It's critical for solving a large class of models in economics.
Kaustubha Govind
Kaustubha Govind el 26 de Abr. de 2011
Alternatively, if you used the coder.extrinsic directive, the generated MEX-function will dispatch the call to the MATLAB engine. The rest of your function will still run from generated code.
Ian
Ian el 26 de Abr. de 2011
Nice, I'll try this.
Ian
Ian el 4 de Mayo de 2011
Thanks, all, for the help last week. What's really killing me here turns out to be the qz decomposition itself. I'm not working with large matrices -- only 10x10 -- I just have to do it a lot (MCMC). I've spent a while on the google and haven't come up with any solutions. An approximation probably won't do as the validity of the algorithm relies on calculating the part involving qz correctly. Any thoughts?

Iniciar sesión para comentar.

Más respuestas (1)

Mike Hosea
Mike Hosea el 26 de Abr. de 2011

2 votos

If you go with an extrinsic call, your call site should look something like one of these two. The pre-definition of the output types will probably save you a lot of trouble.
eml.extrinsic('qz'); %or coder.extrinsic starting in 11a.
AA = complex(zeros(size(A)));
BB = complex(zeros(size(A)));
Q = complex(zeros(size(A)));
Z = complex(zeros(size(A)));
V = complex(zeros(size(A)));
W = complex(zeros(size(A)));
[AA, BB, Q, Z, V, W] = qz(A,B,'complex');
AAr = zeros(size(A));
BBr = zeros(size(A));
Qr = zeros(size(A));
Zr = zeros(size(A));
Vr = zeros(size(A));
Wr = zeros(size(A));
[AAr, BBr, Qr, Zr, Vr, Wr] = qz(A,B,'real');

Categorías

Más información sobre Simulink Coder en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

Ian
el 26 de Abr. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by