According to the original paper, EDR calculate diatances in the manner of dynamic programming, where n and m are the lengths of the compared trajectories and the lengths would be different in different subproblems. So instead of assigning zeros, here should initialize C with lengths of different sub-trajectories at the first row and first column.
The distance did not divided by the longest length in the original paper. And according to my own experiments, divided by the longest length will give bad case when the lengths of two compared trajectories are far more different.
Thx!