Пример #1
0
//#define DEBUG
void SymList::compute_subgroup()
{
    Matrix2D<DOUBLE> I(4, 4);
    I.initIdentity();
    Matrix2D<DOUBLE> L1(4, 4), R1(4, 4), L2(4, 4), R2(4, 4), newL(4, 4), newR(4, 4);
    Matrix2D<int>    tried(true_symNo, true_symNo);
    int i, j;
    int new_chain_length;
    while (found_not_tried(tried, i, j, true_symNo))
    {
        tried(i, j) = 1;

        get_matrices(i, L1, R1);
        get_matrices(j, L2, R2);
        newL = L1 * L2;
        newR = R1 * R2;
        new_chain_length = __chain_length(i) + __chain_length(j);
        Matrix2D<DOUBLE> newR3 = newR;
        newR3.resize(3,3);
        if (newL.isIdentity() && newR3.isIdentity()) continue;

        // Try to find it in current ones
        bool found;
        found = false;
        for (int l = 0; l < SymsNo(); l++)
        {
        	get_matrices(l, L1, R1);
            if (newL.equal(L1) && newR.equal(R1))
            {
                found = true;
                break;
            }
        }

        if (!found)
        {
//#define DEBUG
#ifdef DEBUG
           std::cout << "Matrix size " << tried.Xdim() << " "
            << "trying " << i << " " << j << " "
            << "chain length=" << new_chain_length << std::endl;
            std::cout << "Result R Sh\n" << newR;
#endif
#undef DEBUG
            newR.setSmallValuesToZero();
            newL.setSmallValuesToZero();
            add_matrices(newL, newR, new_chain_length);
            tried.resize(MAT_YSIZE(tried) + 1, MAT_XSIZE(tried) + 1);
        }
    }
}
Пример #2
0
void main(int argc, char *argv[]) {
        if (argc!=1) {
                printf("Sorry, I don't take command line arguments.\n");
                exit(-1);
	}
        else {
		get_first();
		get_matrices();
		mul_matrices();
		print_out();
	}
}
Пример #3
0
void SymList::writeDefinition(std::ostream &outstream, FileName fn_sym)
{
	read_sym_file(fn_sym);
	Matrix2D<DOUBLE> L(3,3), R(3,3);
	outstream << " ++++ Using symmetry group " << fn_sym << ", with the following " << SymsNo()+1 << " transformation matrices:"<< std::endl;
    R.initIdentity();
    outstream << " R(1)= " << R;
	for (int isym = 0; isym < SymsNo(); isym++)
    {
        get_matrices(isym, L, R);
        R.resize(3, 3);
        L.resize(3, 3);
        if (!L.isIdentity())
        	outstream << " L("<< isym+2<<")= "<<L;
        outstream << " R("<< isym+2<<")= "<<R;
    }

}