diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-06-10 16:50:19 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-06-10 16:50:19 +0200 |
commit | 8325e1a676a1a8e253e6915d62630145051aee11 (patch) | |
tree | 73aa8cff0cc50e939241f6e06008f8d35a009a60 /packages/base/src/C/vector-aux.c | |
parent | 05e40db4fdc85b73f38ae5e105db0d523176debe (diff) |
sortVector
Diffstat (limited to 'packages/base/src/C/vector-aux.c')
-rw-r--r-- | packages/base/src/C/vector-aux.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/base/src/C/vector-aux.c b/packages/base/src/C/vector-aux.c index 53b56aa..b176089 100644 --- a/packages/base/src/C/vector-aux.c +++ b/packages/base/src/C/vector-aux.c | |||
@@ -770,3 +770,16 @@ int smTXv(KDVEC(vals),KIVEC(cols),KIVEC(rows),KDVEC(x),DVEC(r)) { | |||
770 | OK | 770 | OK |
771 | } | 771 | } |
772 | 772 | ||
773 | //////////////////////////////////////////////////////////////////////////////// | ||
774 | |||
775 | int | ||
776 | compare_doubles (const void *a, const void *b) { | ||
777 | return *(double*)a > *(double*)b; | ||
778 | } | ||
779 | |||
780 | int sort_values(KDVEC(v),DVEC(r)) { | ||
781 | memcpy(rp,vp,vn*sizeof(double)); | ||
782 | qsort(rp,rn,sizeof(double),compare_doubles); | ||
783 | OK | ||
784 | } | ||
785 | |||