diff options
| author | Alexander <alexanderkabua@gmail.com> | 2022-04-25 11:12:38 +0300 |
|---|---|---|
| committer | Alexander <alexanderkabua@gmail.com> | 2022-04-25 11:12:38 +0300 |
| commit | 91ceb2725a1214c7d4e4eefbea682edf42e73878 (patch) | |
| tree | 6cbbfe0fb7790af3ae961f26c8dd854fc0bd6e3f | |
| parent | 6c0fb2ceb3ea757fb5e016b99497c384326b9904 (diff) | |
| parent | cd51dc6af23c41e63b06cae847282a9873851298 (diff) | |
| download | correlation_rust-91ceb2725a1214c7d4e4eefbea682edf42e73878.tar.gz | |
Merge branch 'master' of https://github.com/Alexanderlacuna/correlation_rust into main
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Cargo.lock | 48 | ||||
| -rw-r--r-- | Cargo.toml | 11 | ||||
| -rw-r--r-- | src/main.rs | 35 | ||||
| -rw-r--r-- | src/main.rs~ | 3 |
5 files changed, 98 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..bc09f3f --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,48 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "GSL" +version = "4.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c90488c022c43f0009d7e804c4925b8975296b1c7aaca4cb18e3b434f809f7c" +dependencies = [ + "GSL-sys", + "paste", +] + +[[package]] +name = "GSL-sys" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf44cd363ba6b685de2ead20a580ff72cee2e953285bd8ca8cc9208d58dace5" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "correlation_rust" +version = "0.1.0" +dependencies = [ + "GSL", +] + +[[package]] +name = "libc" +version = "0.2.124" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50" + +[[package]] +name = "paste" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" + +[[package]] +name = "pkg-config" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..4c77327 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "correlation_rust" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +GSL = "4.0" + diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..1832f9b --- /dev/null +++ b/src/main.rs @@ -0,0 +1,35 @@ +use rgsl::{ + randist::t_distribution::{tdist_P, tdist_Q}, + statistics::{correlation, spearman}, +}; + + +trait Correlation { + fn correlate(&self,x:&[f64],y:&[f64]) ->(f64,f64); +} + +struct Pearson { + n: usize, + degree_of_freedom:f64, +} + +impl Pearson { + fn new(n:usize) -> Self { + + Self { + n, + degree_of_freedom:(n - 2) as f64, + } + } +} + + +impl Correlation for Pearson { + fn correlate(&self,x:&[f64],y:&[f64]) ->(f64,f64){ + (1.2,0.1) + } +} + +fn main() { + +} diff --git a/src/main.rs~ b/src/main.rs~ new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs~ @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} |
