Or is it because matrix was called? Should it be more like this?
-- Distance weights between nodes.
weightedDistanceMatrix(s:%):TwoDimensionalArray WEIGHT ==
arr := new(#(getVertices s),#(getVertices s),
0)$TwoDimensionalArray(WEIGHT)
for u in 1..#(getVertices s) repeat
for v in 1..#(getVertices s) repeat
qsetelt!(arr,(u::Integer)-1,
(v::Integer)-1,distanceWeighted(s,u,v))
arr
Sorry, but in trunk there is the following.
https://github.com/hemmecke/fricas-svn/blob/master/src/algebra/graph.spad.pamphlet#L4679
weightedDistanceMatrix(s:%):Matrix WEIGHT ==
m:List List WEIGHT := [[distanceWeighted(s,u,v)_
for u in 1..#(getVertices s)]for v in 1..#(getVertices s)]
matrix(m)
But anyway... matrix(m) will probably be the reason for the failing
compilation...
... compiling...
Yep. The attached patch fixes the issue with Matrix/TwoDimensionalArray
and also makes the aldor-interface work again.
Waldek, I've not checked regressioin yet, but I don't expect any problem.
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.
>From 642237ce2ef8c84e22ec946815d2e74d4391d0cc Mon Sep 17 00:00:00 2001
From: Ralf Hemmecke <[email protected]>
Date: Thu, 16 Feb 2012 14:19:34 +0100
Subject: fix TwoDimensionalArray code
---
src/algebra/graph.spad.pamphlet | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/algebra/graph.spad.pamphlet b/src/algebra/graph.spad.pamphlet
index 4deb1fa..7a8a84b 100644
--- a/src/algebra/graph.spad.pamphlet
+++ b/src/algebra/graph.spad.pamphlet
@@ -4049,7 +4049,7 @@ WeightedGraph(S,W): Exports == Implementation where
++ as tensor product but returns %.
closedCartesian:(a:%,b:%,f:(S,S)->S) -> %
++ as Cartesian product but returns %.
- weightedDistanceMatrix:(%) -> Matrix WEIGHT
+ weightedDistanceMatrix:(%) -> TwoDimensionalArray WEIGHT
++ Distance weights between nodes.
Implementation ==> add
@@ -4677,11 +4677,13 @@ WeightedGraph(S,W): Exports == Implementation where
res
-- Distance weights between nodes.
- weightedDistanceMatrix(s:%):Matrix WEIGHT ==
- m:List List WEIGHT := [[distanceWeighted(s,u,v)_
- for u in 1..#(getVertices s)]for v in 1..#(getVertices s)]
- matrix(m)
-
+ weightedDistanceMatrix(s:%):TwoDimensionalArray WEIGHT ==
+ n := # getVertices s
+ m: TwoDimensionalArray := new(n, n, 0)
+ for u in 1..n repeat
+ for v in 1..n repeat
+ qsetelt!(m,u,v, distanceWeighted(s,u,v))
+ m
@
\section{License}
--
1.7.5.4