11#include <boost/algorithm/string.hpp>
19 for (
size_t i = 0; i < matrix.
numRows(); ++i) {
21 std::ostringstream
error;
22 error <<
"Matrix row " << i <<
" is invalid. Elements: [" << matrix[i][0] <<
", " << matrix[i][1] <<
", "
23 << matrix[i][2] <<
"]";
87 throw std::runtime_error(
"Matrix is not a 3x3 matrix.");
90 std::vector<std::string> symbols{
"x",
"y",
"z"};
91 std::vector<std::string> components;
93 for (
size_t r = 0; r < 3; ++r) {
94 std::ostringstream currentComponent;
96 for (
size_t c = 0; c < 3; ++c) {
97 if (matrix[r][c] != 0) {
98 if (matrix[r][c] < 0) {
99 currentComponent <<
"-";
101 if (!currentComponent.str().empty()) {
102 currentComponent <<
"+";
106 currentComponent << symbols[c];
110 if (vector[r] != 0) {
112 currentComponent <<
"+";
115 if (vector[r].denominator() != 1) {
116 currentComponent << vector[r];
118 currentComponent << vector[r].numerator();
122 components.emplace_back(currentComponent.str());
125 return boost::join(components,
",");
132 for (
size_t i = 0; i < columnNumber; ++i) {
133 if (abs(element[i]) > 1) {
135 }
else if (element[i] == 0) {
140 return nulls > 0 && nulls < 3;
const VectorType & getVector() const
Returns a const reference to the stored vector.
const Kernel::Matrix< MatrixNumericType > & getMatrix() const
Returns a const reference to the internally stored matrix.
static void verifyMatrix(const Kernel::IntMatrix &matrix)
Verify that the matrix does not contain elements with abs(element) > 1 and has an acceptable number o...
static bool isValidMatrixRow(const int *element, size_t columnNumber)
Checks if there are either 1 or 2 zeros in a given matrix row and all non-zero elements are 1 or -1.
static std::string getNormalizedIdentifier(const MatrixVectorPair< int, V3R > &data)
Returns a Jones faithful representation of the symmetry operation characterized by the supplied matri...
static MatrixVectorPair< int, V3R > parseIdentifier(const std::string &identifier)
Tries to parse the given symbol.
Records the filename, the description of failure and the line on which it happened.
size_t numRows() const
Return the number of rows in the matrix.
size_t numCols() const
Return the number of columns in the matrix.