Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: asarray_keys() error
From
Hua Peng <[email protected]>
To
[email protected]
Subject
Re: st: asarray_keys() error
Date
Fri, 24 May 2013 13:09:57 -0500
Matthew White <[email protected]> discovered a bug in Mata
function asarray_keys().
> mata:
> A = asarray_create("string", 2)
> asarray(A, ("type", "keep"), 1)
> asarray(A, ("name", "char"), 2)
> asarray_keys(A)
>
> However, -asarray_keys()- issues the following error message:
>
> asarray_keys_dup(): 3201 vector required
> asarray_keys(): - function returned error
> <istmt>: - function returned error
>
Sergiy Radyakin <[email protected]> confirmed the bug and said
it was likeliy due to collision of hashes generated by asarray_*().
Mostly asarray_*() handles collisions correctly, but not in one case.
Sergiey offered a workaround.
The fix for the problem Matthew experienced and Sergiey identified
will be in the next ado-file update.
-- Bill -- Hua
[email protected] [email protected]
On 5/15/2013 4:35 PM, Matthew White wrote:
Hi Statalist members,
I'm running the following commands in Stata 12.1 SE:
mata:
A = asarray_create("string", 2)
asarray(A, ("type", "keep"), 1)
asarray(A, ("name", "char"), 2)
asarray_keys(A)
However, -asarray_keys()- issues the following error message:
asarray_keys_dup(): 3201 vector required
asarray_keys(): - function returned error
<istmt>: - function returned error
If I run -asarray()- for just one key, -asarray_keys()- does not
result in an error. For example:
mata:
A = asarray_create("string", 2)
asarray(A, ("type", "keep"), 1)
asarray_keys(A)
end
If I change any one of the elements of the keys, -asarray_keys()- also
does not result in an error:
mata:
A = asarray_create("string", 2)
asarray(A, ("example", "keep"), 1)
asarray(A, ("name", "char"), 2)
asarray_keys(A)
end
Any suggestions would be appreciated.
Thank you,
Matt White
--
Matthew White
Senior Project Associate
Innovations for Poverty Action
101 Whitney Avenue, New Haven, CT 06510 USA
www.poverty-action.org
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/