Franz Lehner wrote:
> 
> I have been playing with CCR (asked recently here by a physicist).
> It is a hypergroup like object and I tried the following:
> Define multiplication from the basis into FreeModule(basis)
> and then extend it linearly.
> However I keep getting the following error when compiling the attached file
> (a simplified version). What is expected to be an ordered set here?
> ------------------------------------------------------------------------
>    initializing NRLIB CCRA for CCRAlgebra 
>    compiling into NRLIB CCRA 
>    compiling exported * : ($,$) -> $
> ****** comp fails at level 1 with expression: ******
> error in function * 
> 
> ($)
> ****** level 1  ******
> $x:= $
> $m:= (OrderedSet)
> $f:=
> ((((|res1| #) (|y1| # #) (|x1| # #) (|last| #) ...)))
> 
>    >> Apparent user error:
>    Cannot coerce $ 
>       of mode (Algebra R) 
>       to mode (OrderedSet) 

> 
> )abbrev category HGB HGBasis
> ++ blabla
> HGBasis(R:CommutativeRing):Category == OrderedSet with
>         _*:(%,%)-> FreeModule(R,%)
> 
> )abbrev domain CCRB CCRBasis
> ++ blabla
> CCRBasis(R:CommutativeRing):HGBasis(R) == Symbol add
>     (x:%,y:%):FreeModule(R,%) == monomial(1,x)
>     
> )abbrev domain CCRA CCRAlgebra
> ++ blabla
> CCRAlgebra(R:CommutativeRing):Algebra(R) == FreeModule(R,CCRBasis(R)) add
>     Rep:= FreeModule(R,CCRBasis(R))
>     x,y:%
>     x1,y1:Record(k:CCRBasis(R),c:R)
>     
>     x * y ==
           res : % := 0
>          for x1 in listOfTerms (x::Rep) repeat
>              for y1 in listOfTerms (y::Rep) repeat
>                  res1:% := (x1 k * y1 k)
>                  res:=  (x1 c * y1 c)*res1 + res
>          res
> 

This example (after adding missing initialization of 'res') works
now.  The problem was caused by compilation of types of imported
functions.  Compiler got confused because in such types '$'
means domain in which function was defined while compiler
treats '$' as current domain.  In revision 1138 I commited
a workaround which does not handle some complicated cases, but
should handle the most important ones (and can be extended
if needed).

-- 
                              Waldek Hebisch
[email protected] 

-- 
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.

Reply via email to