# Trajsimil.m

From Spinach Documentation Wiki

Computes trajectory similarity scores. Returns a function representing "similarity" of the two state space trajectories at different points in time. Trajectory must be supplied as nstates x nsteps matrix. Syntax:

trajsimil(spin_system,trajectory_1,trajectory_2,method)

Score functions:

'RSP' - running scalar product. Computes scalar products between the corresponding vectors of the two trajectories.

'RDN' - running difference norm. The two trajectories are subtracted and difference 2-norms returned.

'SG-' - prefix that switches on state grouping. T(l,m) and T(l,-m) states of each spin (standalone or in direct products with other operators) would be deemed equivalent.

'BSG-' - prefix that switches on broad state grouping. All states of a given spin (standalone or in direct products with other operators) would be deemed equivalent.

The state grouping consists in summing the absolute squares of the coefficients to be grouped and taking the square root.

Note: SG and BSG options of this function require the spherical tensor basis set.