C binding to transfer matrices from C to Python and from Python toC

Discussion in 'Python' started by Nils Wagner, Oct 22, 2004.

  1. Nils Wagner

    Nils Wagner Guest

    Hi all,

    Has someone written a C binding to transfer matrices from C to Python
    and vice versa ?

    Any pointer would be appreciated.

    Nils
    Nils Wagner, Oct 22, 2004
    #1
    1. Advertising

  2. Re: C binding to transfer matrices from C to Python and from Pythonto C

    Nils Wagner <-stuttgart.de> writes:

    > Hi all,
    >
    > Has someone written a C binding to transfer matrices from C to Python
    > and vice versa ?


    Is your question more along the lines of "I have an algorithm written
    in C that operates on matrices; how do I call it from Python?"

    I presume you want Numeric or numarray matrices.

    From easy to hard (and less to more powerful :):

    - f2py will wrap C code. However, last I checked, the documentation
    isn't the clearest on how to do this.
    - weave in scipy (and I know you use scipy ;-). This allows you to
    write C code inline; I think you can link with an external routine.
    - pyrex is a Python-like language for writing extensions. To access
    arrays, you'll have to include some definitions of the appropiate
    array types from the Numeric or numarray headers.
    - use SWIG to generate wrappers. You'll have to do a bit of work with
    typemaps for passing arrays around.
    - writing a C extension by hand. See the Python docs about writing
    extensions, and the Numeric and numarray docs about the C API.

    --
    |>|\/|<
    /--------------------------------------------------------------------------\
    |David M. Cooke
    |cookedm(at)physics(dot)mcmaster(dot)ca
    David M. Cooke, Oct 22, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Dalberg
    Replies:
    0
    Views:
    397
    John Dalberg
    Jan 2, 2006
  2. Chris Shepherd

    Obtaining TOC information from CD...

    Chris Shepherd, Jan 15, 2004, in forum: Java
    Replies:
    3
    Views:
    499
    Chris Shepherd
    Jan 18, 2004
  3. Maarten

    Can Java read TOC cd?

    Maarten, Mar 16, 2008, in forum: Java
    Replies:
    4
    Views:
    2,684
    Tris Orendorff
    Mar 22, 2008
  4. Guillaume Marcais

    *cloth and ToC

    Guillaume Marcais, Mar 17, 2005, in forum: Ruby
    Replies:
    3
    Views:
    110
    Guillaume Marcais
    Mar 18, 2005
  5. Chris Shea

    net/toc, disconnects, and aol

    Chris Shea, Jan 12, 2007, in forum: Ruby
    Replies:
    0
    Views:
    121
    Chris Shea
    Jan 12, 2007
Loading...

Share This Page