File: runme.m

package info (click to toggle)
renderdoc 1.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 79,584 kB
  • sloc: cpp: 491,671; ansic: 285,823; python: 12,617; java: 11,345; cs: 7,181; makefile: 6,703; yacc: 5,682; ruby: 4,648; perl: 3,461; php: 2,119; sh: 2,068; lisp: 1,835; tcl: 1,068; ml: 747; xml: 137
file content (44 lines) | stat: -rw-r--r-- 974 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# do not dump Octave core
if exist("crash_dumps_octave_core", "builtin")
  crash_dumps_octave_core(0);
endif

# Operator overloading example
swigexample

a = swigexample.ComplexVal(2,3);
b = swigexample.ComplexVal(-5,10);

printf("a   = %s\n",disp(a));
printf("b   = %s\n",disp(b));

c = a + b;
printf("c   = %s\n",disp(c));
printf("a*b = %s\n",disp(a*b));
printf("a-c = %s\n",disp(a-c));

e = swigexample.ComplexVal(a-c);
printf("e   = %s\n",disp(e));

# Big expression
f = ((a+b)*(c+b*e)) + (-a);
printf("f   = %s\n",disp(f));

# paren overloading
printf("a(3)= %s\n",disp(a(3)));

# friend operator
printf("2*a = %s\n",disp(2*a));

# conversions
printf("single(a) = %g\n", single(a));
printf("double(a) = %g\n", double(a));

# unary functions
if swig_octave_prereq(3,8,0)
  printf("real(a) = %g\n", real(a));
  printf("imag(a) = %g\n", imag(a));
  printf("abs(a) = %g\n", abs(a));
  printf("conj(a) = %s\n", disp(conj(a)));
  printf("exp(a) = %s\n", disp(exp(a)));
endif