We consider the problem of optimizing the parameter of a two-stage algorithm for approximate solution of a system of linear algebraic equations with a sparse $n\times n$-matrix, i.e., with one in which the number of nonzero elements is $m\!=\!O(n)$. The two-stage algorithm uses conjugate gradient method at its stages. At the 1st stage, an approximate solution with accuracy $\varepsilon_1$ is found for zero initial vector. All numerical values used at this stage are represented as single-precision numbers. The obtained solution is used as initial approximation for an approximate solution with a given accuracy $\varepsilon_2$ that we obtain at the 2nd stage, where double-precision numbers are used. Based on the values of some matrix parameters, computed in a time not exceeding $O(m)$, we need to determine the value $\varepsilon_1$ which minimizes the total computation time at two stages. Using single-precision numbers for computations at the 1st stage is advantageous, since the execution time of one iteration will be approximately half that of one iteration at the 2nd stage. At the same time, using machine numbers with half the mantissa length accelerates the growth of the rounding error per iteration of the conjugate gradient method at the 1st stage, which entails an increase in the number of iterations performed at 2nd stage. As parameters that allow us to determine $\varepsilon_1$ for the input matrix, we use $n$, $m$, an estimate of the diameter of the graph associated with the matrix, an estimate of the spread of the matrix' eigenvalues, and estimates of its maximum eigenvalue. The optimal or close to the optimal value of $\varepsilon_1$ can be determined for matrix with such a vector of parameters using the nearest neighbor regression or some other type of regression.
翻译:我们考虑优化一种两阶段算法参数的问题,该算法用于近似求解具有稀疏 $n\times n$ 矩阵的线性代数方程组,即矩阵中非零元素数量为 $m\!=\!O(n)$。该两阶段算法在其各阶段均采用共轭梯度法。在第一阶段,从零初始向量出发,求得精度为 $\varepsilon_1$ 的近似解。此阶段使用的所有数值均以单精度浮点数表示。所得解将作为初始近似值,用于第二阶段获得给定精度 $\varepsilon_2$ 的近似解,该阶段使用双精度浮点数。基于在不超过 $O(m)$ 时间内计算出的某些矩阵参数值,我们需要确定使两阶段总计算时间最小化的 $\varepsilon_1$ 值。第一阶段使用单精度浮点数进行计算具有优势,因为单次迭代的执行时间约为第二阶段单次迭代的一半。然而,使用尾数长度减半的机器数会加速第一阶段共轭梯度法每次迭代舍入误差的增长,从而导致第二阶段需要执行的迭代次数增加。作为能为输入矩阵确定 $\varepsilon_1$ 的参数,我们使用 $n$、$m$、矩阵关联图的直径估计、矩阵特征值分布范围的估计及其最大特征值的估计。对于具有此类参数向量的矩阵,可通过最近邻回归或其他类型的回归方法确定 $\varepsilon_1$ 的最优值或接近最优的值。