Codegen question of qr function
2 次查看(过去 30 天)
显示 更早的评论
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 ?
0 个评论
回答(2 个)
Ryan Livingston
2013-1-28
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.
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!