problem with pointerized bundle member
by Sven Schreiber
Hi,
I run into problems (=error) when I try to pass a bundle element as a
function argument in pointerized form. Minimal script:
<hansl>
function void hey(matrix *hu)
print "hey"
end function
bundle bbb
bbb.in = ones(2,2)
hey(&bbb.in)
</hansl>
I also tried "&(bbb.in)" (with parentheses), with no luck. I can
actually understand why pointing to something inside a bundle would be
problematic, but OTOH since we want to do lots of stuff with bundles and
still avoid copying large chunks of data, I'm wondering what the
recommended solution would be.
thanks,
sven
8 years, 10 months
modtest: --quiet and --silent options partly not respected
by Sven Schreiber
Hi,
I'm referring to tests after a 'var' command, perhaps (probably?)
similar problems affect other estimators:
1) modtest --normality --quiet: "--quiet" has no effect (everything is
printed)
2) modtest --normality --silent: "--silent" has no effect (everything is
printed)
3) modtest --autocorr --quiet: ok (same as silent, nothing)
4) modtest --autocorr --silent: ok (nothing)
(And BTW, there are only separate tests for each equation, don't we have
any Portmanteau type of test?)
5) modtest --arch --quiet: ok
6) modtest --arch --silent: some message stubs are still printed
This is still with 1.10.2.
Thanks,
sven
9 years, 1 month
nested include parser bug
by Sven Schreiber
Hi,
for an example please save both attached files next to each other, and
then execute script "check1.inp".
I don't think doing an 'include' inside a function is valid, but gretl
seems to stumble over this. Note for example that the function hu2() in
check2.inp is never called, but I still get a printout of "hello" before
I get an error message.
This is with 1.10.2 (not the latest snapshot).
thanks,
sven
9 years, 1 month
Package maintenance: getsymbols (version 0.1)
by Henrique Andrade
Dear Gretl Team and Yi-Nung,
I find a little problem with the getsymbols function (version 0.1). Taking
a look at line 50 of the function code we can see the following command
(The same command appear at line 6 of the sample script):
append "@dotdir/tmpM.csv"
That's nothing wrong with it when we are using Linux or OSX, but Windows
uses "\" and not "/". So I would like to suggest this fix:
<hansl>
##### Sample script: change line 6 #####
# old:
open "@dotdir/tmpM.csv"
# new (suggested):
if $windows
open "@dotdir\tmpM.csv"
else
open "@dotdir/tmpM.csv"
endif
##### Function code: change line 50 #####
# old:
append "@dotdir/tmpM.csv"
# new (suggested):
if $windows
append "@dotdir\tmpM.csv"
else
append "@dotdir/tmpM.csv"
endif
</hansl>
Also I would like to ask Yi-Nung to provide an e-mail address to the
function description.
Best,
Henrique Andrade
9 years, 1 month
strange (misleading?) parser message
by Sven Schreiber
Hi,
absolutely nothing dramatic here, but kind of strange. I had a missing
parenthesis in the following line (truncated by gretl in the error
printout):
> refac = rescale ? sqrt( Teff / (Teff - rows(coeff) ) :
Erwartete ',' aber fand ':'
(The message says "expected ',' but found ':'.)
Somehow the parser never realized the unmatched parentheses. Maybe
because of the ternary statement?
thanks,
sven
9 years, 1 month
obsnum() doesn't accept bundle member
by Sven Schreiber
hi,
example script snippet (not entirely self-contained, sorry, you need a
dataset that contains obs 2000:1):
<hansl>
bundle b = null
string s1 = "2000:1"
eval obsnum(s1) # gives valid number
b.str1 = s1 # bundle b pre-existing
printf "%s\n", b.str1 # gives "2000:1"
eval obsnum(b.str1) # gives "NA"!?
</hansl>
I know / have been told that _commands_ often cannot understand the
bundle syntax. (So 'var mybundle.lagorder mylist' doesn't work.) But I
would think that a _function_ like obsnum() should work with stuff like
the above.
thanks,
sven
9 years, 1 month
more information for "matrices not conformable"?
by Sven Schreiber
Hello (again),
it just occurred to me (why not before?) that the error message
"matrices not conformable for operation" could be made more useful by
immediately including the dimensions of the matrices involved.
Example:
? matrix test1 = zeros(2,2)
? matrix test2 = ones(3,3)
? matrix test3 = test1 * test2
Matrizen nicht passend bei Operation
It wouldn't be too difficult for gretl to amend this message with "2 x 2
and 3 x 3", right?
I think this would be very convenient for script writers, because
currently we have to write some debugging printf statements in the right
places, re-run the script to get the same information, and later delete
the printf-s.
thanks,
sven
9 years, 1 month
crash with omit after var
by Sven Schreiber
Hi,
I was trying out whether there are capabilities of 'omit' of which I
wasn't aware, and with 1.10.2 on Win8.1 this reproducibly crashes (=end
of life for the gretl instance) for me:
<hansl-crash>
open denmark
list all = IBO IDE LRM
var 2 all
list lag1 = lags(1, all)
list lags12 = lags(2, all)
list lag2 = lags12 - lag1
omit lag2
</hansl-crash>
According to the 'omit' documentation, this should work; at least there
are no exceptions for 'system' and/or 'var' estimations in the
explanations. (But I admit that I wasn't really expecting it to work, so
the reference probably needs to be corrected.)
thanks,
sven
9 years, 1 month
failure with ternary operator and lists
by Sven Schreiber
Hi,
example code:
<hansl>
# 1)
list testl = 2==1 ? null : null # works
matrix checkin = {1,2,3}
# 2)
scalar test = checkin[1]==1 ? 0 : 0 # works
# 3)
list testl = checkin[1]==1 ? null : null # fails
</hansl>
The error message is "mismatched datatypes" (re-translated).
I don't see any reason why this shouldn't work.
thanks,
sven
9 years, 1 month
feature request: overload lags() and perhaps the foreach loop
by Sven Schreiber
Hi,
I propose to overload the lags() function to accept not only a scalar
lag value, but alternatively a vector/matrix where the elements specify
which lags we want in the returned list.
Here's a hansl function that does what I have in mind:
<hansl>
function list getCertainLags( matrix idx, const list inp, bool bylag[0])
# returns a list with those lags of 'inp' specified by 'idx' elements
idx = vec(idx) # ensure col vector
list out = null
loop i=1..rows(idx)
lag = idx[i]
list temp = lags(lag, inp, bylag)
# watch out for the special case of lag 1
list templess1 = lag==1 ? null : lags( lag - 1, inp, bylag)
list out = out || (temp - templess1)
endloop
return out
end function
</hansl>
And then I also have an unrelated and more fundamental feature
suggestion: How about extending the foreach loop to also cover matrices
and perhaps even arrays? So instead of the common thing:
loop i=1..rows(inputvector)
v = inputvector[i]
...
one would do:
loop foreach v inputvector
...
and similarly for arrays.
This is of course pure syntactic sugar -- and I also admit that this
feels very pythonic, but I think it's not only present in Python.
Don't know how difficult it would be to implement. After all, currently
foreach is only for internal gretl strings.
thanks,
sven
9 years, 1 month