~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to src/mod/sys/tst/SYS0004.als

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2011-03-16 21:31:18 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110316213118-gk4k3ez3e5d2huna
Tags: 2.0.0-1
* QA upload.
* New upstream release
* Debian source format is 3.0 (quilt)
* Fix debhelper-but-no-misc-depends
* Fix ancient-standards-version
* Fix package-contains-linda-override
* debhelper compatibility is 7
* Fix dh-clean-k-is-deprecated

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
# - the copyright holder be liable for any  direct, indirect, incidental or -
12
12
# - special damages arising in any way out of the use of this software.     -
13
13
# ---------------------------------------------------------------------------
14
 
# - copyright (c) 1999-2007 amaury darsch                                   -
 
14
# - copyright (c) 1999-2011 amaury darsch                                   -
15
15
# ---------------------------------------------------------------------------
16
16
 
17
17
# @info   complex test unit
23
23
# shared vector of threads descriptors
24
24
const thr-group (Vector)
25
25
 
26
 
# this procedure waits until all threads in the group are finished
 
26
# this expression waits until all threads in the group are finished
27
27
const wait-all nil (for (thr) (thr-group) (thr:wait))
28
28
 
29
 
# this procedure initialize a matrix with random numbers
 
29
# this expression initialize a matrix with unique numbers
30
30
# the matrix is a square one with its size as an argument
31
31
const init-matrix (n) {
32
32
  trans i (Integer 0)
33
33
  const m (Vector)
34
34
  do {
35
 
    trans v (m:append (Vector))
 
35
    trans v (m:add (Vector))
36
36
    trans j (Integer)
37
37
    do {
38
 
      v:append (afnix:sys:get-random)
 
38
      v:add (afnix:sys:get-unique-id)
39
39
    } (< (j:++) n)
40
40
  } (< (i:++) n)
41
41
  eval m
42
42
}
43
43
 
44
 
# this procedure multiply one line with one column
 
44
# this expression multiply one line with one column
45
45
const mult-line-column (u v) {
46
46
  assert (u:length) (v:length)
47
47
  trans result 0
49
49
  eval result
50
50
}
51
51
 
52
 
# this procedure multiply two vectors assuming one is a line and one is
 
52
# this expression multiply two vectors assuming one is a line and one is
53
53
# a column coming from the matrix
54
54
const mult-matrix (mx my) {
55
55
  for (lv) (mx) {
56
56
    assert true (vector-p lv)
57
57
    for (cv) (my) {
58
58
      assert true (vector-p cv)
59
 
      thr-group:append (launch (mult-line-column lv cv))
 
59
      thr-group:add (launch (mult-line-column lv cv))
60
60
    }
61
61
  }
62
62
}