Here you can find the source of sortEigenValues(int n, double[] d, double[][] v)
private static void sortEigenValues(int n, double[] d, double[][] v)
//package com.java2s; // it under the terms of the GNU Lesser General Public License as published by public class Main { private static void sortEigenValues(int n, double[] d, double[][] v) { for (int i = 0; i < n - 1; i++) { int k = i; double p = d[i]; for (int j = i + 1; j < n; j++) { if (d[j] < p) { // NH find smallest k>i k = j;/*from w w w. j av a 2 s.c om*/ p = d[j]; } } if (k != i) { d[k] = d[i]; // swap k and i d[i] = p; for (int j = 0; j < n; j++) { p = v[j][i]; v[j][i] = v[j][k]; v[j][k] = p; } } } } }