Re: [eigen] Complexity of setFromTriplets

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Cory,

Simply setting the values is independent of the matrix size. If I set only the first element, that's only one set of operations, nothing is done on the rows or columns. Additionally, a matrix is sparse when n = O(r) with r being the longer dimension, so O(n) + O(r) + O(c) is still O(n). So for an algorithm like multigrid applied to a sparse matrix, the complexity is based on size (I think), but is still O(n) because every dimension is no greater than O(n).

On Thu, 08 Oct 2015 12:39:56 +0200
coryaden@xxxxxxxxxx wrote:

> Hello,
> 
> in the documentation of the class Eigen::SparseMatrix< _Scalar, 
> _Options, _Index > it is claimed that the function setFromTriplets was a 
> "O(n) operation, with n the number of triplet elements".
> O(n) suggests that the matrix dimensions do not effect execution time, 
> which is wrong. It should be O(n+r+c), with n number of triplets and r,c 
> the number of rows and columns of the SparseMatrix<>.
> 
> Cory Aden
> 
> 


-- 
Nathan Yonkee <nathan.yonkee@xxxxxxxxx>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/