~ubuntu-branches/ubuntu/karmic/psicode/karmic

« back to all changes in this revision

Viewing changes to src/bin/cctriples/init_3d_array.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <stdio.h>
2
 
#include <stdlib.h>
3
 
 
4
 
double ***init_3d_array(int p, int q, int r)
5
 
{
6
 
  double ***A;
7
 
  int i,j,k;
8
 
 
9
 
  A = (double ***) malloc(p * sizeof(double **));
10
 
  for(i=0; i < p; i++) {
11
 
    A[i] = (double **) malloc(q * sizeof(double *));
12
 
    for(j=0; j < q; j++) {
13
 
      A[i][j] = (double *) malloc(r * sizeof(double));
14
 
      for(k=0; k < r; k++) {
15
 
        A[i][j][k] = 0.0;
16
 
      }
17
 
    }
18
 
  }
19
 
 
20
 
  return A;
21
 
}
22
 
 
23
 
void free_3d_array(double ***A, int p, int q)
24
 
{
25
 
  int i,j;
26
 
 
27
 
  for(i=0; i < p; i++)
28
 
    for(j=0; j < q; j++)
29
 
      free(A[i][j]);
30
 
 
31
 
  for(i=0; i < p; i++) free(A[i]);
32
 
 
33
 
  free(A);
34
 
}