Skip to content

Commit

Permalink
Added an example for adding matrices.
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Mayr committed Oct 25, 2009
1 parent f6a7a02 commit 70a4b03
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions examples/add.pir
@@ -0,0 +1,29 @@
.sub main :main
.local pmc lib

lib = loadlib "NumMatrix2D"
unless lib goto not_loaded
say "library loaded successfully."

$P1 = new 'NumMatrix2D'
$P1.'resize'(5,5)
$P1[1;1] = 4.
$S1 = $P1
say $S1

$P2 = new 'NumMatrix2D'
$P2.'resize'(5,5)
$P2[1;1] = 3.
$P2[1;2] = 4.
$S2 = $P2
say $S2

$P3 = $P1 + $P2
$S3 = $P3
say $S3

end

not_loaded:
say "Could not load library."
.end

0 comments on commit 70a4b03

Please sign in to comment.