Use "x'x" instea several packd - Thank you. Sometimes
ago
I rewrote several packages computing quadratic forms
and quadratic forms with inverse. x'x was my gap
Having said this, fdjac and numhess are supposed to work on
_functions_,
not _arbitrary expressions
arbitrary expressions are turned into functions via identity function,
so, may be make native identity function in hansl?
Oleh
4 жовтня 2017, 12:11:45, від "Riccardo (Jack) Lucchetti"
<r.lucchetti(a)univpm.it>:
On Wed, 4 Oct 2017, > oleg_komashko(a)ukr.net wrote:
> Dear All,
> To reproduce
> x = {1,1}'
> catch eval numhess(x,x'*x)
> catch eval fdjac(x,x'*x)
> catch eval fdjac(x,(x'*x))
>
> function matrix i(matrix x)
> return x
> end function
>
> eval numhess(x,i(x'*x))
>
> eval fdjac(x,i(x'*x))
>
> Why it may look trivial, I spent
> some time to guess to use
> identity function
>
> I can imagine 2 possibilities:
> 1) to include native identity
> function in hansl
> 2)fdjac and numhess should do
> something similar inside
Ok, first things first: DON'T EVER use the Matlab-style syntax "x'*x";
it
works, but it's inefficient, both in terms of memory usage and CPU time.
Use "x'x" instead. Believe me, it does make a difference. And if you
don't
believe me, try this:
<hansl>
set verbose off
X = mnormal(2000,100)
XX = zeros(100,100)
set stopwatch
loop 100 -q
XX = X'*X
endloop
t0 = $stopwatch
loop 100 -q
XX = X'X
endloop
t1 = $stopwatch
print t0 t1
</hansl>
Having said this, fdjac and numhess are supposed to work on _functions_,
not _arbitrary expressions_. Of course Allin has the final word here, but
I imagine that allowing for arbitrary genr expressions as the second
argument would complicate the parsing quite a bit, and I don't really see
the scope for it. But I may be wrong, of course.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti@univpm.ithttp://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
_______________________________________________
Gretl-devel mailing list
Gretl-devel@lists.wfu.eduhttp://lists.wfu.edu/mailman/listinfo/gretl-devel