Add C gridsys library tests

test_gridsys_get_reciprocal_point_group_rutile
test_gridsys_get_reciprocal_point_group_zincblende
test_gridsys_get_snf3x3
test_gridsys_get_snf3x3_AgNO2
test_gridsys_transform_rotations
test_gridsys_get_thm_integration_weight
This commit is contained in:
Atsushi Togo 2023-01-23 18:17:41 +09:00
parent ff4d64c0aa
commit 626910a210
3 changed files with 394 additions and 33 deletions

View File

@ -1,10 +1,97 @@
#include <gtest/gtest.h>
extern "C" {
#include <math.h>
#include "gridsys.h"
#include "utils.h"
}
// Point group operations of rutile {R^T}
const long rutile_rec_rotations[16][3][3] = {
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}},
{{0, 1, 0}, {-1, 0, 0}, {0, 0, 1}}, {{0, -1, 0}, {1, 0, 0}, {0, 0, -1}},
{{-1, 0, 0}, {0, -1, 0}, {0, 0, 1}}, {{1, 0, 0}, {0, 1, 0}, {0, 0, -1}},
{{0, -1, 0}, {1, 0, 0}, {0, 0, 1}}, {{0, 1, 0}, {-1, 0, 0}, {0, 0, -1}},
{{1, 0, 0}, {0, -1, 0}, {0, 0, -1}}, {{-1, 0, 0}, {0, 1, 0}, {0, 0, 1}},
{{0, -1, 0}, {-1, 0, 0}, {0, 0, -1}}, {{0, 1, 0}, {1, 0, 0}, {0, 0, 1}},
{{-1, 0, 0}, {0, 1, 0}, {0, 0, -1}}, {{1, 0, 0}, {0, -1, 0}, {0, 0, 1}},
{{0, 1, 0}, {1, 0, 0}, {0, 0, -1}}, {{0, -1, 0}, {-1, 0, 0}, {0, 0, 1}}};
// Symmetry operations of rutile 1x1x2 {R}
const long rutile112_symmetry_operations[32][3][3] = {
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}},
{{0, -1, 0}, {1, 0, 0}, {0, 0, 1}}, {{0, 1, 0}, {-1, 0, 0}, {0, 0, -1}},
{{-1, 0, 0}, {0, -1, 0}, {0, 0, 1}}, {{1, 0, 0}, {0, 1, 0}, {0, 0, -1}},
{{0, 1, 0}, {-1, 0, 0}, {0, 0, 1}}, {{0, -1, 0}, {1, 0, 0}, {0, 0, -1}},
{{1, 0, 0}, {0, -1, 0}, {0, 0, -1}}, {{-1, 0, 0}, {0, 1, 0}, {0, 0, 1}},
{{0, -1, 0}, {-1, 0, 0}, {0, 0, -1}}, {{0, 1, 0}, {1, 0, 0}, {0, 0, 1}},
{{-1, 0, 0}, {0, 1, 0}, {0, 0, -1}}, {{1, 0, 0}, {0, -1, 0}, {0, 0, 1}},
{{0, 1, 0}, {1, 0, 0}, {0, 0, -1}}, {{0, -1, 0}, {-1, 0, 0}, {0, 0, 1}},
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}},
{{0, -1, 0}, {1, 0, 0}, {0, 0, 1}}, {{0, 1, 0}, {-1, 0, 0}, {0, 0, -1}},
{{-1, 0, 0}, {0, -1, 0}, {0, 0, 1}}, {{1, 0, 0}, {0, 1, 0}, {0, 0, -1}},
{{0, 1, 0}, {-1, 0, 0}, {0, 0, 1}}, {{0, -1, 0}, {1, 0, 0}, {0, 0, -1}},
{{1, 0, 0}, {0, -1, 0}, {0, 0, -1}}, {{-1, 0, 0}, {0, 1, 0}, {0, 0, 1}},
{{0, -1, 0}, {-1, 0, 0}, {0, 0, -1}}, {{0, 1, 0}, {1, 0, 0}, {0, 0, 1}},
{{-1, 0, 0}, {0, 1, 0}, {0, 0, -1}}, {{1, 0, 0}, {0, -1, 0}, {0, 0, 1}},
{{0, 1, 0}, {1, 0, 0}, {0, 0, -1}}, {{0, -1, 0}, {-1, 0, 0}, {0, 0, 1}}};
// Point group operations of zincblende {R^T} (with time reversal)
const long zincblende_rec_rotations_with_time_reversal[24][3][3] = {
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{1, 1, 0}, {-1, 0, 0}, {0, 0, 1}},
{{0, 1, 0}, {-1, -1, 0}, {0, 0, 1}}, {{-1, 0, 0}, {0, -1, 0}, {0, 0, 1}},
{{-1, -1, 0}, {1, 0, 0}, {0, 0, 1}}, {{0, -1, 0}, {1, 1, 0}, {0, 0, 1}},
{{0, 1, 0}, {1, 0, 0}, {0, 0, 1}}, {{1, 1, 0}, {0, -1, 0}, {0, 0, 1}},
{{1, 0, 0}, {-1, -1, 0}, {0, 0, 1}}, {{0, -1, 0}, {-1, 0, 0}, {0, 0, 1}},
{{-1, -1, 0}, {0, 1, 0}, {0, 0, 1}}, {{-1, 0, 0}, {1, 1, 0}, {0, 0, 1}},
{{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}}, {{-1, -1, 0}, {1, 0, 0}, {0, 0, -1}},
{{0, -1, 0}, {1, 1, 0}, {0, 0, -1}}, {{1, 0, 0}, {0, 1, 0}, {0, 0, -1}},
{{1, 1, 0}, {-1, 0, 0}, {0, 0, -1}}, {{0, 1, 0}, {-1, -1, 0}, {0, 0, -1}},
{{0, -1, 0}, {-1, 0, 0}, {0, 0, -1}}, {{-1, -1, 0}, {0, 1, 0}, {0, 0, -1}},
{{-1, 0, 0}, {1, 1, 0}, {0, 0, -1}}, {{0, 1, 0}, {1, 0, 0}, {0, 0, -1}},
{{1, 1, 0}, {0, -1, 0}, {0, 0, -1}}, {{1, 0, 0}, {-1, -1, 0}, {0, 0, -1}}};
// Point group operations of zincblende {R^T} (without time reversal)
const long zincblende_rec_rotations_without_time_reversal[12][3][3] = {
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{1, 1, 0}, {-1, 0, 0}, {0, 0, 1}},
{{0, 1, 0}, {-1, -1, 0}, {0, 0, 1}}, {{-1, 0, 0}, {0, -1, 0}, {0, 0, 1}},
{{-1, -1, 0}, {1, 0, 0}, {0, 0, 1}}, {{0, -1, 0}, {1, 1, 0}, {0, 0, 1}},
{{0, 1, 0}, {1, 0, 0}, {0, 0, 1}}, {{1, 1, 0}, {0, -1, 0}, {0, 0, 1}},
{{1, 0, 0}, {-1, -1, 0}, {0, 0, 1}}, {{0, -1, 0}, {-1, 0, 0}, {0, 0, 1}},
{{-1, -1, 0}, {0, 1, 0}, {0, 0, 1}}, {{-1, 0, 0}, {1, 1, 0}, {0, 0, 1}}};
// Symmetry operations of zincblende 1x1x2 {R}
const long zincblende112_symmetry_operations[24][3][3] = {
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{1, -1, 0}, {1, 0, 0}, {0, 0, 1}},
{{0, -1, 0}, {1, -1, 0}, {0, 0, 1}}, {{-1, 0, 0}, {0, -1, 0}, {0, 0, 1}},
{{-1, 1, 0}, {-1, 0, 0}, {0, 0, 1}}, {{0, 1, 0}, {-1, 1, 0}, {0, 0, 1}},
{{0, 1, 0}, {1, 0, 0}, {0, 0, 1}}, {{1, 0, 0}, {1, -1, 0}, {0, 0, 1}},
{{1, -1, 0}, {0, -1, 0}, {0, 0, 1}}, {{0, -1, 0}, {-1, 0, 0}, {0, 0, 1}},
{{-1, 0, 0}, {-1, 1, 0}, {0, 0, 1}}, {{-1, 1, 0}, {0, 1, 0}, {0, 0, 1}},
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{1, -1, 0}, {1, 0, 0}, {0, 0, 1}},
{{0, -1, 0}, {1, -1, 0}, {0, 0, 1}}, {{-1, 0, 0}, {0, -1, 0}, {0, 0, 1}},
{{-1, 1, 0}, {-1, 0, 0}, {0, 0, 1}}, {{0, 1, 0}, {-1, 1, 0}, {0, 0, 1}},
{{0, 1, 0}, {1, 0, 0}, {0, 0, 1}}, {{1, 0, 0}, {1, -1, 0}, {0, 0, 1}},
{{1, -1, 0}, {0, -1, 0}, {0, 0, 1}}, {{0, -1, 0}, {-1, 0, 0}, {0, 0, 1}},
{{-1, 0, 0}, {-1, 1, 0}, {0, 0, 1}}, {{-1, 1, 0}, {0, 1, 0}, {0, 0, 1}}};
const long AgNO2_rec_rotations[8][3][3] = {
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{0, 1, 0}, {1, 0, 0}, {-1, -1, -1}},
{{1, 1, 1}, {0, 0, -1}, {0, -1, 0}}, {{0, 0, -1}, {1, 1, 1}, {-1, 0, 0}},
{{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}}, {{0, -1, 0}, {-1, 0, 0}, {1, 1, 1}},
{{-1, -1, -1}, {0, 0, 1}, {0, 1, 0}}, {{0, 0, 1}, {-1, -1, -1}, {1, 0, 0}}};
const long AgNO2_tilde_rec_rotations[8][3][3] = {
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}},
{{5, -12, -2}, {12, -25, -4}, {-60, 120, 19}},
{{1, 0, 0}, {0, 11, 2}, {0, -60, -11}},
{{5, -12, -2}, {12, -35, -6}, {-60, 180, 31}},
{{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}},
{{-5, 12, 2}, {-12, 25, 4}, {60, -120, -19}},
{{-1, 0, 0}, {0, -11, -2}, {0, 60, 11}},
{{-5, 12, 2}, {-12, 35, 6}, {60, -180, -31}}};
/**
* @brief gridsys_get_all_grid_addresses test
* Return all GR-grid addresses of {(x, y, z)} where x runs fastest.
@ -209,36 +296,300 @@ TEST(test_gridsys, test_gridsys_rotate_grid_index) {
}
}
/* TEST(test_gridsys, test_gridsys_get_all_grid_addresses) {
double lattice[3][3] = {{4, 0, 0}, {0, 4, 0}, {0, 0, 3}};
double position[][3] = {
{0, 0, 0}, {0.5, 0.5, 0.5}, {0.3, 0.3, 0},
{0.7, 0.7, 0}, {0.2, 0.8, 0.5}, {0.8, 0.2, 0.5},
};
int num_ir, retval;
int types[] = {1, 1, 2, 2, 2, 2};
int num_atom = 6;
int m = 40;
int mesh[3];
int is_shift[] = {1, 1, 1};
int(*grid_address)[3];
int *grid_mapping_table;
mesh[0] = m;
mesh[1] = m;
mesh[2] = m;
grid_address = (int(*)[3])malloc(sizeof(int[3]) * m * m * m);
grid_mapping_table = (int *)malloc(sizeof(int) * m * m * m);
printf("*** spg_get_ir_reciprocal_mesh of Rutile structure ***:\n");
num_ir = spg_get_ir_reciprocal_mesh(grid_address, grid_mapping_table,
mesh, is_shift, 1, lattice, position, types, num_atom, 1e-5);
ASSERT_EQ(num_ir, 4200);
free(grid_address);
grid_address = NULL;
free(grid_mapping_table);
grid_mapping_table = NULL;
}
/**
* @brief gridsys_get_reciprocal_point_group with rutile symmetry
* Return {R^T} of crystallographic point group {R} with and without time
* reversal symmetry.
*/
TEST(test_gridsys, test_gridsys_get_reciprocal_point_group_rutile) {
long i, j, k, num_R;
long rec_rotations[48][3][3];
long is_time_reversal, is_found;
for (is_time_reversal = 0; is_time_reversal < 2; is_time_reversal++) {
num_R = gridsys_get_reciprocal_point_group(
rec_rotations, rutile112_symmetry_operations, 32, is_time_reversal);
ASSERT_EQ(16, num_R);
for (i = 0; i < 16; i++) {
is_found = 0;
for (j = 0; j < 16; j++) {
if (lagmat_check_identity_matrix_l3(rec_rotations[i],
rutile_rec_rotations[j])) {
is_found = 1;
break;
}
}
ASSERT_TRUE(is_found);
}
}
}
/**
* @brief gridsys_get_reciprocal_point_group with zincblende symmetry
* Return {R^T} of crystallographic point group {R} with and without time
* reversal symmetry.
*/
TEST(test_gridsys, test_gridsys_get_reciprocal_point_group_zincblende) {
long i, j, k, num_R;
long rec_rotations[48][3][3];
long is_found;
// Without time reversal symmetry.
num_R = gridsys_get_reciprocal_point_group(
rec_rotations, zincblende112_symmetry_operations, 24, 0);
ASSERT_EQ(12, num_R);
for (i = 0; i < 12; i++) {
is_found = 0;
for (j = 0; j < 12; j++) {
if (lagmat_check_identity_matrix_l3(
rec_rotations[i],
zincblende_rec_rotations_without_time_reversal[j])) {
is_found = 1;
break;
}
}
ASSERT_TRUE(is_found);
}
// With time reversal symmetry.
num_R = gridsys_get_reciprocal_point_group(
rec_rotations, zincblende112_symmetry_operations, 24, 1);
ASSERT_EQ(24, num_R);
for (i = 0; i < 24; i++) {
is_found = 0;
for (j = 0; j < 24; j++) {
if (lagmat_check_identity_matrix_l3(
rec_rotations[i],
zincblende_rec_rotations_with_time_reversal[j])) {
is_found = 1;
break;
}
}
ASSERT_TRUE(is_found);
}
}
/**
* @brief gridsys_get_snf3x3 (1)
* Return D, P, Q of SNF.
*/
TEST(test_gridsys, test_gridsys_get_snf3x3) {
long D_diag[3], P[3][3], Q[3][3];
long A[3][3] = {{0, 16, 16}, {16, 0, 16}, {6, 6, 0}};
const long ref_P[3][3] = {{0, -1, 3}, {1, 0, 0}, {-3, 3, -8}};
const long ref_Q[3][3] = {{1, 8, 17}, {0, 0, -1}, {0, 1, 1}};
long succeeded;
succeeded = gridsys_get_snf3x3(D_diag, P, Q, A);
ASSERT_TRUE(succeeded);
ASSERT_EQ(2, D_diag[0]);
ASSERT_EQ(16, D_diag[1]);
ASSERT_EQ(96, D_diag[2]);
ASSERT_TRUE(lagmat_check_identity_matrix_l3(ref_P, P));
ASSERT_TRUE(lagmat_check_identity_matrix_l3(ref_Q, Q));
}
/**
* @brief gridsys_get_snf3x3 (AgNO2)
* Return D, P, Q of SNF.
*/
TEST(test_gridsys, test_gridsys_get_snf3x3_AgNO2) {
long D_diag[3], P[3][3], Q[3][3];
long A[3][3] = {{0, 5, 5}, {2, 0, 2}, {3, 3, 0}};
const long ref_P[3][3] = {{0, -1, 1}, {-1, -3, 2}, {6, 15, -10}};
const long ref_Q[3][3] = {{1, -3, -31}, {0, 1, 11}, {0, 0, 1}};
long succeeded;
succeeded = gridsys_get_snf3x3(D_diag, P, Q, A);
ASSERT_TRUE(succeeded);
ASSERT_EQ(1, D_diag[0]);
ASSERT_EQ(1, D_diag[1]);
ASSERT_EQ(60, D_diag[2]);
ASSERT_TRUE(lagmat_check_identity_matrix_l3(ref_P, P));
ASSERT_TRUE(lagmat_check_identity_matrix_l3(ref_Q, Q));
}
/**
* @brief gridsys_transform_rotations
* Transform {R^T} to {R^T} with respect to transformed microzone basis vectors
* in GR-grid
*/
TEST(test_gridsys, test_gridsys_transform_rotations) {
long transformed_rotations[8][3][3];
const long D_diag[3] = {1, 1, 60};
const long Q[3][3] = {{1, -3, -31}, {0, 1, 11}, {0, 0, 1}};
long i, j, is_found, succeeded;
succeeded = gridsys_transform_rotations(transformed_rotations,
AgNO2_rec_rotations, 8, D_diag, Q);
ASSERT_TRUE(succeeded);
for (i = 0; i < 8; i++) {
is_found = 0;
for (j = 0; j < 8; j++) {
if (lagmat_check_identity_matrix_l3(AgNO2_tilde_rec_rotations[j],
transformed_rotations[i])) {
is_found = 1;
break;
}
}
ASSERT_TRUE(is_found);
}
}
/**
* @brief gridsys_get_thm_integration_weight
* Return integration weight of linear tetrahedron method
*/
TEST(test_gridsys, test_gridsys_get_thm_integration_weight) {
const double freqs_at[2] = {7.75038996, 8.45225776};
const double tetra_freqs[24][4] = {
{8.31845176, 8.69248151, 8.78939432, 8.66179133},
{8.31845176, 8.69248151, 8.57211855, 8.66179133},
{8.31845176, 8.3073908, 8.78939432, 8.66179133},
{8.31845176, 8.3073908, 8.16360975, 8.66179133},
{8.31845176, 8.15781566, 8.57211855, 8.66179133},
{8.31845176, 8.15781566, 8.16360975, 8.66179133},
{8.31845176, 8.3073908, 8.16360975, 7.23665561},
{8.31845176, 8.15781566, 8.16360975, 7.23665561},
{8.31845176, 8.69248151, 8.57211855, 8.25247917},
{8.31845176, 8.15781566, 8.57211855, 8.25247917},
{8.31845176, 8.15781566, 7.40609306, 8.25247917},
{8.31845176, 8.15781566, 7.40609306, 7.23665561},
{8.31845176, 8.69248151, 8.78939432, 8.55165578},
{8.31845176, 8.3073908, 8.78939432, 8.55165578},
{8.31845176, 8.3073908, 7.56474684, 8.55165578},
{8.31845176, 8.3073908, 7.56474684, 7.23665561},
{8.31845176, 8.69248151, 8.60076148, 8.55165578},
{8.31845176, 8.69248151, 8.60076148, 8.25247917},
{8.31845176, 7.72920193, 8.60076148, 8.55165578},
{8.31845176, 7.72920193, 8.60076148, 8.25247917},
{8.31845176, 7.72920193, 7.56474684, 8.55165578},
{8.31845176, 7.72920193, 7.56474684, 7.23665561},
{8.31845176, 7.72920193, 7.40609306, 8.25247917},
{8.31845176, 7.72920193, 7.40609306, 7.23665561},
};
const double iw_I_ref[2] = {0.37259443, 1.79993056};
const double iw_J_ref[2] = {0.05740597, 0.76331859};
double iw_I, iw_J;
long i;
for (i = 0; i < 2; i++) {
ASSERT_LT((fabs(gridsys_get_thm_integration_weight(freqs_at[i],
tetra_freqs, 'I') -
iw_I_ref[i])),
1e-5);
ASSERT_LT((fabs(gridsys_get_thm_integration_weight(freqs_at[i],
tetra_freqs, 'J') -
iw_J_ref[i])),
1e-5);
}
}
TEST(test_gridsys, test_gridsys_get_thm_relative_grid_address) {
const long ref_rel_grid_addresses = {
{
{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {1, 1, 1}},
{{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {1, 1, 1}},
{{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 1, 1}},
{{0, 0, 0}, {0, 1, 0}, {0, 1, 1}, {1, 1, 1}},
{{0, 0, 0}, {0, 0, 1}, {1, 0, 1}, {1, 1, 1}},
{{0, 0, 0}, {0, 0, 1}, {0, 1, 1}, {1, 1, 1}},
{{0, 0, 0}, {0, 1, 0}, {0, 1, 1}, {-1, 0, 0}},
{{0, 0, 0}, {0, 0, 1}, {0, 1, 1}, {-1, 0, 0}},
{{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, -1, 0}},
{{0, 0, 0}, {0, 0, 1}, {1, 0, 1}, {0, -1, 0}},
{{0, 0, 0}, {0, 0, 1}, {-1, -1, 0}, {0, -1, 0}},
{{0, 0, 0}, {0, 0, 1}, {-1, -1, 0}, {-1, 0, 0}},
{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {0, 0, -1}},
{{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {0, 0, -1}},
{{0, 0, 0}, {0, 1, 0}, {-1, 0, -1}, {0, 0, -1}},
{{0, 0, 0}, {0, 1, 0}, {-1, 0, -1}, {-1, 0, 0}},
{{0, 0, 0}, {1, 0, 0}, {0, -1, -1}, {0, 0, -1}},
{{0, 0, 0}, {1, 0, 0}, {0, -1, -1}, {0, -1, 0}},
{{0, 0, 0}, {-1, -1, -1}, {0, -1, -1}, {0, 0, -1}},
{{0, 0, 0}, {-1, -1, -1}, {0, -1, -1}, {0, -1, 0}},
{{0, 0, 0}, {-1, -1, -1}, {-1, 0, -1}, {0, 0, -1}},
{{0, 0, 0}, {-1, -1, -1}, {-1, 0, -1}, {-1, 0, 0}},
{{0, 0, 0}, {-1, -1, -1}, {-1, -1, 0}, {0, -1, 0}},
{{0, 0, 0}, {-1, -1, -1}, {-1, -1, 0}, {-1, 0, 0}},
},
{
{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 1, 1}},
{{0, 0, 0}, {1, 0, 0}, {0, 0, 1}, {0, 1, 1}},
{{0, 0, 0}, {-1, 1, 0}, {-1, 1, 1}, {-1, 0, 0}},
{{0, 0, 0}, {-1, 0, 1}, {-1, 1, 1}, {-1, 0, 0}},
{{0, 0, 0}, {-1, 1, 0}, {0, 1, 0}, {-1, 1, 1}},
{{0, 0, 0}, {0, 1, 0}, {-1, 1, 1}, {0, 1, 1}},
{{0, 0, 0}, {-1, 0, 1}, {0, 0, 1}, {-1, 1, 1}},
{{0, 0, 0}, {0, 0, 1}, {-1, 1, 1}, {0, 1, 1}},
{{0, 0, 0}, {0, 0, 1}, {0, -1, 0}, {1, -1, 0}},
{{0, 0, 0}, {1, 0, 0}, {0, 0, 1}, {1, -1, 0}},
{{0, 0, 0}, {-1, 0, 1}, {0, -1, 0}, {-1, 0, 0}},
{{0, 0, 0}, {-1, 0, 1}, {0, 0, 1}, {0, -1, 0}},
{{0, 0, 0}, {0, 1, 0}, {0, 0, -1}, {1, 0, -1}},
{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {1, 0, -1}},
{{0, 0, 0}, {-1, 1, 0}, {0, 0, -1}, {-1, 0, 0}},
{{0, 0, 0}, {-1, 1, 0}, {0, 1, 0}, {0, 0, -1}},
{{0, 0, 0}, {0, -1, -1}, {1, -1, -1}, {0, 0, -1}},
{{0, 0, 0}, {0, -1, -1}, {1, -1, -1}, {0, -1, 0}},
{{0, 0, 0}, {1, -1, -1}, {0, 0, -1}, {1, 0, -1}},
{{0, 0, 0}, {1, 0, 0}, {1, -1, -1}, {1, 0, -1}},
{{0, 0, 0}, {1, -1, -1}, {0, -1, 0}, {1, -1, 0}},
{{0, 0, 0}, {1, 0, 0}, {1, -1, -1}, {1, -1, 0}},
{{0, 0, 0}, {0, -1, -1}, {0, 0, -1}, {-1, 0, 0}},
{{0, 0, 0}, {0, -1, -1}, {0, -1, 0}, {-1, 0, 0}},
},
{
{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {1, 0, 1}},
{{0, 0, 0}, {0, 1, 0}, {0, 0, 1}, {1, 0, 1}},
{{0, 0, 0}, {-1, 1, 0}, {0, 0, 1}, {-1, 0, 0}},
{{0, 0, 0}, {-1, 1, 0}, {0, 1, 0}, {0, 0, 1}},
{{0, 0, 0}, {1, -1, 1}, {0, -1, 0}, {1, -1, 0}},
{{0, 0, 0}, {0, -1, 1}, {1, -1, 1}, {0, -1, 0}},
{{0, 0, 0}, {1, 0, 0}, {1, -1, 1}, {1, -1, 0}},
{{0, 0, 0}, {1, 0, 0}, {1, -1, 1}, {1, 0, 1}},
{{0, 0, 0}, {0, -1, 1}, {1, -1, 1}, {0, 0, 1}},
{{0, 0, 0}, {1, -1, 1}, {0, 0, 1}, {1, 0, 1}},
{{0, 0, 0}, {0, -1, 1}, {0, -1, 0}, {-1, 0, 0}},
{{0, 0, 0}, {0, -1, 1}, {0, 0, 1}, {-1, 0, 0}},
{{0, 0, 0}, {1, 0, 0}, {0, 0, -1}, {0, 1, -1}},
{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 1, -1}},
{{0, 0, 0}, {-1, 0, -1}, {0, 0, -1}, {-1, 1, -1}},
{{0, 0, 0}, {-1, 0, -1}, {-1, 1, -1}, {-1, 0, 0}},
{{0, 0, 0}, {0, 0, -1}, {-1, 1, -1}, {0, 1, -1}},
{{0, 0, 0}, {0, 1, 0}, {-1, 1, -1}, {0, 1, -1}},
{{0, 0, 0}, {-1, 1, 0}, {-1, 1, -1}, {-1, 0, 0}},
{{0, 0, 0}, {-1, 1, 0}, {0, 1, 0}, {-1, 1, -1}},
{{0, 0, 0}, {0, 0, -1}, {0, -1, 0}, {1, -1, 0}},
{{0, 0, 0}, {1, 0, 0}, {0, 0, -1}, {1, -1, 0}},
{{0, 0, 0}, {-1, 0, -1}, {0, 0, -1}, {0, -1, 0}},
{{0, 0, 0}, {-1, 0, -1}, {0, -1, 0}, {-1, 0, 0}},
},
{
{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {0, 0, 1}},
{{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {0, 0, 1}},
{{0, 0, 0}, {0, 1, 0}, {-1, 0, 1}, {-1, 0, 0}},
{{0, 0, 0}, {0, 1, 0}, {-1, 0, 1}, {0, 0, 1}},
{{0, 0, 0}, {1, 0, 0}, {0, -1, 1}, {0, -1, 0}},
{{0, 0, 0}, {1, 0, 0}, {0, -1, 1}, {0, 0, 1}},
{{0, 0, 0}, {-1, -1, 1}, {-1, -1, 0}, {0, -1, 0}},
{{0, 0, 0}, {-1, -1, 1}, {-1, -1, 0}, {-1, 0, 0}},
{{0, 0, 0}, {-1, -1, 1}, {0, -1, 1}, {0, -1, 0}},
{{0, 0, 0}, {-1, -1, 1}, {-1, 0, 1}, {-1, 0, 0}},
{{0, 0, 0}, {-1, -1, 1}, {0, -1, 1}, {0, 0, 1}},
{{0, 0, 0}, {-1, -1, 1}, {-1, 0, 1}, {0, 0, 1}},
{{0, 0, 0}, {0, 0, -1}, {1, 0, -1}, {1, 1, -1}},
{{0, 0, 0}, {0, 0, -1}, {0, 1, -1}, {1, 1, -1}},
{{0, 0, 0}, {1, 0, 0}, {1, 0, -1}, {1, 1, -1}},
{{0, 0, 0}, {0, 1, 0}, {0, 1, -1}, {1, 1, -1}},
{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {1, 1, -1}},
{{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 1, -1}},
{{0, 0, 0}, {0, 0, -1}, {0, 1, -1}, {-1, 0, 0}},
{{0, 0, 0}, {0, 1, 0}, {0, 1, -1}, {-1, 0, 0}},
{{0, 0, 0}, {0, 0, -1}, {1, 0, -1}, {0, -1, 0}},
{{0, 0, 0}, {1, 0, 0}, {1, 0, -1}, {0, -1, 0}},
{{0, 0, 0}, {0, 0, -1}, {-1, -1, 0}, {0, -1, 0}},
{{0, 0, 0}, {0, 0, -1}, {-1, -1, 0}, {-1, 0, 0}},
},
};
}

View File

@ -35,3 +35,13 @@ void lagmat_copy_matrix_l3(long a[3][3], const long b[3][3]) {
a[2][1] = b[2][1];
a[2][2] = b[2][2];
}
long lagmat_check_identity_matrix_l3(const long a[3][3], const long b[3][3]) {
if (a[0][0] - b[0][0] || a[0][1] - b[0][1] || a[0][2] - b[0][2] ||
a[1][0] - b[1][0] || a[1][1] - b[1][1] || a[1][2] - b[1][2] ||
a[2][0] - b[2][0] || a[2][1] - b[2][1] || a[2][2] - b[2][2]) {
return 0;
} else {
return 1;
}
}

View File

@ -6,5 +6,5 @@ void lagmat_multiply_matrix_vector_l3(long v[3], const long a[3][3],
void lagmat_multiply_matrix_l3(long m[3][3], const long a[3][3],
const long b[3][3]);
void lagmat_copy_matrix_l3(long a[3][3], const long b[3][3]);
long lagmat_check_identity_matrix_l3(const long a[3][3], const long b[3][3]);
#endif // __test_utils_H__