This commit is contained in:
shenjack 2024-03-17 12:07:00 +08:00
parent a7f0468507
commit f4cd58547f
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 33 additions and 0 deletions

View File

@ -47,6 +47,8 @@ pub fn predict_13(name: &Namer) -> f64 {
let mut simds = xuping13::MODULE.clone();
let simd_module = simds.as_simd_mut::<64>();
let simd_target = target.as_simd_mut::<64>();
println!("module = {:?}", simd_module);
println!("target = {:?}", simd_target);
// 前面多出来的
for i in 0..simd_module.0.len() - 1 {
sum += simd_module.0[i] * simd_target.0[i];
@ -81,11 +83,13 @@ pub fn predict_13(name: &Namer) -> f64 {
let mut cnt = 0;
for i in 0..43 {
sum += st[i] * xuping13::MODULE[cnt];
print!("{} ", sum);
cnt += 1;
}
for i in 0..43 {
for j in i..43 {
sum += st[i] * st[j] * xuping13::MODULE[cnt];
print!("{} ", sum);
cnt += 1;
}
}
@ -121,3 +125,19 @@ pub fn poly(name: &Namer) -> [f64; 1034] {
}
pub fn predict_20(name: &Namer) -> f64 { 0.0 }
#[cfg(test)]
mod test {
use super::*;
use crate::name::Namer;
#[test]
fn xuping_13_test() {
let mut namer = Namer::new(&"x@x".to_string()).unwrap();
namer.update_skill();
println!("{:?}", predict_13(&namer));
panic!();
}
}

View File

@ -418,6 +418,19 @@ mod test {
assert_eq!(namer.skl_freq.to_vec(), skill_prop_vec);
}
#[test]
fn skill_id_test() {
let team = TeamNamer::new_unchecked("x");
let mut namer = Namer::new_from_team_namer_unchecked(&team, "x");
namer.update_skill();
let skill_id_vec: Vec<u8> = vec![
9, 13, 12, 38, 4, 27, 26, 15, 16, 32, 24, 5, 7, 21, 18, 10, 37, 2, 6, 20, 39, 1, 14, 3,
11, 29, 22, 33, 19, 0, 30, 31, 17, 28, 34, 35, 23, 8, 25, 36,
];
assert_eq!(namer.skl_id.to_vec(), skill_id_vec);
}
#[test]
fn prop_test() {
let team = TeamNamer::new_unchecked("x");