Beispiel #1
0
int check_comb(i_64 d, i_64 rowcomb)
{
    i_64 codeword = d;
    int i;

    for (i = 1; i < K; i++) 
        if (rowcomb & (1ULL << i))
            (codeword ^= rowi(d, i));

    if ((wt(codeword) + wt(rowcomb)) < D) return(0);
    else                          return(1);

}
Beispiel #2
0
void SylvMatrix::multRightKron(const SqSylvMatrix& m, int order)
{
	if (power(m.numRows(), order) != cols) {
		throw SYLV_MES_EXCEPTION("Wrong number of cols for right kron multiply.");
	}
	KronVector auxrow(m.numRows(), m.numRows(), order-1);
	for (int i = 0; i < rows; i++) {
		Vector rowi(data.base()+i, rows, cols);
		KronVector rowikron(rowi, m.numRows(), m.numRows(), order-1);
		auxrow = rowi; // copy data
		m.multVecKronTrans(rowikron, auxrow);
	}
}
Beispiel #3
0
void Scene::build_laplacian(const FT scale,
                            const std::map<unsigned, unsigned>& indices,
                            SparseMatrix& A) const
{
    unsigned nb = A.numRows();
    for (unsigned k = 0; k < m_vertices.size(); ++k)
    {
        Vertex_handle vi = m_vertices[k];
        if (vi->is_hidden()) continue;
        unsigned i = indices.find(vi->get_index())->second;
        
        double diagi = 0.0;
        SparseArray rowi(nb);        
        Edge_circulator ecirc = m_rt.incident_edges(vi);
        Edge_circulator eend  = ecirc;
        CGAL_For_all(ecirc, eend)
        {
            Edge edge = *ecirc;
            if (!m_rt.is_inside(edge)) continue;
            
            Vertex_handle vj = m_rt.get_source(edge);
            if (vj == vi) vj = m_rt.get_target(edge);
            
            unsigned j = vj->get_index();
            j = indices.find(j)->second;
            
            double coef = scale * get_ratio(edge);
            if (std::abs(coef) < EPS) continue;
            
            rowi.setValue(j, -coef);
            diagi += coef;
        }
        
        rowi.setValue(i, diagi);
        A.setRow(i, rowi);
    }