Skip to content

Parallelization of HODLR::solveNonSPD() #42

Description

@Charles-Chao-Chen

Hi,

The function HODLR::solveNonSPD(Mat) has not been parallelized. The following is a straightforward parallelization, which may be useful for some users.

Mat HODLR::solveNonSPD(Mat b)
{
Mat x = Mat::Zero(b.rows(),b.cols());

int r = b.cols();

// Solving over the leaf nodes:
#pragma omp parallel for
for(int k = 0; k < nodes_in_level[n_levels]; k++) 
{
    int start = tree[n_levels][k]->n_start;
    int size  = tree[n_levels][k]->n_size;

    x.block(start, 0, size, r) = this->solveLeafNonSPD(k, b.block(start, 0, size, r));
}

b = x;

// Solving over nonleaf levels:
for(int j = n_levels - 1; j >= 0; j--) 
{
    #pragma omp parallel for
    for (int k = 0; k < nodes_in_level[j]; k++) 
    {
        int start = tree[j][k]->n_start;
        int size  = tree[j][k]->n_size;
        
        x.block(start, 0, size, r) = this->solveNonLeafNonSPD(j, k, b.block(start, 0, size, r));
    }

    b = x;
}

return x;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions