Re: [eigen] conservative resize ... |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] conservative resize ...
- From: Márton Danóczy <marton78@xxxxxxxxx>
- Date: Mon, 7 Sep 2009 13:34:44 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=Ygo6ISmpoi9FSIfRRKQPTVJwhDpHdEvi9YZsPyiNnzE=; b=YoRpDl67+yMs7+rxVLJU94TL3UjZmIonaXwzej8qJhiiAvnOf4t5tkbA3QWbItNe9c jGrQqV71nbUyi8PSm/xqoiD9TJsMRzQwOZfmdpOSc3c9FEBS6c/ffNYWDJSmzdFkHyJv RmsSv84hIlcVKO+TU1zFaJvfT8I7ZFKaYJ6J4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=ac1kHlgNDLVlvBcUPIQA27ajAFLl+dI4X5zpC0ZAOHQ1yYgOUN89ZWEyFxfUItuDs/ ZYQ1TZoQ4BpyLayk9UTxM8Rte7Wp29Al+Mo7KTtSHwXzdZXw+sAHeFr60SlU6M9GemZ4 wmf6bpgFzUQIqdUX9pmqw1HUIFiaEEOsk3PwQ=
You're right, initializing a matrix after resizing should suffice, if
it is not slower than doing both in one step.
Marton
2009/9/4 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
> Are these examples specifically for conservativeResize() ?
>
> For initializing a matrix with arbitrary value, we already have
>
> matrix = MatrixXd::Constant(rows,cols,value);
>
> Is it important to allow arbitrary value also in conservativeResize ?
>
> Benoit
>
> 2009/9/4 Márton Danóczy <marton78@xxxxxxxxx>:
>> Hi,
>>
>> I do think there is a use case to init memory with something else than
>> zero: for cumulative products with 1, for finding maxima with
>> -infinity, for finding minima with +infinity. And to give an example
>> for an arbitrary value, let's take repeated (=parallel) integrations
>> of a stochastic differential equation with the same initial value.
>> Therefore I prefer Hauke's original API.
>>
>> Marton
>>
>> 2009/9/4 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
>>> Hi,
>>>
>>> In your initial interface, allowing to extend by any arbitrary value,
>>> I don't think there was much of a use case for extending by a value
>>> other than zero. So I don't think it's a loss at all, not to have this
>>> feature. I like your current API,
>>>
>>> void conservativeResize(int rows, int cols, bool init_with_zero = false)
>>>
>>> How about defining a constant like
>>>
>>> const bool ExtendByZero = true;
>>>
>>> so that the user's code looks more explicit?
>>>
>>> Also, I don't know if the performance difference matters here, but if
>>> you want to get rid of the "if" you can always do a trick like
>>> NoChange_t. The drawback though is that it means even more overloads
>>> of conservativeResize.
>>>
>>> Benoit
>>>
>>> 2009/9/3 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
>>>> Hi,
>>>>
>>>> just a short question regarding my recent commit for conservative
>>>> resizing. I added an option to allow the user to set the part by which
>>>> a matrix might be extended to zero - currently via a boolean.
>>>> Initially I wanted to offer the ability to pass the scalar value
>>>> explicity which lead to problems, in particular for integer matrices.
>>>>
>>>> My initial intended interface was somethink like:
>>>>
>>>> void conservativeResize(int,int) // matrices with uninitialized memory
>>>> void conservativeResize(int,int,Scalar value) // matrices with new
>>>> memory set to value
>>>> void conservativeResize(int) // vectors with uninitialized memory
>>>> void conservativeResize(int,Scalar value) // vectors with new memory set to zero
>>>>
>>>> Here, the last and first definitions obviously clash when Scalar is int.
>>>>
>>>> Do you have any proposal how to circumvent this problem. Do we need
>>>> the uninitialized version at all for conservativeResizing? Any use
>>>> case for this?
>>>>
>>>> - Hauke
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
>
>