Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    Instant 1.2.0

    Download button

    No screenshots available
    Downloads: 610  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.5/5)
    11 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Magne Westlie & Kent-Andre Mardal | More programs
    GPL / FREE
    December 8th, 2011, 15:23 GMT [view history]
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    Instant description

    Instant is a Python module that allows for instant inlining of C and C++ code in Python.

    Instant is a Python module that allows for instant inlining of C and C++ code in Python. Instant is a small Python module built on top of SWIG.

    Example of use:

    >>> c_code = """
    double sum(double a, double b){
    return a+b;
    }
    """
    >>> import Instant
    >>> ext = Instant.Instant()
    >>>
    >>> # create the wrapper code, compile and link it to a shared library
    >>> ext.create_extension(code=c_code, module='test1_ext')
    >>>
    >>> # use the C code
    >>> from test1_ext import sum
    >>> print sum(3.7, 4.8)
    8.5

    Example with NumPy arrays converted to C double arrays:

    >>> import Instant
    >>> import Numeric
    >>> import sys
    >>> import time
    >>>
    >>> ext = Instant.Instant()
    >>>
    >>> c_code = """
    /* add function for vectors with all safety checks removed ..*/
    void add(int n1, double* array1, int n2, double* array2, int n3, double* array3){
    for (int i=0; i>>"""
    >>>
    >>> ext.create_extension(code=c_code, headers=["arrayobject.h"],
    >>> include_dirs=[sys.prefix + "/include/python" + sys.version[:3] + "/Numeric"],
    >>> init_code='import_array();', module='test3_ext',
    >>> arrays = [['n1', 'array1'],['n2', 'array2'],['n3', 'array3']])
    >>>
    >>> from test3_ext import add
    >>> a = Numeric.arange(10000); a = Numeric.sin(a)
    >>> b = Numeric.arange(10000); b = Numeric.cos(b)
    >>> c = Numeric.arange(10000); c = Numeric.cos(c)
    >>>
    >>>add(a,b,c)

    What's New in This Release:

    · Various new examples with swiginac and sympy have been implemented.
    · A bug on 64-bit systems has been fixed.
    · The director flag is removed by default.



    Product's homepage

    What's New in This Release: [ read full changelog ]

    · This release contains a few bug fixes.

      


    TAGS:

    Python module | Python library | instant inlining | Instant | Python | module

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM