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

    cndarray 2011.1

    Download button

    No screenshots available
    Downloads: 80  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Andreas Kloeckner | More programs
    MIT/X Consortium Lic... / FREE
    December 9th, 2011, 07:45 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    cndarray description

    A preprocessor that gives C multidimensional arrays

    cndarray is a Python preprocessor that makes using n-dimensional arrays in C more pleasant. It will turn this code:

    void dgemm(float *a, float *b, float *c, int n)
    {
     dimension "fortran" a[n, n];
     dimension "fortran" b[n, n];
     dimension c[n, n];

     for (int i = 1; i < = n; ++i)
     for (int j = 1; j < = n; ++i)
     {
     float tmp = 0;

     for (int k = 1; k < = n; ++k)
     tmp += a[i,k]*b[k,j];

     c[i-1,j-1] = tmp;
     }
    }

    into this:

    void dgemm(float *a, float *b, float *c, int n)
    {
     for (int i = 1; i < = n; ++i)
     for (int j = 1; j < = n; ++i)
     {
     float tmp = 0;
     for (int k = 1; k < = n; ++k)
     tmp += a[((k - 1) * ((n - 1) + 1)) + (i - 1)] * b[((j - 1) * ((n - 1) + 1)) + (k - 1)];

     c[((i - 1) * n) + (j - 1)] = tmp;
     }
    }


    It understands all of C99.

    Each axis specification in a dimension statement has the following form:

    start:end:stride:leading_dimension

    start may be omitted. end and stride may also be omitted, but in this case, the colons remain in place, such that the axis specification :5 simply specifies a stride of 5. The stride simply acts as a multiplier on the index. No plausibility checking whatsoever is done on the dimension statement. You may shoot yourself in the foot any way you like.

    If the layout is given as "c" or not given at all, the following things are true:

    - The array is laid out in row-major order.
    - The end index is taken to be exclusive, if specified.
    - The start index defaults to 0.

    If the layout is given as "fortran", the following things are true:

    - The array is laid out in column-major order.
    - The end index is taken to be inclusive, if specified.
    - The start index defaults to 1.

    Installation

    In the source tree, simply run:

     python setup.py install

    Note that you may either need to be root or use virtualenv for this to work.

    Cndarray is not completely done and a few details are still subject to change. For now, you can get it from github.

    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    Python preprocessor | multidimensional arrays | Python | preprocessor | C

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

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