bug in io/writer.hpp:ordered_unconstrain

4 views
Skip to first unread message

Marcus Brubaker

unread,
Aug 27, 2012, 12:05:40 PM8/27/12
to stan...@googlegroups.com
I was going through adding code for a positive_ordered type and I
think I've found a bug in io/writer.hpp:ordered_unconstrain.
Specifically, that function returns x[0] = log(y[0]) but the entries
of the ordered vector y don't need to be positive, hence y[0] could be
negative. I'm pretty certain this is a bug but it's possible I've
missed something.

Also, I'm almost finished implementing the positive_ordered type.
Ideally we would implement ordered<lower=??,upper=??> but that's more
complexity than I know how to deal with in the parser so in the
meantime I'm just implementing the positive case.

Cheers,
Marcus

Bob Carpenter

unread,
Aug 27, 2012, 12:15:24 PM8/27/12
to stan...@googlegroups.com
It used to be a positive ordered type!
The bug probably got introduced from my not fully
changing the behavior when the positivity
constraint was removed.

Yes, eventually having bounds would be a better
way to go. I can probably add that when I
add constraints to other types.

But not for v1.

- Bob

Marcus Brubaker

unread,
Aug 27, 2012, 12:19:01 PM8/27/12
to stan...@googlegroups.com
On Mon, Aug 27, 2012 at 12:15 PM, Bob Carpenter <ca...@alias-i.com> wrote:
> It used to be a positive ordered type!
> The bug probably got introduced from my not fully
> changing the behavior when the positivity
> constraint was removed.

Ah, that makes sense. I've been seeing remnants of that fact in a
couple comments, etc. I've fixed the obvious things as I've found
them.

>
> Yes, eventually having bounds would be a better
> way to go. I can probably add that when I
> add constraints to other types.
>
> But not for v1.

In the mean time do you object to me adding a positive_ordered type?

Cheers,
Marcus


>
> - Bob
>
>
> On 8/27/12 12:05 PM, Marcus Brubaker wrote:
>>
>> I was going through adding code for a positive_ordered type and I
>> think I've found a bug in io/writer.hpp:ordered_unconstrain.
>> Specifically, that function returns x[0] = log(y[0]) but the entries
>> of the ordered vector y don't need to be positive, hence y[0] could be
>> negative. I'm pretty certain this is a bug but it's possible I've
>> missed something.
>>
>> Also, I'm almost finished implementing the positive_ordered type.
>> Ideally we would implement ordered<lower=??,upper=??> but that's more
>> complexity than I know how to deal with in the parser so in the
>> meantime I'm just implementing the positive case.
>>
>> Cheers,
>> Marcus
>>
>
> --
>
>
Reply all
Reply to author
Forward
0 new messages