Skip to content

Commit

Permalink
Uninitialized variable leads to silly numbering of Z-classes (#10)
Browse files Browse the repository at this point in the history
* Uninitialized variable leads to silly numbering of Z-classes

* testfile for bugfix

* fix numbering of homogeneously decomposable groups
  • Loading branch information
gaehler authored and DominikBernhardt committed Nov 30, 2018
1 parent b500d26 commit d979dc9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
5 changes: 3 additions & 2 deletions functions/ZZ/q2z.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "ZZ_zclass_P.h"
#include "ZZ_cen_fun_P.h"
#include "graph.h"

#include "datei.h"

int IDEM_NO;
extern int INFO_LEVEL;
Expand Down Expand Up @@ -615,8 +615,9 @@ bravais_TYP **q2z(bravais_TYP *G,
for (i = 0;i<100 ; l = l && G->divisors[i] == 0, i++);
if ((k && G->dim > 4) ||
(k && l )){
GROUPS = (bravais_TYP **) malloc(1 * sizeof(bravais_TYP *));
GROUPS = (bravais_TYP **) malloc(2 * sizeof(bravais_TYP *));
GROUPS[0] = copy_bravais(G);
GROUPS[1] = (bravais_TYP * ) 1;
if (GROUPS[0]->normal && GROUPS[0]->normal_no > 0){
for (k=0;k<GROUPS[0]->normal_no;k++) free_mat(GROUPS[0]->normal[i]);
free(GROUPS[0]->normal);
Expand Down
2 changes: 1 addition & 1 deletion src/qtoz.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main(int argc,char **argv){
int i,
no,
adnumber = 0,
second_number;
second_number = 0;

char comment[1000],
file[1000];
Expand Down
23 changes: 23 additions & 0 deletions tst/QtoZ.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
####### There are 1 classes of groups
#g1 f3 n4 % 1-th homogenously dec. group, 1 zclass
2 % generator
1 0
0 1
2d1 % invariant form
1 0
2x0 % invariant form
0
1 0
2d1 % invariant form
0 1
2d1 % generator of normalizer
-1 1
2 % generator of normalizer
1 1
0 1
2x0 % generator of normalizer
0
1 0
2x0 % generator of normalizer
0
1 0
2 changes: 2 additions & 0 deletions tst/QtoZ.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Testing numbering of Z-classes
../bin/carat/QtoZ grp2.dat
4 changes: 4 additions & 0 deletions tst/grp2.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#g1
2 % generator
1 0
0 1

0 comments on commit d979dc9

Please sign in to comment.