[][src]Crate frank

Traits

Fetching

frank::Fetching can be implemented for generic vectors that support Clone with 'use frank::Fetching;' It allows vector.fetch(&your_picks_vec_usize) and vector.fetch_guard(&your_picks_vec_usize). fetch is fast and fetch_guard is index guarded, won't terminate but does eprint!'s index errors and still returns computable results.

Ranking

frank::Ranking can be used with any generic vector that implements PartialOrd and Clone, and will return rankings from "greatest = 0" to least. just 'use frank::Ranking' for bolt on vector ranking functions like 'let myranks = myvector.rank();' Useful for non-parametric statistics like the difference between vec![82, 65, 78, 69, 68].rank() and vec!["r","a","n","k","ed"].rank()

Functions

example_code
fetch_fast

fetch_fast has no slow branching if-then checks on index values, it just returns what it is asked to and terminates program if out of index.

fetch_guard

vector.fetch(&my_borrowed_usize_list) will return a vector of your usized picks. Error tollerant and useful for user guided selective statistics, computation of quatriles and building custom scrolling levels out of 8 bit character bitmaps from selections that previously caused the most player deaths (maybe?) use one of two ways: genericvector.fetch(&vector_usize_index_picks) or from the function with fetch_guard(&genericvector, &your_usize_picklist) #Example
use frank::Fetching;
fn test_fetch() { let a = vec!["oh", "1", "two", "3", "four"]; let pick = vec![4usize, 0, 4]; let lost = a.fetch(&pick); println!("{:?}", lost); }

imean

fn imean(vector) takes generic vector primitives and calculates a every bit accurate (if not especially fast) integer mean for long vector primitives 64 bits or smaller. Potentially useful for signal processing where the signal could be obscured by sig. digit loss in f64 values. Rounds half and up away from zero and less than half towards zero (-9/4-> -2, 9/2 -> 4). Not recommended for 128bit primitives unless addition overflow in 128bits can always be avoided.

rank_count_greater

rank_count_greater(&borrowedboxedtea) borrows a generic vector and returns a usize vector list of the count of greater items for each item. Large items get small ranks, small items get large ranks. The greatest value in a list scores a zero rank, while the item with 30 superiors earns rank 30 - based on the ranking system described by Wassily Hoeffding in 1947. Note: a tie for second place means there can be no third place rank but still allows a fourth place award unless there were multiple second place times.
Useful for nonparametric statistics and javelin throw competitions. Equivalent to vector.rank() method.

rank_count_lesser

vector.rank_count_lesser() borrows a generic vector and returns a usize vector list of the count of lesser items in the generic vector. Small values score small ranks, large values score large ranks. The smallest value in a list scores a zero rank, based on a ranking system described by Wassily Hoeffding in 1947. Note: a tie for second place means there can be no third place rank but still allows a fourth place award. Useful for nonparametric statistics, say for comparison of 5k race times... which reminds me of a joke. So twin photons, a zippy electron and a massive proton all have a race. The proton is positive he'll finish last, and of course the photon twins win because they travel light. The ranks of such a race would likely be: 0,0,2,3 or 0,0,2,2.

rank_dense_greater

rank_dense_greater(&generictea) returns dense ranks where large values get smaller ranks, and small values get larger ranks. Dense Ranks Explained: If three javelin throwers win in a tie should they be awarded three third place metals and no first place metals, or three first places? And would the second place and third place metals get be awarded to other competitors? If scored with dense ranks, the answer is yes there are three first places, and yes there is a second and third place rank, no ranks get skipped. Uneven steps between clusters can hatch data illusions, and dense ranks always have predictable steps. That said, dense ranks do lose cluster size information.

rank_dense_lesser

rank_dense_lesser(&generictea) returns dense ranks where large values get larger ranks, and small values get smaller ranks. Smallest value takes a zero rank. Dense Ranks Explained: If three racers win in a time tie should they be awarded three third place metals and no first place metals, or three first places? And would the second place and third place metals get be awarded to other competitors? If scored with dense ranks, the answer is yes there are three first places, and yes there is a second and third place rank, no ranks get skipped. Uneven steps between clusters can hatch data illusions, and dense ranks always have predictable steps. That said, dense ranks do lose cluster size information.

rrank

rrank() follows the R Language rank() convention with the result as Vec. rrank R Example: x<- c(7,2,2,5); rank(x) yields (4.,1.5,1.5,3.)

sequence_linear_sum

fn sequence_linear_sum(usize_n) computes the total of a range from 1 to usize_n. Overflow possible for large n, like 6074000999 with 64bit usize.

sequence_square_sum

fn seq_sum_of_squares(usize_n) uses discrete calculus to compute the sum of 1^2 + 2^2 + 3^2... n^2 --> (2n^3 + 3n^2 + n)/6 without the repetition of adding each element by way of a tiny bit of discrete calculus. Overflow possible for large n like 3810776 for 64bit usize. useful for certain comparisions, or do twice and subtract for a partial sum of squares between say 23901^2 and 24824^2.