~ubuntu-branches/ubuntu/saucy/rheolef/saucy

« back to all changes in this revision

Viewing changes to skit/ptst2/gen_solver_mtx.awk

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Saramito
  • Date: 2011-03-23 11:14:26 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20110323111426-cjvhey7lxt6077ty
Tags: 5.93-1
* New upstream release (minor changes):
  - some extra warning message deleted in heap_allocator
  - graphic output with mayavi2 fixed
  - add doc refman in .info and .pdf format

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
BEGIN {
 
2
    # 1d laplace = tridiag(-1,2,-1)[n], n >= 0
 
3
    if (n > 1) {
 
4
      nnz = n + 2*(n-1);
 
5
    } else {
 
6
      nnz = n;
 
7
    }
 
8
    print "%%MatrixMarket matrix coordinate real general"
 
9
    print n " " n " " nnz;
 
10
    if (n == 1) {
 
11
      print "1 1 2";
 
12
    } else if (n > 1) {
 
13
      print "1 1 2";
 
14
      print "1 2 -1";
 
15
      for (i = 2; i <= n-1; i++) {
 
16
        print i " " i-1 " -1";
 
17
        print i " " i   " 2";
 
18
        print i " " i+1 " -1";
 
19
      }
 
20
      print n " " n-1 " -1";
 
21
      print n " " n   " 2";
 
22
    }
 
23
  }