[GiNaC-list] let_op() and index

mdias at ift.unesp.br mdias at ift.unesp.br
Thu Feb 24 14:37:54 CET 2005


Thanks Chris, I modified and compiled ok. but subs() make nothing. I have to
delare a new subs() function? Is there in source a example?


Thanks a lot


Marco

class covdiff : public indexed{
  GINAC_DECLARE_REGISTERED_CLASS(covdiff,indexed)

    public:
	idx index;
        ex arg;
  ex new_index;<--------I added this
  covdiff(const ex, idx) ;
 ex &  let_op(size_t i);
 size_t nops() const;
  ex op(size_t i) const;}

ex & covdiff::let_op(size_t i)
{new_index= index;<--- Get index value
ensure_if_modifiable();
 switch (i){
  case 0:
    return arg;
     case 1:
    return new_index;<--- modified
  default:
    throw std::range_error("covdiff::op(): no such operand");
  }
}

Quoting Chris Dams <C.Dams at science.ru.nl>:

> 
> Dear Marco,
> 
> On Thu, 24 Feb 2005 mdias at ift.unesp.br wrote:
> 
> > test.cpp:88: error: invalid initialization of reference of type
> 'GiNaC::ex&'
> >    from expression of type 'GiNaC::idx'
> 
> It is better to make covdiff::index into an ex. What if somebody is going
> to initialize a covdiff from a varidx? The varidx will get stripped into
> an idx. I don't think that is what you want.
> 
> Best wishes,
> Chris
> 
> 
> 
> 
> _______________________________________________
> GiNaC-list mailing list
> GiNaC-list at ginac.de
> http://thep.physik.uni-mainz.de/mailman/listinfo/ginac-list
> 




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/




More information about the GiNaC-list mailing list