automaton.rweight(weight, algo="auto")

The right scalar product of an automaton by a weight.

For consistency reasons with other operations, the algo parameter can be one of these:

  • "auto"
  • "general"
  • "standard"

However, due to how the scalar product works, this makes no difference.

Postconditions:

  • when applied to standard automata, the result is standard.

See also:

In [1]:
import vcsn
a = vcsn.context('lal_char, q').expression('<2>a<3>bc', 'none').standard()
a
Out[1]:
%3 I0 0 0 I0->0 F5 1 1 0->1 ⟨2⟩a 3 3 1->3 ⟨3⟩b 5 5 3->5 c 5->F5
In [2]:
a.rweight(a.context().weight('5'))
Out[2]:
%3 I0 0 0 I0->0 F3 1 1 0->1 ⟨2⟩a 2 2 1->2 ⟨3⟩b 3 3 2->3 c 3->F3 ⟨5⟩

Instead of a.rweight(a.context().weight('5')), you may write a * 5.

In [3]:
a * 5
Out[3]:
%3 I0 0 0 I0->0 F3 1 1 0->1 ⟨2⟩a 2 2 1->2 ⟨3⟩b 3 3 2->3 c 3->F3 ⟨5⟩

To force the execution of the general algorithm you can do it this way.

In [4]:
a.rweight(a.context().weight('5'), 'general')
Out[4]:
%3 I0 0 0 I0->0 F3 1 1 0->1 ⟨2⟩a 2 2 1->2 ⟨3⟩b 3 3 2->3 c 3->F3 ⟨5⟩

However, apart from the multiplication by 0, there is no difference with the standard algorithm.