Fix saving lists of arrays with recent versions of numpy
[qpms.git] / qpms / symmetries.h
blob97e15cd3b18c793cb80c3d2a9a760ca8dab7d426
1 /*! \file symmetries.h
2 * \brief Functions providing point group operations operating on translation
3 * operators and T-matrices.
5 * Here will be functions providing point group operations
6 * operating on translation operators and T-matrices
7 * similar to tmatrices.py.
8 *
9 * At least I want:
10 * - Wigner D matrices
11 * - Basic mirror operations for T-matrices
12 * - Inversion operation for the translation matrices
14 * Maybe (much later) also point and space group irrep
15 * functionality as in symmetries.py.
16 * However, I think that the group structures can be simply
17 * hard-coded/generated by a python script, then there is
18 * no need to check the group consistency etc. at runtime.
22 #ifndef SYMMETRIES_H
23 #define SYMMETRIES_H
24 #include "qpms_types.h"
25 #include <cblas.h>
27 /// Dense matrix representation of the z coordinate sign flip operation (xy-plane mirroring).
28 complex double *qpms_zflip_uvswi_dense(
29 complex double *target, ///< If NULL, a new array is allocated.
30 const qpms_vswf_set_spec_t *bspec);
31 /// Dense matrix representation of the y coordinate sign flip operation (xz-plane mirroring).
32 complex double *qpms_yflip_uvswi_dense(
33 complex double *target, ///< If NULL, a new array is allocated.
34 const qpms_vswf_set_spec_t *bspec);
35 /// Dense matrix representation of the x coordinate sign flip operation (yz-plane mirroring).
36 complex double *qpms_xflip_uvswi_dense(
37 complex double *target, ///< If NULL, a new array is allocated.
38 const qpms_vswf_set_spec_t *bspec);
39 /// Dense matrix representation of a rotation around the z-axis
40 complex double *qpms_zrot_uvswi_dense(
41 complex double *target, ///< If NULL, a new array is allocated.
42 const qpms_vswf_set_spec_t *bspec,
43 double phi ///< Rotation angle
45 /// Dense matrix representation of a "rational" rotation around the z-axis
46 /** Just for convenience. Corresponds to the angle \f$ \phi = 2\piw/N \f$.
48 complex double *qpms_zrot_rational_uvswi_dense(
49 complex double *target, ///< If NULL, a new array is allocated.
50 const qpms_vswf_set_spec_t *bspec,
51 int N,
52 int w
55 /// Dense matrix (uvswi-indexed) representation of any O(3) transformation.
56 complex double *qpms_irot3_uvswfi_dense(
57 complex double *target, ///< If NULL, a new array is allocated.
58 const qpms_vswf_set_spec_t *bspec,
59 const qpms_irot3_t transf);
61 // Some auxilliary functions for "numerical cleaning" of the roundoff error
63 /// Cleans the roundoff error of an array.
64 /**
65 * Replaces all the array members \a x for which |\a x| <= \a atol
66 * with exact zeros.
68 * Returns the count of modified array members.
70 size_t qpms_zero_roundoff_clean(double *arr, size_t nmemb, double atol);
72 /// Cleans the roundoff error of an array.
73 /**
74 * Works on real and imaginary parts separately.
75 * TODO doc.
77 size_t qpms_czero_roundoff_clean(complex double *arr, size_t nmemb, double atol);
78 #endif // SYMMETRIES_H