The file graph.spad.pamphlet contains the line

  weightedDistanceMatrix:(%) -> Matrix WEIGHT

where

 W: OrderedAbelianMonoid
 WEIGHT ==> Union(W,"disjoint")

We all know that Matrix requires Join(SemiRng, AbelianMonoid), so this code is wrong, since Union does not export anything of that kind.

Also

  distanceWeighted:(s:%,a:NNI,b:NNI) -> WEIGHT
    ++ the shortest distance between 'a' and 'b' in terms of
    ++ weight.

does not look like a good documentation. It does not mention anything about the option of returning "disjoint".

Martin, I once did a similar change in jet.spad.pamphlet. Replace Matrix by TwoDimensionalArray.

Interestingly, when I apply the attached patch, already fricas cannot be compiled (i.e it compiles with Matrix but not with TwoDiminsionalArray). Strange.

Ralf

=====================================================================
Failing compilation with patch applied.
=====================================================================
.....
   Compiling FriCAS source code from file
      /home/hemmecke/v/git/fricas-bisect/b/src/algebra/WGRPH.spad using
      old system compiler.
   WGRPH abbreviates domain WeightedGraph
------------------------------------------------------------------------
   initializing NRLIB WGRPH for WeightedGraph
   compiling into NRLIB WGRPH
   processing macro definition sayMsg ==> elt(Lisp,sayBrightly)
processing macro definition math_to_string ==> elt(Lisp,mathObject2String)
   compiling exported weightedGraph : List S -> $
Time: 0.02 SEC.

compiling exported weightedGraph : List Record(value: S,posX: NonNegativeInteger,posY: NonNegativeInteger,weight: W) -> $
      WGRPH;weightedGraph;L$;2 is replaced by CONSob
Time: 0.00 SEC.

compiling exported weightedGraph : (List Record(value: S,posX: NonNegativeInteger,posY: NonNegativeInteger,weight: W),List Record(name: String,weight: W,fromOb: NonNegativeInteger,toOb: NonNegativeInteger,xOffset: Integer,yOffset: Integer)) -> $
      WGRPH;weightedGraph;LL$;3 is replaced by CONS
Time: 0.00 SEC.

compiling exported weightedGraph : (List Record(value: S,posX: NonNegativeInteger,posY: NonNegativeInteger),List Record(name: String,arrType: NonNegativeInteger,fromOb: NonNegativeInteger,toOb: NonNegativeInteger,xOffset: Integer,yOffset: Integer)) -> $
Time: 0.04 SEC.

compiling exported weightedGraph : (List S,List List NonNegativeInteger) -> $
Time: 0.38 SEC.

   compiling exported addObject! : ($,S) -> $
Time: 0.00 SEC.

compiling exported addObject! : ($,Record(value: S,posX: NonNegativeInteger,posY: NonNegativeInteger)) -> $
Time: 0.00 SEC.

compiling exported addArrow! : ($,String,NonNegativeInteger,NonNegativeInteger) -> $
Time: 0.00 SEC.

compiling exported addWArrow! : ($,String,NonNegativeInteger,NonNegativeInteger,W) -> $
Time: 0.00 SEC.

compiling exported getVertices : $ -> List Record(value: S,posX: NonNegativeInteger,posY: NonNegativeInteger)
Time: 0.00 SEC.

compiling exported getArrows : $ -> List Record(name: String,arrType: NonNegativeInteger,fromOb: NonNegativeInteger,toOb: NonNegativeInteger,xOffset: Integer,yOffset: Integer)
Time: 0.00 SEC.

   compiling exported initial : () -> $
      WGRPH;initial;$;12 is replaced by CONS
Time: 0.00 SEC.

   compiling exported terminal : S -> $
Time: 0.02 SEC.

   compiling exported cycleOpen : (List S,String) -> $
Time: 0.02 SEC.

   compiling exported cycleClosed : (List S,String) -> $
Time: 0.02 SEC.

   compiling exported unit : (List S,String) -> $
Time: 0.01 SEC.

   compiling exported kgraph : (List S,String) -> $
Time: 0.01 SEC.

   compiling exported + : ($,$) -> $
Time: 0.01 SEC.

   compiling exported merge : ($,$) -> $
Time: 0.02 SEC.

compiling local objProd : ($,$) -> List Record(value: Product(S,S),posX: NonNegativeInteger,posY: NonNegativeInteger,weight: W)
Time: 0.01 SEC.

compiling local indexProd : ($,NonNegativeInteger,NonNegativeInteger) -> NonNegativeInteger
Time: 0.00 SEC.

   compiling exported * : ($,$) -> WeightedGraph(Product(S,S),W)
   Internal Error
   Error while instantiating type WeightedGraph(Product S S)W

(1) -> cp WGRPH.NRLIB/WGRPH.fasl /home/hemmecke/g/fricas-bisect/b/target/x86_64-unknown-linux/algebra/WGRPH.fasl
cp: cannot stat `WGRPH.NRLIB/WGRPH.fasl': No such file or directory
make[4]: *** [/home/hemmecke/g/fricas-bisect/b/target/x86_64-unknown-linux/algebra/WGRPH.fasl] Error 1 make[4]: Leaving directory `/home/hemmecke/v/git/fricas-bisect/b/src/algebra'
make[3]: *** [do-update-spads] Error 2
make[3]: Leaving directory `/home/hemmecke/v/git/fricas-bisect/b/src/algebra'
make[2]: *** [all-ax] Error 2
make[2]: Leaving directory `/home/hemmecke/v/git/fricas-bisect/b/src/algebra'
make[1]: *** [all-algebra] Error 2
make[1]: Leaving directory `/home/hemmecke/v/git/fricas-bisect/b/src'
make: *** [all-src] Error 2

--
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 17da04e85efa9978e4282e726ac3c50fc2eaa4b6 Mon Sep 17 00:00:00 2001
From: Ralf Hemmecke <[email protected]>
Date: Wed, 15 Feb 2012 23:29:23 +0100
Subject: Matrix --> TwoDimensionalArray

---
 src/algebra/graph.spad.pamphlet |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/algebra/graph.spad.pamphlet b/src/algebra/graph.spad.pamphlet
index 4deb1fa..fb9a546 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,7 +4677,7 @@ WeightedGraph(S,W): Exports == Implementation where
     res
 
   -- Distance weights between nodes.
-  weightedDistanceMatrix(s:%):Matrix WEIGHT ==
+  weightedDistanceMatrix(s:%):TwoDimensionalArray WEIGHT ==
     m:List List WEIGHT := [[distanceWeighted(s,u,v)_
           for u in 1..#(getVertices s)]for v in 1..#(getVertices s)]
     matrix(m)
-- 
1.7.5.4

Reply via email to