updates
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <new>
|
||||
#include <initializer_list>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@ -89,6 +90,7 @@ public:
|
||||
ipermutation(const int _length);
|
||||
ipermutation(const int _index, const int _length);
|
||||
ipermutation(const int *parray, const int _length);
|
||||
ipermutation(std::initializer_list<int> q);
|
||||
~ipermutation();
|
||||
|
||||
ipermutation(const ipermutation& other);
|
||||
@ -98,6 +100,8 @@ public:
|
||||
ipermutation operator=(const ipermutation &other);
|
||||
int& operator[](const int ind);
|
||||
const int& operator[](const int ind) const;
|
||||
int& at(const int ind);
|
||||
const int& at(const int ind) const;
|
||||
|
||||
bool valid() const;
|
||||
bool operator==(const ipermutation other) const;
|
||||
@ -121,6 +125,8 @@ public:
|
||||
|
||||
void print(int style=0);
|
||||
|
||||
void recalc_from_perm();
|
||||
|
||||
};
|
||||
|
||||
ipermutation ipermutation_first(int _nlength);
|
||||
@ -128,18 +134,54 @@ ipermutation ipermutation_last(int _nlength);
|
||||
int levi_civita(const ipermutation p);
|
||||
|
||||
void test_ipermutation1();
|
||||
void test_ipermutation2();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// non-indexable permutation class
|
||||
// the same permutation logic, but for larger permutation sets
|
||||
// can't index, can't increment or decrement a sequence, but can still
|
||||
// compose, test validity, test levi_civita sign, apply to arrays, etc.
|
||||
//
|
||||
//maybe I *can* increment/decrement by converting to a multi-index (later, possibly not essential)
|
||||
class permutation
|
||||
{
|
||||
public:
|
||||
int length;
|
||||
int *data;
|
||||
|
||||
permutation();
|
||||
permutation(const int _length);
|
||||
permutation(const int *parray, const int _length);
|
||||
permutation(std::initializer_list<int> q);
|
||||
~permutation();
|
||||
|
||||
permutation(const permutation& other);
|
||||
|
||||
int resize(const int _nlength);
|
||||
|
||||
permutation operator=(const permutation &other);
|
||||
|
||||
bool valid() const;
|
||||
bool operator==(const permutation &other) const;
|
||||
|
||||
int& operator[](const int ind);
|
||||
const int& operator[](const int ind) const;
|
||||
int& at(const int ind);
|
||||
const int& at(const int ind) const;
|
||||
|
||||
|
||||
|
||||
static permutation first(int length);
|
||||
static permutation last(int length);
|
||||
|
||||
permutation operator*(const permutation &other) const; //composition
|
||||
permutation inverse() const;
|
||||
|
||||
int _intl_calculate_mindex(int *mindex, int *wrk);
|
||||
int levi_civita();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user