pub fn spearman_footrule<K: OrDistElement>(
    v1: &[K],
    v2: &[K],
    m: ModeSF,
) -> Result<usize, OrDistError<K>> {
    let (om1, om2) = ordmaps_identical(v1, v2)?;
    Ok(om1
        .data
        .keys()
        .map(|k| (om1.get(k), om2.get(k)))
        .map(|(r1, r2)| {
            let r = sub_abs(r1, r2);
            match m {
                ModeSF::Spearman => r * r,
                ModeSF::Footrule => r,
            }
        })
        .sum())
}
/// The core function of Spearman & Footrule distance.
The core function of Spearman & Footrule distance.
The core function of Spearman & Footrule distance .
pub fn spearman_footrule<K: OrDistElement>(
    v1: &[K],
    v2: &[K],
    m: ModeSF,
) -> Result<usize, OrDistError<K>> {
    let (om1, om2) = ordmaps_identical(v1, v2)?;
    Ok(om1
        .data
        .keys()
        .map(|k| (om1.get(k), om2.get(k)))
        .map(|(r1, r2)| {
            let r = sub_abs(r1, r2);
            match m {
                ModeSF::Spearman => r * r,
                ModeSF::Footrule => r,
            }
        })
        .sum())
}
pub fn spearman_footrule < K : OrDistElement > ( v1 : & [ K ] , v2 : & [ K ] , m : ModeSF , ) -> Result < usize , OrDistError < K > > { let ( om1 , om2 ) = ordmaps_identical ( v1 , v2 ) ? ; Ok ( om1 . data . keys ( ) . map ( | k | ( om1 . get ( k ) , om2 . get ( k ) ) ) . map ( | ( r1 , r2 ) | { let r = sub_abs ( r1 , r2 ) ; match m { ModeSF :: Spearman => r * r , ModeSF :: Footrule => r , } } ) . sum ( ) ) }
The core function of Spearman & Footrule distance.
The core function of Spearman & Footrule distance .
v1
&[K]
v2
&[K]
m
ModeSF
v1
&[K]
v2
&[K]
m
ModeSF