defbundle parsing
by Sven S
Hi,
the following line works, but shouldn't it fail due to the trailing comma?:
bundle b = defbundle("a",1 ,)
thanks
sven
3 years, 8 months
exists() vs. inbundle()
by Sven Schreiber
Hi,
I'm wondering what the value added of 'inbundle' over 'exists' is. In
principle both check for the existence of an object and return a type
code if yes.
I know that currently where inbundle(b, "m") returns 0 because m isn't
there, exists(b.m) instead yields an error. But I guess that could be
changed if wanted.
And vice versa: inbundle(a, "x") yields an error if there is no bundle
a, whereas exists(a.x) just returns 0. But are those differences really
by design or just by historical coincidence?
thanks
sven
4 years
two problems with "setinfo ... --description=..."
by Sven Schreiber
Hi,
I'm encountering two (and a half) problems with setting the descriptive
label of a series via 'setinfo'. This happens when I use this command
inside a function package which returns the resulting series.
1 - This first problem I cannot reproduce with a minimal function
example; I'm suspecting it might depend on being wrapped inside a
package. The problem is that the descriptive label of a series is _not_
overwritten with a new content when the series itself is replaced by the
return value of the package.
1b - Another thing that somehow seems to depend on doing it inside a
package: Doing 'setinfo myseries --description="@mylabel"' for an
existing string variable 'mylabel' just yields the literal "mylabel" as
description.
2 - The --description option to 'setinfo' apparently does not allow a
string variable as input. Doing --description=s for an existing string s
just gives the literal "s" as the label.
thanks
sven
4 years, 4 months
gretl bundles and JSON
by Allin Cottrell
Some devel news: you can now write gretl bundles as JSON using
bwrite() and read them back from JSON using bread(). In each case
gretl goes into JSON mode if the filename has extension ".json" or
".geojson".
The writer employs special JSON-object formats for matrices, series
and lists. Each format comprises a required "type" string, a
required "data" array, and for matrices and series required size
information.
matrix: { "type" : "gretl_matrix",
"rows" : integer,
"cols" : integer,
"data" : [ <vec of matrix> ] }
series: { "type" : "gretl_series",
"size" : integer <length of series>,
"data" : [ <series values, length size> ] }
list: { "type" : "gretl_list",
"data" : [ <integers> ] }
In the list case, for a list with n members the "data" array of
integers is of length n + 1, with the first value = n.
If a matrix or series includes missing values these are represented
by the string "NA" in place of a floating point value in the "data"
array. (Gretl's reader will handle that but AFAIK there's no truly
portable way of representing NAs in JSON.)
For export to third-party readers you can switch bwrite's mode for
matrices to something more generic: an m x n matrix is written as an
array of m arrays, each holding n doubles (so one sub-array per
row). This is the format used in GeoJSON files.
How to switch matrix mode? For now we've overloaded the optional
second argument to bwrite, making it into a "bitflags" integer
rather than a simple boolean. Giving a value of 1 has the original
meaning, namely write the bundle into the user's @dotdir, but adding
2 switches to generic matrix-writing -- and adding 4 switches to
pretty-printing the JSON. So for example, giving 6 for this option
will result in pretty-printed JSON with the generic matrix format.
Allin
4 years, 4 months
Can't build Gretl in Ubuntu Server
by Leonardo Romero
I'm trying to build the last version of Gretl using git. But after I run the ./configure command I have the following error:
#####################################
Please install GMP and then reconfigure gretl.
GMP is available from http://gmplib.org/
####################################
I have already installed the library libgmp3-dev
$ sudo apt-get install libgmp3-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgmp3-dev is already the newest version (2:6.1.2+dfsg-2).
0 upgraded, 0 newly installed, 0 to remove and 58 not upgraded.
######################################################
and also have installed: $sudo apt-get install libgmp-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgmp-dev is already the newest version (2:6.1.2+dfsg-2).
0 upgraded, 0 newly installed, 0 to remove and 58 not upgraded.
########################################################
but every time I run de ./configure command I'm having the same message. And it did not only happened to me using in Ubuntu. I tried in a Debian server and it happens the same.
Can anyone kindly help
4 years, 4 months
GIT issue
by Marcin Błażejowski
Hi,
it looks like 'geoplot_utils.inp' is missing in git repo.
Cheers,
Marcin
--
Marcin Błażejowski
4 years, 4 months
issue: if-condition, function, print
by Artur Tarassow
Hi,
this was supposed to be solved officially a while ago but does not work
with current git anymore (on Ubuntu 19.10).
To be concrete: The print statement in function foo() might be executed
when called but does not appear.
<hansl>
function scalar foo (void)
print "Some message!" # NOT PRINTED
return 1
end function
if foo() == 1
print "Expect to see before the string 'Some message!'"
endif
</hansl>
Best,
Artur
4 years, 4 months
nelem() on string
by Artur Tarassow
Hi,
I just found that the nelem() function also accepts a string which is
not documented. Returns the same value as the strlen() function.
Best,
Artur
4 years, 4 months
remove loop... --quiet in docs
by Sven Schreiber
Hi,
since --quiet is now the default for loops, OK to remove that variant
from the guide? It occurs in various places there, and probably the main
explanation of the options could also be updated. (Checked against the
April version of the guide, in case I missed some very recent edits.)
Or is there possibility that the default will be reverted again?
thanks
sven
4 years, 4 months
jsongetb(): changed behaviour!
by Allin Cottrell
Hello all,
A heads-up for anyone using the jsongetb() function, for turning a
JSON string into a gretl bundle.
Up till now, when jsongetb encountered a JSON array containing
numeric values it constructed an array of strings (using sprintf on
the numbers). This was not very nice, but seemed like the easiest
thing to do since we were matching each JSON array to a gretl array,
and gretl does not have an "array of scalars" type as such.
New in git (not yet snapshots) we're converting numeric JSON arrays
to gretl matrices -- vectors, to be precise, because although JSON
arrays can be nested, JSON doesn't have a two-dimensional array as
such.
In case it's of concern to anyone, let me be a little more explicit.
(1) JSON: { "x" : [1, 2, 3] }
Old jsongetb gave x as an array of strings ("1", "2", "3").
New jsongetb gives x as a column vector {1, 2, 3}'.
(2) JSON { "x" : [[1, 2, 3], [4, 5, 6]] }
Old jsongetb gave x as an array of arrays, each element of which was
an array of strings: ("1", "2", "3") and ("4", "5", "6")
New jsongetb gives x as an array of matrices (column vectors),
namely {1, 2, 3}' and {4, 5, 6}'.
Clearly, this change will break hansl code expecting JSON numeric
arrays to come through in the old way. This applies to the dbnomics
addon and the (new, not really published) geoplot addon, but the
current code for those packages has been modified to handle both
cases. And we didn't find any current contributed function packages
that rely on the old jsongetb behaviour.
If anyone has "serious" code they're using that is broken by the
change in git, please tell us!
Further comment for experts: What about missing values? And JSON
arrays of mixed type (since that's allowed, god help us)?
We judge a JSON array to be numeric based on the type of its first
element. If subsequent elements have a null value, or a string value
of "." or "NA", they are taken to be gretl NAs. Otherwise mixed
types provoke an error in jsongetb.
Allin
4 years, 4 months