On Tue, 14 Sep 2021, Riccardo (Jack) Lucchetti wrote:
On Tue, 14 Sep 2021, atecon wrote:
> One question: How would such an "end" operator work "under the
hood"?
> a) Is it triggering the computation of rows(X) AND cols(X) each time "end"
> is called, or
> b) is it a property of matrix X, meaning that once X is initialized, the
> number of rows and columns is automatically computed and this information
> stored as a property of the object X?
It's (b). The computational cost of the rows() and cols() function is nearly
zero. The "matrix" struct definition is in lib/src/gretl_matrix.h, line 77.
Exactly zero, I'd say. In hansl you need to call rows() or cols() to
get the dimensions of a matrix but internally, in C, rows and cols
are members of the matrix struct so no computation is required, just
a read.
Allin