-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from abstractqqq/restructure
restructured rust code org
- Loading branch information
Showing
49 changed files
with
245 additions
and
219 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,64 @@ | ||
/// This submodule is mostly taken from the project statrs. See credit section in README.md | ||
/// The reason I do not want to add it as a dependency is that it has a nalgebra dependency for | ||
/// multi-variate distributions, which is something that I think will not be needed in this | ||
/// package. Another reason is that if I want to do linear algebra, I would use Faer since Faer | ||
/// performs better and nalgebra is too much of a dependency for this package right now. | ||
pub mod beta; | ||
pub mod gamma; | ||
pub mod normal; | ||
|
||
pub const PREC_ACC: f64 = 0.0000000000000011102230246251565; | ||
pub const LN_PI: f64 = 1.1447298858494001741434273513530587116472948129153; | ||
//pub const LN_SQRT_2PI: f64 = 0.91893853320467274178032973640561763986139747363778; | ||
pub const LN_2_SQRT_E_OVER_PI: f64 = 0.6207822376352452223455184457816472122518527279025978; | ||
|
||
#[inline] | ||
pub fn is_zero(x: f64) -> bool { | ||
x.abs() < PREC_ACC | ||
mod chi2; | ||
mod fstats; | ||
mod ks; | ||
mod normal_test; | ||
mod sample; | ||
mod t_test; | ||
|
||
use polars::prelude::*; | ||
|
||
pub fn list_float_output(_: &[Field]) -> PolarsResult<Field> { | ||
Ok(Field::new( | ||
"list_float", | ||
DataType::List(Box::new(DataType::Float64)), | ||
)) | ||
} | ||
|
||
pub fn simple_stats_output(_: &[Field]) -> PolarsResult<Field> { | ||
let s = Field::new("statistic", DataType::Float64); | ||
let p = Field::new("pvalue", DataType::Float64); | ||
let v: Vec<Field> = vec![s, p]; | ||
Ok(Field::new("", DataType::Struct(v))) | ||
} | ||
|
||
struct StatsResult { | ||
pub statistic: f64, | ||
pub p: Option<f64>, | ||
} | ||
|
||
impl StatsResult { | ||
pub fn new(s: f64, p: f64) -> StatsResult { | ||
StatsResult { | ||
statistic: s, | ||
p: Some(p), | ||
} | ||
} | ||
|
||
pub fn from_stats(s: f64) -> StatsResult { | ||
StatsResult { | ||
statistic: s, | ||
p: None, | ||
} | ||
} | ||
|
||
pub fn unwrap_p_or(&self, default: f64) -> f64 { | ||
self.p.unwrap_or(default) | ||
} | ||
} | ||
|
||
pub enum Alternative { | ||
TwoSided, | ||
Less, | ||
Greater, | ||
} | ||
|
||
impl From<&str> for Alternative { | ||
fn from(s: &str) -> Alternative { | ||
match s.to_lowercase().as_str() { | ||
"two-sided" | "two" => Alternative::TwoSided, | ||
"less" => Alternative::Less, | ||
"greater" => Alternative::Greater, | ||
_ => Alternative::TwoSided, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/// This submodule is mostly taken from the project statrs. See credit section in README.md | ||
/// The reason I do not want to add it as a dependency is that it has a nalgebra dependency for | ||
/// multi-variate distributions, which is something that I think will not be needed in this | ||
/// package. Another reason is that if I want to do linear algebra, I would use Faer since Faer | ||
/// performs better and nalgebra is too much of a dependency for this package right now. | ||
pub mod beta; | ||
pub mod gamma; | ||
pub mod normal; | ||
|
||
pub const PREC_ACC: f64 = 0.0000000000000011102230246251565; | ||
pub const LN_PI: f64 = 1.1447298858494001741434273513530587116472948129153; | ||
//pub const LN_SQRT_2PI: f64 = 0.91893853320467274178032973640561763986139747363778; | ||
pub const LN_2_SQRT_E_OVER_PI: f64 = 0.6207822376352452223455184457816472122518527279025978; | ||
|
||
#[inline] | ||
pub fn is_zero(x: f64) -> bool { | ||
x.abs() < PREC_ACC | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/str_ext/snowball/snowball_env.rs → src/str2/snowball/snowball_env.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.