gonum.org/v1/gonum@v0.15.1-0.20240517103525-f853624cb1bb/stat/distmv/distmv.go (about) 1 // Copyright ©2015 The Gonum Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package distmv 6 7 const ( 8 badQuantile = "distmv: quantile not between 0 and 1" 9 badOutputLen = "distmv: output slice is not nil or the correct length" 10 badInputLength = "distmv: input slice length mismatch" 11 badSizeMismatch = "distmv: size mismatch" 12 badZeroDimension = "distmv: zero dimensional input" 13 nonPosDimension = "distmv: non-positive dimension input" 14 ) 15 16 const logTwoPi = 1.8378770664093454835606594728112352797227949472755668 17 18 // reuseAs returns a slice of length n. If len(dst) is n, dst is returned, 19 // otherwise dst must be nil or reuseAs will panic. 20 func reuseAs(dst []float64, n int) []float64 { 21 if dst == nil { 22 dst = make([]float64, n) 23 } 24 if len(dst) != n { 25 panic(badOutputLen) 26 } 27 return dst 28 }