Add Dlasrt

This commit is contained in:
btracey
2015-10-12 23:36:34 -06:00
parent 28f483e1da
commit fbd14d97f3
2 changed files with 35 additions and 0 deletions

27
native/dlasrt.go Normal file
View File

@@ -0,0 +1,27 @@
// Copyright ©2015 The gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package native
import (
"sort"
"github.com/gonum/lapack"
)
// Dlasrt sorts the numbers in the input slice d. If sort == lapack.SortIncreasing,
// the elements are sorted in increasing order. If sort == lapack.SortDecreasing,
// the elements are sorted in decreasing order.
func (impl Implementation) Dlasrt(s lapack.Sort, n int, d []float64) {
checkVector(n, d, 1)
d = d[:n]
switch s {
default:
panic("lapack: bad sort")
case lapack.SortIncreasing:
sort.Sort(sort.Reverse(sort.Float64Slice(d)))
case lapack.SortDecreasing:
sort.Float64s(d)
}
}