numcosmo-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Numcosmo-help] Python structure


From: Arthur Constantino Scardua
Subject: Re: [Numcosmo-help] Python structure
Date: Mon, 28 Jan 2019 10:48:38 -0200

Hello Sandro,

thank you for fast reply.

Cheers,
Arthur Constantino Scardua


Em seg, 28 de jan de 2019 às 10:33, Sandro Dias Pinto Vitenti <address@hidden> escreveu:
Hello Arthur,

The bindings are built automatically using the tool
gobject-introspection. The problem with this function (and all others
that receive/return long double variables) is that the python does not
have a builtin long double type (you may find some extension on numpy or
similar libraries, but not builtin the language), for this reason there
is no way to create bindings for these functions without losing
precision. One possible workaround would be to create wrapper functions
that just recast the return value to double.

> Is there any standards that tells how the numcosmo methods are
> transferred to python?

In principle all methods that have all their arguments and return values
whose types have a known translation for other languages. These types
include the basic types:
https://wiki.gnome.org/Projects/GObjectIntrospection/Annotations#Default_Basic_Types
, and all other objects and boxed objects defined in the library.

Best,
Sandro Vitenti

On 1/27/19 1:25 PM, Arthur Constantino Scardua wrote:
> Dear all,
>
> what is the structure of Numcosmo bindings in Python? For instance, how
> can I access the the method  ncm_c_sqrt_1_4pi() [numcosmo/math/ncm_c.h]
> that returns a constant using Python?
>
> I've seen there is the NumCosmoMath.C module [from gi.repository import
> NumCosmoMath.C] that has some methods for constants like
> blackbody_energy_density() which name in ncm_c.h is
> ncm_c_blackbody_energy_density(), but I couldn't find any
> ncm_c_sqrt_1_4pi() or sqrt_1_4pi() method.
>
> Is there any standards that tells how the numcosmo methods are
> transferred to python?
>
> Cheers,
> Arthur Constantino Scardua


reply via email to

[Prev in Thread] Current Thread [Next in Thread]