[petsc-users] TaoSetVariableBounds in petsc4py

Justin Chang jychang48 at gmail.com
Thu Sep 17 17:24:01 CDT 2015


Ah that's right, silly me. Yeah I didn't think about that for some reason.
Thanks

On Thu, Sep 17, 2015 at 3:06 PM, Jason Sarich <jason.sarich at gmail.com>
wrote:

> Hi Justin,
>
> The C interface allows null to be passed as one of the vectors, this looks
> like an issue with the petsc4py interface specifically.
>
> You can create the unneeded bound vector and set it to infinity or
> negative infinity, and pass it to this function instead of using none (TAO
> will do this anyway if you pass in NULL).
>
> Jason
>
>
> On Thu, Sep 17, 2015 at 4:00 PM, Justin Chang <jychang48 at gmail.com> wrote:
>
>> Matt,
>>
>> This is the error I get if I use None:
>>
>> Traceback (most recent call last):
>>   File "2D_plume_ADR_ex1.py", line 146, in <module>
>>     tao_D.setVariableBounds(lb_vec,None)
>>   File "PETSc/TAO.pyx", line 198, in petsc4py.PETSc.TAO.setVariableBounds
>> (src/petsc4py.PETSc.c:189484)
>> TypeError: Cannot convert NoneType to petsc4py.PETSc.Vec
>>
>> Thanks,
>> Justin
>>
>> On Thu, Sep 17, 2015 at 2:59 PM, Matthew Knepley <knepley at gmail.com>
>> wrote:
>>
>>> On Thu, Sep 17, 2015 at 3:55 PM, Justin Chang <jychang48 at gmail.com>
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I am attempting to use TaoSetVariableBounds via petsc4py. Is there a
>>>> way to set only lower bounds or upper bounds and not both? In PETSc I could
>>>> replace one of the Vecs with NULL, but how would I do that with
>>>> tao.setVariableBounds(...)?
>>>>
>>>> It seems right now I can only do tao.setVariableBounds(lb_vec,ub_vec),
>>>> and from inspection of the python source code, it seems I have to specify
>>>> both?
>>>>
>>>
>>> Can you jsut give None?
>>>
>>>   Matt
>>>
>>>
>>>> Thanks,
>>>> Justin
>>>>
>>>
>>>
>>>
>>> --
>>> What most experimenters take for granted before they begin their
>>> experiments is infinitely more interesting than any results to which their
>>> experiments lead.
>>> -- Norbert Wiener
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150917/fec7fc8d/attachment-0001.html>


More information about the petsc-users mailing list