Cadabra Computer algebra system for field theory problems

Description

Base class for all properties, handling argument parsing and defining the interface.

Properties can have arguments. Parsing of these is done in the properties object itself, with the use of some helper functions. Parsing is done by implementing the virtual function property::parse(const Kernel&, keyval_t&). The argument is a container class which represents the arguments passed to the property as key/value pairs keyval_t type.

Properties will be asked to check that they can be associated to a given pattern through the virtual property::validate(const Properties&, const Ex&) function. The FIXME: the above two need to be merged, because parse may need access to the actual pattern tree, and once we are there, we may as well do checking. HOWEVER: in TableauSymmetry.cc: FIXME: we get the wrong pattern in case of a list! We should have been fed each individual item in the list, not the list itself.

This suggests that we should be calling once for every pattern, but that is wasteful in case we are just parsing arguments. Can we really avoid calling parse for every pattern?

{A_{m n}, A_{m n p}, A_{m n p q}}::TableauSymmetry(shape={2,1}, indices={0,1,2}).

leads to a problem, because the property needs to setup its internal structures but also verify that these can match all objects in the same way.

Make all identical properties point to the same property object, so that normal and list properties become pretty much identical.

#include <Props.hh>

Inheritance diagram for cadabra::property:

Public Types

enum  match_t { no_match, id_match, exact_match }

Public Member Functions

property (bool hidden=false)

virtual ~property ()

bool parse_to_keyvals (const Ex &, keyval_t &)

virtual bool parse (Kernel &, keyval_t &keyvals)

virtual bool parse (Kernel &, std::shared_ptr< Ex >, keyval_t &keyvals)

virtual void validate (const Kernel &, const Ex &) const

virtual void latex (std::ostream &) const
Display the property on the stream. More...

virtual std::string name () const =0

virtual std::string unnamed_argument () const

virtual match_t equals (const property *) const

void hidden (bool h)
Properties can be hidden because they only make sense to the system; they will not be printed when the user asks for a list of properties. More...

bool hidden (void) const

Private Member Functions

bool parse_one_argument (Ex::iterator arg, keyval_t &keyvals)

bool hidden_

Enumerator
no_match
id_match
exact_match

◆ property()

 property::property ( bool hidden = false )

◆ ~property()

 virtual cadabra::property::~property ( )
inlinevirtual

◆ equals()

 property::match_t property::equals ( const property * ) const
virtual

◆ hidden() [1/2]

 void property::hidden ( bool h )

Properties can be hidden because they only make sense to the system; they will not be printed when the user asks for a list of properties.

◆ hidden() [2/2]

 bool property::hidden ( void ) const

◆ latex()

 void property::latex ( std::ostream & str ) const
virtual

Display the property on the stream.

Generate a LaTeX representation of the property, assuming LaTeX is in text mode (so it needs dollar symbols to switch to maths).

◆ parse() [1/2]

 bool property::parse ( Kernel & , keyval_t & keyvals )
virtual

◆ parse() [2/2]

 bool property::parse ( Kernel & kernel, std::shared_ptr< Ex > , keyval_t & keyvals )
virtual

◆ parse_one_argument()

 bool property::parse_one_argument ( Ex::iterator arg, keyval_t & keyvals )
private

◆ parse_to_keyvals()

 bool property::parse_to_keyvals ( const Ex & tr, keyval_t & keyvals )

◆ unnamed_argument()

 std::string property::unnamed_argument ( ) const
virtual

◆ validate()

 void property::validate ( const Kernel & , const Ex & ) const
virtual