mirror of
https://github.com/gonum/gonum.git
synced 2025-10-22 06:39:26 +08:00
Add Dlasrt
This commit is contained in:
@@ -50,6 +50,14 @@ const (
|
||||
Backward Direct = 'B' // Reflectors are left-multiplied, H_k * ... * H_2 * H_1
|
||||
)
|
||||
|
||||
// Sort is the sorting order.
|
||||
type Sort byte
|
||||
|
||||
const (
|
||||
SortIncreasing Sort = 'I'
|
||||
SortDecreasing Sort = 'D'
|
||||
)
|
||||
|
||||
// StoreV indicates the storage direction of elementary reflectors.
|
||||
type StoreV byte
|
||||
|
||||
|
27
native/dlasrt.go
Normal file
27
native/dlasrt.go
Normal 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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user