File: ex3.m

package info (click to toggle)
suitesparse 1%3A5.12.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 176,720 kB
  • sloc: ansic: 1,193,914; cpp: 31,704; makefile: 6,638; fortran: 1,927; java: 1,826; csh: 765; ruby: 725; sh: 529; python: 333; perl: 225; sed: 164; awk: 35
file content (41 lines) | stat: -rw-r--r-- 889 bytes parent folder | download | duplicates (10)
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
function ex3
%EX3: create 2D and 3D meshes using mesh2d1, mesh2d2, mesh3d1, mesh3d2.

% Example:
%   ex3
% See also: cs_demo

% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com

t1 = zeros (50,1) ;
t2 = zeros (50,1) ;
t3 = zeros (50,1) ;
t4 = zeros (50,1) ;

fprintf ('run times for each method, given n:\n') ;
for n = 2:50

    tic ;
    A = mesh2d1 (n) ;
    t1 (n) = toc ;

    tic
    B = mesh2d2 (n) ;
    t2 (n) = toc ;

    tic
    C = mesh3d1 (n) ;
    t3 (n) = toc ;

    tic
    D = mesh3d2 (n) ;
    t4 (n) = toc ;

    fprintf ('%3d: %8.3f %8.3f %8.3f %8.3f\n', n, t1(n), t2(n), t3(n), t4(n)) ;

    subplot (2,2,1) ; spy (A) ; title ('2D mesh, method 1') ;
    subplot (2,2,2) ; spy (B) ; title ('2D mesh, method 2') ;
    subplot (2,2,3) ; spy (C) ; title ('3D mesh, method 1') ;
    subplot (2,2,4) ; spy (D) ; title ('3D mesh, method 2') ;
    drawnow
end