CCEX-1.0.0
Loading...
Searching...
No Matches
cluster_hash.h
1#ifndef __CCEX_CLUSTER_HASH_H_
2#define __CCEX_CLUSTER_HASH_H_
3
4#include <string.h> /* strcpy */
5#include <stdlib.h> /* malloc */
6#include <stdio.h> /* printf */
7#include <time.h>
8#include "../zlib/uthash/src/uthash.h"
9
10#include "cluster.h"
11
12typedef struct {
13 // id : clustered spin indeices(char)
14 // spins : clustered spin
15 // strength : coupling strength
16 const char *id;
17 int *spins;
18 float strength;
19 // solve tilde
20 // [0][0][0] : None
21 // [i][0][0] : The number of subclusters
22 // [i][j][0] : each subcluster j, length = order
23 // [i][j][k] : k-th spin in j-th subcluster
24 //int*** subclusters_connected;
25 //int*** subclusters_notConnected;
26
27 // count : The number that you have to multi. or div.
28 int count;
29
30 UT_hash_handle hh;
31} Property;
32
33typedef struct {
34 //N : cluster order
35 //prop : cluster properties
36 const char* N;
37 Property *prop;
38 UT_hash_handle hh;
40
41void clusterizeHash(Cluster* CCE, int nspin, int** spmap, float** stmap);
42void convertClusinfoToHash(HashCluster** hashClusters, Cluster* CCE);
43void solveTilde(HashCluster** hashcluster, Cluster* CCE, int nspin);
44
45void makeHashClusterO1(HashCluster** hashclusters, int nspin);
46void makeHashClusterO2(HashCluster** hashclusters, int nspin, int** spmap, float** stmap);
47void makeHashClusterOn(HashCluster** hashclusters, int order, int nspin, int** spmap, float** stmap, int* nks); //nks = CCE->nk
48
49void freeHashCluster(HashCluster** hashClusters, int order);
50
51int addCluster(HashCluster** hashClusters, int order, const char* id,int* spins, float strength,int count);
52int by_strength(const Property* a, const Property* b);
53HashCluster* findCluster(HashCluster* hashClusters, int order);
54
55int setMaxLengthStr(int nSpin, int order);
56
57void addSpin(int** newcluster, int* oldcluster, int oldn, int spin);
58void typeStr(char** destination, int* cluster, int order, int nSpin);
59
60int binarySearch(int* arr, int low, int high, int target);
61
62float minStrength(float currentStrength, float** strengthMap, int* oldcluster, int oldn, int newspin);
63float addAllStrength(float currentStrength, float** strengthMap, int* oldcluster, int oldn, int newspin);
64
65void printClusters(HashCluster* hashClusters);
66void printProperties(Property* hashProperties);
67
68int* parseClusterIdToIntArray(const char* id, int* count);
69int countDigits(int number);
70int search2dArr(int** arr, int low, int high, int left, int right, int* target);
71
72void updateNk(int** Nk, int order, HashCluster* hashClusters);
73void addSubClusters(HashCluster** hashclusters, int nspin, float** stmap, int n);
74void generateCombinations(int* arr, int*** data, int* tempCombination, int start, int end, int index, int r, int* nCombination);
75float addAllStrengthForAllSpins(float** strengthMap, int* cluster, int order);
76
77#endif // __CCEX_CLUSTER_HASH_H_
Definition cluster.h:16
Definition cluster_hash.h:33
Definition cluster_hash.h:12