[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: incorrect dimension in axes::properties::calc_ticks_and_lims?
From: |
Ben Abbott |
Subject: |
Re: incorrect dimension in axes::properties::calc_ticks_and_lims? |
Date: |
Tue, 25 Jan 2011 08:00:22 -0500 |
On Jan 25, 2011, at 3:41 AM, logari81 wrote:
> On Mon, 2011-01-24 at 20:06 -0500, Ben Abbott wrote:
>> On Jan 24, 2011, at 6:51 PM, logari81 wrote:
>>
>>> On Mon, 2011-01-24 at 01:19 -0500, John W. Eaton wrote:
>>>> I noticed that the Matrix tmp_mticks might not be dimensioned
>>>> correctly in the function axes::properties::calc_ticks_and_lims. The
>>>> code at the end of that function is:
>>>>
>>>> int n = is_logscale ? 9 : 4;
>>>> Matrix tmp_mticks (1, n * tmp_ticks.numel ());
>>>>
>>>> for (int i = 0; i < tmp_ticks.numel ()-1; i++)
>>>> {
>>>> double d = (tmp_ticks (i+1) - tmp_ticks (i)) / (n+1);
>>>> for (int j = 0; j < n; j++)
>>>> {
>>>> tmp_mticks (n*i+j) = tmp_ticks (i) + d * (j+1);
>>>> }
>>>> }
>>>> mticks = tmp_mticks;
>>>> }
>>>>
>>>> I see that the loop over I must go from 0 to tmp_ticks.numel()-2 since
>>>> we access tmp_ticks(i+1) in the loop, but this leaves the last N
>>>> elements of tmp_mticks uninitialized. What is the intent here?
>>>> Should tmp_mticks be declared with
>>>>
>>>> Matrix tmp_mticks (1, n * (tmp_ticks.numel () - 1));
>>>>
>>>> instead?
>>>>
>>>> jwe
>>>
>>> that was my mistake, I haven't tried your suggestion yet but I think you
>>> are right, it should be:
>>>
>>> Matrix tmp_mticks (1, n * (tmp_ticks.numel () - 1));
>>>
>>> BR
>>>
>>> Kostas
>>
>> Kostas,
>>
>> Will you be submitting a changeset for this?
>>
>> Ben
>
> I have just tried this fix and of course works correctly as supposed.
> So, I could push a changeset for this, I am just a bit confused with
> mercurial, when working with different branches. Is there something I
> would take care of with respect to 3.4 branch?
>
> Kostas
You can use "hg view" to make sure everything looks ok. If it does, please push.
Ben