|
@@ -139,7 +139,13 @@ void SpectralCluster::cluster ( const VVector & features,
|
|
|
|
|
|
NICE::Matrix eigvect;
|
|
|
NICE::Vector eigvals;
|
|
|
- NICE::eigenvectorvalues ( laplacian, eigvect, eigvals );
|
|
|
+ try {
|
|
|
+ NICE::eigenvectorvalues ( laplacian, eigvect, eigvals );
|
|
|
+ } catch (...) {
|
|
|
+ cerr << "You should adjust the alpha parameter, or the features are somehow weird" << endl;
|
|
|
+ cerr << "Laplacian = " << laplacian(0, 0, min((int)laplacian.rows()-1, 5), min((int)laplacian.cols()-1, 5)) << endl;
|
|
|
+ throw Exception ("Laplacian matrix is singular or not well-conditioned!");
|
|
|
+ }
|
|
|
|
|
|
std::map<double, int> eigvals_sorted;
|
|
|
for ( int i = 0 ; i < (int)eigvals.size(); i++ )
|