Codegen question of qr function
Afficher commentaires plus anciens
Hi
I am trying to convert QR decomposition (qr) function to convert in c using codegen but it producing the wrong code .
I am using this command line
codegen -args {coder.typeof(double(0), [1 Inf])} -report -config:lib qr -O disable:inline
% code
static void eml_qr(const emxArray_real_T *A, real_T Q_data[1], int32_T Q_size[2],emxArray_real_T *R, emxArray_real_T *E)
that produce the qr function with all arguments are dynamic array but second parameter Q_data is static array ?
Réponses (2)
Ryan Livingston
le 28 Jan 2013
Given an m-by-n array A, QR produces a Q which is m-by-m. In this case the declaration:
coder.typeof(double(0), [1 Inf])
says that A is 1-by-? (i.e. a row vector with an unknown number of elements). Therefore, it can be determined that Q is a scalar without need for dynamic sizing.
I would also point out that the generated function "eml_qr" is created from an internal function called by the implementation of QR. In my opinion, it would be advisable to interface with the function:
qr(const emxArray_real_T *A, double Q_data[1], int Q_size[2], emxArray_real_T *R, emxArray_real_T *E);
in case the internal implementation of QR changes.
alex
le 29 Jan 2013
0 votes
Catégories
En savoir plus sur Algorithm Design Basics dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!