[eigen] maximum value for sparse vector
[
Thread Index
|
Date Index
|
More lists.tuxfamily.org/eigen Archives
]
To
:
eigen@xxxxxxxxxxxxxxxxxxx
Subject
: [eigen] maximum value for sparse vector
From
: 常严 <
changy@xxxxxxxxxxx
>
Date
: Thu, 28 Aug 2014 16:59:33 +0800 (GMT+08:00)
Hi,
I write a simple code to obtain the maximum coeff of a sparse vector (complex), is this efficient? I notice there is
no 'maxCoeff' or 'minCoeff' function for sparse matrix. Thanks!
typedef SparseVector< std::complex<double> > SpVecXcd;
double max_coeff(const SpVecXcd& m) {
double max_val = std::numeric_limits<double>::min();
double val;
for (SpVecXcd::InnerIterator it(m); it; ++it) {
val = sqrt(norm(it.value()));
if (val > max_val)
max_val = val;
}
return max_val;
}
Best regards,
Yan
Messages sorted by:
[
date
|
thread
]
Prev by Date:
[eigen] Re: [Bitbucket] Pull request #80: Allow LevenbergMarquardt to work with non-standard types. (eigen/eigen)
Next by Date:
Re: [eigen] Re: [Bitbucket] Pull request #80: Allow LevenbergMarquardt to work with non-standard types. (eigen/eigen)
Previous by thread:
Re: [eigen] Re: [Bitbucket] Pull request #80: Allow LevenbergMarquardt to work with non-standard types. (eigen/eigen)
Next by thread:
[eigen] EigenLab: C++ run-time matrix math ala MATLAB.
Mail converted by
MHonArc
2.6.19+
http://listengine.tuxfamily.org/