pub struct RankedSet<T> {
    pub ascending: bool,
    pub v: Vec<T>,
    pub i: Vec<usize>,
}
Expand description

Struct holding an unordered set and a vector of its ranks (ascending or descending).

Fields

ascending: boolv: Vec<T>i: Vec<usize>

Implementations

Initialiser, ranks an unordered slice

Initialiser, ranks an unordered Set

From Ordered - the index will be trivial

Converts sort index to ranks

Trait Implementations

Display implemented for struct IndexedSet.

Formats the value using the given formatter. Read more

The primitive functions from indxvec all expect indexed sets, so for now we convert from ranks to sort indices using .invindex(). Even though that is a simple operation, for lots of set operations, it will be slightly quicker to work in IndexedSet(s) and only to rank the final result.

just make the ranks descending

deletes repetitions.

Union of two IndexedSets.

Intersection of two IndexedSets

Complement of s in self (i.e. self-s)

For lots of set operations, it is probably better to work in IndexedSet(s) and then only to rank the final result.

switches between ascending and descending ranks, which is what is logically expected here but it is not the same as a literal reversal of the ranks!

Deletes repetitions.

Finds minimum, minimum’s first index, maximum, maximum’s first index

True if m is a member of the set

Search a Set for m. Returns index of the first m.

Union of two RankedSets. Returns an OrderedSet

Intersection of two RankedSets. Via OrderedSet for convenience, for now. Todo: Probably should use intersect_indexed as in union above.

Complement of s in self (i.e. self-s)

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Method to serialize generic items, slices, and slices of Vecs.

Method gr() to serialize and make the resulting string bold green when printed. This is the default implementation applicable to all types that trait Printing is implemented for Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.