~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to examples/callsci/callsciJava (Windows)/ExempleGetComplex.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import javasci.* ; 
 
2
 
 
3
 
 
4
class  ExempleGetComplex {
 
5
 
 
6
  public static void main(String[] args) {
 
7
    MatrixUtilities a = new MatrixUtilities("A",1,3,new double [] {1,1,1});
 
8
    a.scilabSend();
 
9
    Matrix.scilabExec("P=poly(A,''x'',''coeffs'');");
 
10
    System.out.println("Affichage scilab" );
 
11
    Matrix.scilabExec("Q=roots(P);disp(Q);");
 
12
    // Creer une matrice (2,3) de type 1 = complex (le 4 ieme param�tre)
 
13
    int m = 1;
 
14
    int n = 2;
 
15
    double val[] = new double[2*m*n];
 
16
    MatrixUtilities q = new MatrixUtilities("Q",m,n,val);
 
17
 
 
18
    q.scilabGet();
 
19
    int i, j, ij;
 
20
 
 
21
    System.out.println();
 
22
    System.out.println("--------------------------------------" );
 
23
    System.out.println("Affichage apres recuperation dans java" );
 
24
    System.out.println();
 
25
 
 
26
    for(i=0;i<m;i++)
 
27
    {
 
28
      for(j=0;j<n;j++)
 
29
      {
 
30
         ij=i+j*m;
 
31
 
 
32
         if ( val[ij+m*n] >= 0 )
 
33
         {
 
34
           System.out.println(i+"," +j+ " : " + val[ij] + "+" + val[ij+m*n] + "i");
 
35
         }
 
36
         else
 
37
         {
 
38
           System.out.println(i+"," +j+ " : " + val[ij] +  val[ij+m*n] + "i");
 
39
         }
 
40
      }
 
41
    }
 
42
  }
 
43
}
 
44