~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to examples/intersci-examples-so/ex16c.c

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include "../../routines/machine.h"
 
3
 
 
4
/*******************************************
 
5
 * simple example with sparse matrix 
 
6
 * Display of a 
 
7
 *******************************************/
 
8
 
 
9
int F2C(ext16ca)(ar,m,n)
 
10
     int *ar;
 
11
     int *n,*m;
 
12
 
13
  int i;
 
14
  for ( i=0; i < (*m)*(*n) ; i++) ar[i]= (ar[i]==1)? 0:1;
 
15
}
 
16
 
 
17
/*******************************************
 
18
 * simple example with sparse matrix 
 
19
 * 2*a copied into b 
 
20
 *******************************************/
 
21
 
 
22
int F2C(ext16cb)(ar1,ar2,m,n)
 
23
     int *ar1,*ar2;
 
24
     int *m,*n;
 
25
{
 
26
  int i;
 
27
  for ( i = 0; i < *m*(*n) ; i++) ar2[i] =  (ar1[i]==1)? 0:1;
 
28
}
 
29
 
 
30
 
 
31
/*******************************************
 
32
 * a is an external 
 
33
 *******************************************/
 
34
 
 
35
 
 
36
int F2C(ext16ce)(ar1,m,n,err)
 
37
     int  **ar1;
 
38
     int *m,*n,*err;
 
39
{
 
40
  int i,j;
 
41
  *n=2;
 
42
  *m=3;
 
43
  *ar1 = (int *) malloc((unsigned) (*m)*(*n)*sizeof(int));
 
44
  if ( *ar1 == (int*) 0) 
 
45
    {
 
46
      *err=1;
 
47
      sciprint("No more space\r\n");
 
48
      return;
 
49
    }
 
50
  *err=0;
 
51
  for ( i = 0; i < (*n) ; i++) 
 
52
    for ( j = 0; j < (*m) ; j++) 
 
53
      (*ar1)[i+(*n)*j] = i ;
 
54
}