Update go dependencies
This commit is contained in:
parent
a46126a034
commit
3eafaa35a1
1108 changed files with 32555 additions and 83490 deletions
65
go.mod
65
go.mod
|
@ -15,6 +15,7 @@ require (
|
|||
github.com/json-iterator/go v1.1.9
|
||||
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
|
||||
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348
|
||||
github.com/mattn/go-colorable v0.1.2 // indirect
|
||||
github.com/mitchellh/go-ps v1.0.0
|
||||
github.com/mitchellh/hashstructure v1.0.0
|
||||
github.com/mitchellh/mapstructure v1.1.2
|
||||
|
@ -38,45 +39,45 @@ require (
|
|||
github.com/yudai/pp v2.0.1+incompatible // indirect
|
||||
github.com/zakjan/cert-chain-resolver v0.0.0-20180703112424-6076e1ded272
|
||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9
|
||||
google.golang.org/grpc v1.23.1
|
||||
google.golang.org/grpc v1.26.0
|
||||
gopkg.in/fsnotify/fsnotify.v1 v1.4.7
|
||||
gopkg.in/gavv/httpexpect.v2 v2.0.0
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
|
||||
gopkg.in/go-playground/pool.v3 v3.1.1
|
||||
k8s.io/api v0.17.3
|
||||
k8s.io/apiextensions-apiserver v0.17.3
|
||||
k8s.io/apimachinery v0.17.3
|
||||
k8s.io/apiserver v0.17.3
|
||||
k8s.io/cli-runtime v0.17.3
|
||||
k8s.io/client-go v0.17.3
|
||||
k8s.io/code-generator v0.17.3
|
||||
k8s.io/component-base v0.17.33
|
||||
k8s.io/api v0.18.0
|
||||
k8s.io/apiextensions-apiserver v0.18.0
|
||||
k8s.io/apimachinery v0.18.0
|
||||
k8s.io/apiserver v0.18.0
|
||||
k8s.io/cli-runtime v0.18.0
|
||||
k8s.io/client-go v0.18.0
|
||||
k8s.io/code-generator v0.18.0
|
||||
k8s.io/component-base v0.18.0
|
||||
k8s.io/klog v1.0.0
|
||||
k8s.io/kubernetes v1.17.3
|
||||
k8s.io/kubernetes v1.18.0
|
||||
pault.ag/go/sniff v0.0.0-20200207005214-cf7e4d167732
|
||||
sigs.k8s.io/controller-runtime v0.4.0
|
||||
sigs.k8s.io/controller-runtime v0.5.1-0.20200327213554-2d4c4877f906
|
||||
)
|
||||
|
||||
replace (
|
||||
k8s.io/api => k8s.io/api v0.17.3
|
||||
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.3
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.17.3
|
||||
k8s.io/apiserver => k8s.io/apiserver v0.17.3
|
||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.17.3
|
||||
k8s.io/client-go => k8s.io/client-go v0.17.3
|
||||
k8s.io/cloud-provider => k8s.io/cloud-provider v0.17.3
|
||||
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.17.3
|
||||
k8s.io/code-generator => k8s.io/code-generator v0.17.3
|
||||
k8s.io/component-base => k8s.io/component-base v0.17.3
|
||||
k8s.io/cri-api => k8s.io/cri-api v0.17.3
|
||||
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.17.3
|
||||
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.17.3
|
||||
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.17.3
|
||||
k8s.io/kube-proxy => k8s.io/kube-proxy v0.17.3
|
||||
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.17.3
|
||||
k8s.io/kubectl => k8s.io/kubectl v0.17.3
|
||||
k8s.io/kubelet => k8s.io/kubelet v0.17.3
|
||||
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.17.3
|
||||
k8s.io/metrics => k8s.io/metrics v0.17.3
|
||||
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.17.3
|
||||
k8s.io/api => k8s.io/api v0.18.0
|
||||
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.0
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.18.0
|
||||
k8s.io/apiserver => k8s.io/apiserver v0.18.0
|
||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.18.0
|
||||
k8s.io/client-go => k8s.io/client-go v0.18.0
|
||||
k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.0
|
||||
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.0
|
||||
k8s.io/code-generator => k8s.io/code-generator v0.18.0
|
||||
k8s.io/component-base => k8s.io/component-base v0.18.0
|
||||
k8s.io/cri-api => k8s.io/cri-api v0.18.0
|
||||
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.0
|
||||
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.0
|
||||
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.0
|
||||
k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.0
|
||||
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.0
|
||||
k8s.io/kubectl => k8s.io/kubectl v0.18.0
|
||||
k8s.io/kubelet => k8s.io/kubelet v0.18.0
|
||||
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.18.0
|
||||
k8s.io/metrics => k8s.io/metrics v0.18.0
|
||||
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.18.0
|
||||
)
|
||||
|
|
174
go.sum
174
go.sum
|
@ -27,7 +27,7 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
|
|||
github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20190822182118-27a4ced34534/go.mod h1:iroGtC8B3tQiqtds1l+mgk/BBOrxbqjH+eUfFQYRc14=
|
||||
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab/go.mod h1:3VYc5hodBMJ5+l/7J4xAyMeuM2PNuepvHlGs8yilUCA=
|
||||
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E=
|
||||
github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
|
||||
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
|
||||
github.com/Microsoft/hcsshim v0.0.0-20190417211021-672e52e9209d/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg=
|
||||
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
|
@ -46,6 +46,7 @@ github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrU
|
|||
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
|
||||
github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=
|
||||
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
|
||||
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
|
@ -59,7 +60,7 @@ github.com/armon/go-proxyproto v0.0.0-20200108142055-f0b8253b1507/go.mod h1:QmP9
|
|||
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
github.com/auth0/go-jwt-middleware v0.0.0-20170425171159-5493cabe49f7/go.mod h1:LWMyo4iOLWXHGdBki7NIht1kHru/0wM179h+d3g8ATM=
|
||||
github.com/aws/aws-sdk-go v1.16.26/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/aws/aws-sdk-go v1.28.2/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/bazelbuild/bazel-gazelle v0.18.2/go.mod h1:D0ehMSbS+vesFsLGiD6JXu3mVEzOlfUl8wNnq+x/9p0=
|
||||
github.com/bazelbuild/bazel-gazelle v0.19.1-0.20191105222053-70208cbdc798/go.mod h1:rPwzNHUqEzngx1iVBfO/2X2npKaT3tqPqqHW6rVsn/A=
|
||||
github.com/bazelbuild/buildtools v0.0.0-20190731111112-f720930ceb60/go.mod h1:5JP0TXzWDHXv8qvxRC4InIazwdyDseBDbzESUMKk1yU=
|
||||
|
@ -79,14 +80,16 @@ github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx2
|
|||
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
|
||||
github.com/caddyserver/caddy v1.0.3/go.mod h1:G+ouvOY32gENkJC+jhgl62TyhvqEsFaDiZ4uw0RzP1E=
|
||||
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c/go.mod h1:Xe6ZsFhtM8HrDku0pxJ3/Lr51rwykrzgFwpmTzleatY=
|
||||
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
|
||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw=
|
||||
github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b/go.mod h1:TrMrLQfeENAPYPRsJuq3jsqdlRh3lvi6trTZJG8+tho=
|
||||
github.com/checkpoint-restore/go-criu v0.0.0-20181120144056-17b0214f6c48/go.mod h1:TrMrLQfeENAPYPRsJuq3jsqdlRh3lvi6trTZJG8+tho=
|
||||
github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
|
||||
github.com/cilium/ebpf v0.0.0-20191025125908-95b36a581eed/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/clusterhq/flocker-go v0.0.0-20160920122132-2b8b7259d313/go.mod h1:P1wt9Z3DP8O6W3rvwCt0REIlshg1InHImaLW0t3ObY0=
|
||||
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
|
||||
|
@ -96,7 +99,7 @@ github.com/containerd/console v0.0.0-20170925154832-84eeaae905fa/go.mod h1:Tj/on
|
|||
github.com/containerd/containerd v1.0.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
||||
github.com/containerd/typeurl v0.0.0-20190228175220-2a93cfde8c20/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc=
|
||||
github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
|
||||
github.com/coredns/corefile-migration v1.0.4/go.mod h1:OFwBp/Wc9dJt5cAZzHWMNhK1r5L0p0jDwIBc6j8NC8E=
|
||||
github.com/coredns/corefile-migration v1.0.6/go.mod h1:OFwBp/Wc9dJt5cAZzHWMNhK1r5L0p0jDwIBc6j8NC8E=
|
||||
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
||||
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
|
||||
|
@ -113,7 +116,6 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc
|
|||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4=
|
||||
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
@ -130,7 +132,7 @@ github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk
|
|||
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
|
||||
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/docker/libnetwork v0.8.0-dev.2.0.20190624125649-f0e46a78ea34/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8=
|
||||
github.com/docker/libnetwork v0.8.0-dev.2.0.20190925143933-c8a5fca4a652/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8=
|
||||
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96 h1:cenwrSVm+Z7QLSV/BsnenAOcDXdX4cMv4wP0B/5QbPg=
|
||||
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
|
||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
|
||||
|
@ -141,12 +143,14 @@ github.com/eapache/channels v1.1.0/go.mod h1:jMm2qB5Ubtg9zLd+inMZd2/NUvXgzmWXsDa
|
|||
github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
|
||||
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||
github.com/ekalinin/github-markdown-toc v0.0.0-20190514155158-83fadb60a7f1/go.mod h1:XfZS1iyC28CnllR54Ou2Ero6qs4Rmn7GpVumNSj1DZo=
|
||||
github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e h1:p1yVGRW3nmb85p1Sh1ZJSDm4A4iKLS5QNbvUHMgGu/M=
|
||||
github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
|
||||
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153 h1:yUdfgN0XgIJw7foRItutHYUIhlcKzcSf5vDpdhQAKTc=
|
||||
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
|
||||
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw=
|
||||
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
|
||||
github.com/emicklei/go-restful v2.9.5+incompatible h1:spTtZBk5DYEvbxMVutUuTyh1Ao2r4iyvLdACqsl/Ljk=
|
||||
github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/euank/go-kmsg-parser v2.0.0+incompatible/go.mod h1:MhmAMZ8V4CYH4ybgdRwPr2TU5ThnS43puaKEMpja1uw=
|
||||
github.com/evanphx/json-patch v4.2.0+incompatible h1:fUDGZCv/7iAN7u0puUVhvKCcsR6vRfwrJatElLBEf0I=
|
||||
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||
|
@ -161,6 +165,7 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
|
|||
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
|
||||
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa h1:RDBNVkRviHZtvDvId8XSGPu3rmpmSe+wKRcEWNgsfWU=
|
||||
|
@ -255,14 +260,13 @@ github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f/go.mod h1:/YcGZj5zSblf
|
|||
github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I=
|
||||
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
|
||||
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903 h1:LbsanbbD6LieFkXbj9YNNBupiGHJgFeLpO0j0Fza1h8=
|
||||
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7 h1:u4bArs140e9+AfE52mFHOXVFnOSBJBRlzTHrOPLOIhE=
|
||||
github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk=
|
||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.0.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
|
@ -270,8 +274,8 @@ github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8=
|
|||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||
github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
|
@ -315,9 +319,9 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
|||
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
||||
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
|
||||
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
|
@ -327,6 +331,7 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
|
|||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d h1:7XGaL1e6bYS1yIonGp9761ExpPPV1ui0SAC59Yube9k=
|
||||
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
|
||||
github.com/googleapis/gnostic v0.1.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
|
||||
github.com/googleapis/gnostic v0.3.1 h1:WeAefnSUHlBb0iJKwxFDZdbfGwkd7xRNuV+IpXMJhYk=
|
||||
github.com/googleapis/gnostic v0.3.1/go.mod h1:on+2t9HRStVgn95RSsFWFz+6Q0Snyqv1awfrALZdbtU=
|
||||
github.com/gophercloud/gophercloud v0.1.0 h1:P/nh25+rzXouhytV2pUHBb65fnds26Ghl8/391+sT5o=
|
||||
|
@ -372,7 +377,6 @@ github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0
|
|||
github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a/go.mod h1:wK6yTYYcgjHE1Z1QtXACPDjcFJyBskHEdagmnq3vsP8=
|
||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||
github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo=
|
||||
|
@ -385,6 +389,7 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1
|
|||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
|
||||
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM=
|
||||
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
|
||||
github.com/karrick/godirwalk v1.7.5/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46shStcFDJ34=
|
||||
|
@ -435,8 +440,10 @@ github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7
|
|||
github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk=
|
||||
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg=
|
||||
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
|
@ -467,12 +474,11 @@ github.com/mmarkdown/mmark v2.0.40+incompatible/go.mod h1:Uvmoz7tvsWpr7bMVxIpqZP
|
|||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
|
||||
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
|
||||
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
|
||||
github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs=
|
||||
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
|
||||
github.com/moul/pb v0.0.0-20180404114147-54bdd96e6a52 h1:8zDEa5yAIWYBHSDpPbSgGIBL/SvPSE9/FlB3aQ54d/A=
|
||||
|
@ -498,16 +504,13 @@ github.com/ncabatoff/procfs v0.0.0-20190407151002-9ced60d7b905/go.mod h1:KTPr41g
|
|||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.4.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w=
|
||||
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo=
|
||||
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU=
|
||||
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
||||
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||
github.com/onsi/gomega v1.3.0/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
|
||||
|
@ -516,9 +519,12 @@ github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
|
|||
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.8.1 h1:C5Dqfs/LeauYDX0jJXIe2SWmwCbGzx9yF8C8xy3Lh34=
|
||||
github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
|
||||
github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
|
||||
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
|
||||
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||
github.com/opencontainers/runc v1.0.0-rc10/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
|
||||
github.com/opencontainers/runc v1.0.0-rc9 h1:/k06BMULKF5hidyoZymkoDCzdJzltZpz/UU4LguQVtc=
|
||||
github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
|
||||
github.com/opencontainers/runtime-spec v1.0.0 h1:O6L965K88AilqnxeYPks/75HLpp4IG+FjeSCI3cVdRg=
|
||||
|
@ -534,14 +540,12 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
|||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA=
|
||||
github.com/pquerna/ffjson v0.0.0-20180717144149-af8b230fcd20/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M=
|
||||
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
|
||||
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
|
||||
github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
|
@ -550,18 +554,17 @@ github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3O
|
|||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
|
||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U=
|
||||
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20190403104016-ea9eea638872/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs=
|
||||
|
@ -594,12 +597,12 @@ github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjM
|
|||
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34cd2MNlA9u1mE=
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
|
@ -634,7 +637,6 @@ github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
|
|||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
|
@ -699,7 +701,6 @@ go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
|
|||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
|
||||
|
@ -719,12 +720,15 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
|
|||
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU=
|
||||
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0=
|
||||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo=
|
||||
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495 h1:I6A9Ag9FpEKOjcKrRNjQkPHawoXIhKyTGfvvjFAiiAk=
|
||||
golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
|
@ -735,7 +739,6 @@ golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU
|
|||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20170915142106-8351a756f30f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180112015858-5ccada7d0a7b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
|
@ -743,7 +746,6 @@ golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73r
|
|||
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
|
@ -778,7 +780,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
|
|||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20171026204733-164713f0dfce/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180117170059-2c42eef0765b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
@ -789,6 +790,7 @@ golang.org/x/sys v0.0.0-20190122071731-054c452bb702/go.mod h1:STP8DvDyc/dI5b8T5h
|
|||
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
@ -801,13 +803,13 @@ golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 h1:ng0gs1AKnRRuEMZoTLLlbOd+C17zUDepwGQBb/n+JVg=
|
||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.0.0-20170915090833-1cbadb444a80/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20171227012246-e19ae1496984/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
|
@ -837,6 +839,7 @@ golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3
|
|||
golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg=
|
||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
|
@ -850,12 +853,16 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+y
|
|||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gomodules.xyz/jsonpatch/v2 v2.0.1 h1:xyiBuvkD2g5n7cYzx6u2sxQvsAy4QJsZFCzGVdzOXZ0=
|
||||
gomodules.xyz/jsonpatch/v2 v2.0.1/go.mod h1:IhYNNY4jnS53ZnfE4PAmpKtDpTCj1JFXc+3mwe7XcUU=
|
||||
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
|
||||
gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485 h1:OB/uP/Puiu5vS5QMRPrXCDWUPb+kt8f1KW8oQzFejQw=
|
||||
gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0=
|
||||
gonum.org/v1/gonum v0.6.2/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU=
|
||||
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
|
||||
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e h1:jRyg0XfpwWlhEV8mDfdNGBeSJM2fuyh9Yjrnd8kF2Ts=
|
||||
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ=
|
||||
gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.6.1-0.20190607001116-5213b8090861/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
|
@ -869,11 +876,14 @@ google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7 h1:ZUjXAXmrAyrmmCP
|
|||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873 h1:nfPFGzJkUDX6uBmpN/pSw7MbOAWegH5QDQuoXFHedLg=
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.23.1 h1:q4XQuHFC6I28BKZpo6IYyb3mNO+l7lSOxRuYTCiDfXk=
|
||||
google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
@ -905,7 +915,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep
|
|||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/warnings.v0 v0.1.1/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
||||
gopkg.in/yaml.v2 v2.0.0/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
|
@ -923,54 +932,53 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh
|
|||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.1-2019.2.2/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
k8s.io/api v0.17.3 h1:XAm3PZp3wnEdzekNkcmj/9Y1zdmQYJ1I4GKSBBZ8aG0=
|
||||
k8s.io/api v0.17.3/go.mod h1:YZ0OTkuw7ipbe305fMpIdf3GLXZKRigjtZaV5gzC2J0=
|
||||
k8s.io/apiextensions-apiserver v0.17.3 h1:WDZWkPcbgvchEdDd7ysL21GGPx3UKZQLDZXEkevT6n4=
|
||||
k8s.io/apiextensions-apiserver v0.17.3/go.mod h1:CJbCyMfkKftAd/X/V6OTHYhVn7zXnDdnkUjS1h0GTeY=
|
||||
k8s.io/apimachinery v0.17.3 h1:f+uZV6rm4/tHE7xXgLyToprg6xWairaClGVkm2t8omg=
|
||||
k8s.io/apimachinery v0.17.3/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g=
|
||||
k8s.io/apiserver v0.17.3 h1:faZbSuFtJ4dx09vctKZGHms/7bp3qFtbqb10Swswqfs=
|
||||
k8s.io/apiserver v0.17.3/go.mod h1:iJtsPpu1ZpEnHaNawpSV0nYTGBhhX2dUlnn7/QS7QiY=
|
||||
k8s.io/cli-runtime v0.17.3 h1:0ZlDdJgJBKsu77trRUynNiWsRuAvAVPBNaQfnt/1qtc=
|
||||
k8s.io/cli-runtime v0.17.3/go.mod h1:X7idckYphH4SZflgNpOOViSxetiMj6xI0viMAjM81TA=
|
||||
k8s.io/client-go v0.17.3 h1:deUna1Ksx05XeESH6XGCyONNFfiQmDdqeqUvicvP6nU=
|
||||
k8s.io/client-go v0.17.3/go.mod h1:cLXlTMtWHkuK4tD360KpWz2gG2KtdWEr/OT02i3emRQ=
|
||||
k8s.io/cloud-provider v0.17.3 h1:tpjoxeb8lSrGr5FpF9fVRf9I+stW6VOw9dVvPeJLu7s=
|
||||
k8s.io/cloud-provider v0.17.3/go.mod h1:JBkKSQpbcjcYGDqH5PbifFrcgQ/7WOXRswnfLVbXpI8=
|
||||
k8s.io/cluster-bootstrap v0.17.3/go.mod h1:ujIYnCKnxY/MecpgPx9WgiYCVCFvici6tVIfI2FiI1g=
|
||||
k8s.io/code-generator v0.17.3 h1:q/hDMk2cvFzSxol7k/VA1qCssR7VSMXHQHhzuX29VJ8=
|
||||
k8s.io/code-generator v0.17.3/go.mod h1:l8BLVwASXQZTo2xamW5mQNFCe1XPiAesVq7Y1t7PiQQ=
|
||||
k8s.io/component-base v0.17.3 h1:hQzTSshY14aLSR6WGIYvmw+w+u6V4d+iDR2iDGMrlUg=
|
||||
k8s.io/component-base v0.17.3/go.mod h1:GeQf4BrgelWm64PXkIXiPh/XS0hnO42d9gx9BtbZRp8=
|
||||
k8s.io/cri-api v0.17.3 h1:jvjVvBqgZq3WcaPq07n0h5h9eCnIaR4dhKyHSoZG8Y8=
|
||||
k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM=
|
||||
k8s.io/csi-translation-lib v0.17.3/go.mod h1:FBya8XvGIqDm2/3evLQNxaFXqv/C2UcZa5JgJt6/qqY=
|
||||
k8s.io/api v0.18.0 h1:lwYk8Vt7rsVTwjRU6pzEsa9YNhThbmbocQlKvNBB4EQ=
|
||||
k8s.io/api v0.18.0/go.mod h1:q2HRQkfDzHMBZL9l/y9rH63PkQl4vae0xRT+8prbrK8=
|
||||
k8s.io/apiextensions-apiserver v0.18.0 h1:HN4/P8vpGZFvB5SOMuPPH2Wt9Y/ryX+KRvIyAkchu1Q=
|
||||
k8s.io/apiextensions-apiserver v0.18.0/go.mod h1:18Cwn1Xws4xnWQNC00FLq1E350b9lUF+aOdIWDOZxgo=
|
||||
k8s.io/apimachinery v0.18.0 h1:fuPfYpk3cs1Okp/515pAf0dNhL66+8zk8RLbSX+EgAE=
|
||||
k8s.io/apimachinery v0.18.0/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA=
|
||||
k8s.io/apiserver v0.18.0 h1:ELAWpGWC6XdbRLi5lwAbEbvksD7hkXxPdxaJsdpist4=
|
||||
k8s.io/apiserver v0.18.0/go.mod h1:3S2O6FeBBd6XTo0njUrLxiqk8GNy6wWOftjhJcXYnjw=
|
||||
k8s.io/cli-runtime v0.18.0 h1:jG8XpSqQ5TrV0N+EZ3PFz6+gqlCk71dkggWCCq9Mq34=
|
||||
k8s.io/cli-runtime v0.18.0/go.mod h1:1eXfmBsIJosjn9LjEBUd2WVPoPAY9XGTqTFcPMIBsUQ=
|
||||
k8s.io/client-go v0.18.0 h1:yqKw4cTUQraZK3fcVCMeSa+lqKwcjZ5wtcOIPnxQno4=
|
||||
k8s.io/client-go v0.18.0/go.mod h1:uQSYDYs4WhVZ9i6AIoEZuwUggLVEF64HOD37boKAtF8=
|
||||
k8s.io/cloud-provider v0.18.0 h1:Ri82BTdMutzIoiBWz/IS5o7I/+fCgRbO09iPWNfrZEM=
|
||||
k8s.io/cloud-provider v0.18.0/go.mod h1:ZBq1FhoJ+XoQ8JYBYoyx81LS3JV0RAW/UmHf/6w9E6k=
|
||||
k8s.io/cluster-bootstrap v0.18.0/go.mod h1:xSe+bOZ3asS/ciT91ESQYGhjOql43aBETfvbCzNvad8=
|
||||
k8s.io/code-generator v0.18.0 h1:0xIRWzym+qMgVpGmLESDeMfz/orwgxwxFFAo1xfGNtQ=
|
||||
k8s.io/code-generator v0.18.0/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc=
|
||||
k8s.io/component-base v0.18.0 h1:I+lP0fNfsEdTDpHaL61bCAqTZLoiWjEEP304Mo5ZQgE=
|
||||
k8s.io/component-base v0.18.0/go.mod h1:u3BCg0z1uskkzrnAKFzulmYaEpZF7XC9Pf/uFyb1v2c=
|
||||
k8s.io/cri-api v0.18.0 h1:ryVwCnvQ2OxtQHe56o85xZ9MkIoW4j0FrjgJG7x/Amw=
|
||||
k8s.io/cri-api v0.18.0/go.mod h1:OJtpjDvfsKoLGhvcc0qfygved0S0dGX56IJzPbqTG1s=
|
||||
k8s.io/csi-translation-lib v0.18.0/go.mod h1:iF8TE4ACSaPqN1qxmiIjvcU1A8VgkOrpcFGD7Z0hVu0=
|
||||
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/gengo v0.0.0-20190822140433-26a664648505 h1:ZY6yclUKVbZ+SdWnkfY+Je5vrMpKOxmGeKRbsXVmqYM=
|
||||
k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 h1:RPscN6KhmG54S33L+lr3GS+oD1jmchIU0ll519K6FA4=
|
||||
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/heapster v1.2.0-beta.1/go.mod h1:h1uhptVXMwC8xtZBYsPXKVi8fpdlYkTs6k949KozGrM=
|
||||
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
|
||||
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
|
||||
k8s.io/kube-aggregator v0.17.3/go.mod h1:1dMwMFQbmH76RKF0614L7dNenMl3dwnUJuOOyZ3GMXA=
|
||||
k8s.io/kube-controller-manager v0.17.3/go.mod h1:22B/TsgVviuCVuNwUrqgyTi5D4AYjMFaK9c8h1oonkY=
|
||||
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a h1:UcxjrRMyNx/i/y8G7kPvLyy7rfbeuf1PYyBf973pgyU=
|
||||
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
|
||||
k8s.io/kube-proxy v0.17.3/go.mod h1:ds8R8bUYPWtQlspC47Sff7o5aQhWDsv6jpQJATDuqaQ=
|
||||
k8s.io/kube-scheduler v0.17.3/go.mod h1:36HgrrPqzK+rOLTRtDG//b89KjrAZqFI4PXOpdH351M=
|
||||
k8s.io/kubectl v0.17.3/go.mod h1:NUn4IBY7f7yCMwSop2HCXlw/MVYP4HJBiUmOR3n9w28=
|
||||
k8s.io/kubelet v0.17.3/go.mod h1:Nh8owUHZcUXtnDAtmGnip36Nw+X6c4rbmDQlVyIhwMQ=
|
||||
k8s.io/kubernetes v1.17.3 h1:zWCppkLfHM+hoLqfbsrQ0cJnYw+4vAvedI92oQnjo/Q=
|
||||
k8s.io/kubernetes v1.17.3/go.mod h1:gt28rfzaskIzJ8d82TSJmGrJ0XZD0BBy8TcQvTuCI3w=
|
||||
k8s.io/legacy-cloud-providers v0.17.3/go.mod h1:ujZML5v8efVQxiXXTG+nck7SjP8KhMRjUYNIsoSkYI0=
|
||||
k8s.io/metrics v0.17.3/go.mod h1:HEJGy1fhHOjHggW9rMDBJBD3YuGroH3Y1pnIRw9FFaI=
|
||||
k8s.io/kube-aggregator v0.18.0/go.mod h1:ateewQ5QbjMZF/dihEFXwaEwoA4v/mayRvzfmvb6eqI=
|
||||
k8s.io/kube-controller-manager v0.18.0/go.mod h1:pIRGUrSo+skWzwr5pgWNbgiFWEGSotbamGQpR/gKd5U=
|
||||
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c h1:/KUFqjjqAcY4Us6luF5RDNZ16KJtb49HfR3ZHB9qYXM=
|
||||
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
|
||||
k8s.io/kube-proxy v0.18.0/go.mod h1:st3Gcg9wYAd1sn6UMeAs5AHN3R0NOItfB5P6qObKrr8=
|
||||
k8s.io/kube-scheduler v0.18.0/go.mod h1:GFaNT5Z5/zPZsjXmkGihac2qsT+0u2KIHDgXdFfPHPc=
|
||||
k8s.io/kubectl v0.18.0/go.mod h1:LOkWx9Z5DXMEg5KtOjHhRiC1fqJPLyCr3KtQgEolCkU=
|
||||
k8s.io/kubelet v0.18.0/go.mod h1:1VULM2m7c/ePlIeNOVVK+kkprayDr1RPf1T8oaNaHuQ=
|
||||
k8s.io/kubernetes v1.18.0 h1:rVe+edi5GwutPQJ4KIZq1Nk506nmnfyz/KOZVCLv7Yo=
|
||||
k8s.io/kubernetes v1.18.0/go.mod h1:z8xjOOO1Ljz+TaHpOxVGC7cxtF32TesIamoQ+BZrVS0=
|
||||
k8s.io/legacy-cloud-providers v0.18.0/go.mod h1:4Bc9CdZg8wl0mskyhnaXa8DdqLpTUfPEMkw3FZok+H8=
|
||||
k8s.io/metrics v0.18.0/go.mod h1:8aYTW18koXqjLVKL7Ds05RPMX9ipJZI3mywYvBOxXd4=
|
||||
k8s.io/repo-infra v0.0.1-alpha.1/go.mod h1:wO1t9WaB99V80ljbeENTnayuEEwNZt7gECYh/CEyOJ8=
|
||||
k8s.io/sample-apiserver v0.17.3/go.mod h1:cn/rvFIttGNqy1v88B5ZlDAbyyqDOoF7JHSwPiqNCNQ=
|
||||
k8s.io/sample-apiserver v0.18.0/go.mod h1:1RKw7QEixom4PIw/vjUvDgl2QQbuTXbeCUHLlNCzOjg=
|
||||
k8s.io/system-validators v1.0.4/go.mod h1:HgSgTg4NAGNoYYjKsUyk52gdNi2PVDswQ9Iyn66R7NI=
|
||||
k8s.io/utils v0.0.0-20190801114015-581e00157fb1/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
|
||||
k8s.io/utils v0.0.0-20191114184206-e782cd3c129f h1:GiPwtSzdP43eI1hpPCbROQCCIgCuiMMNF8YUVLF3vJo=
|
||||
k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
|
||||
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU=
|
||||
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
|
||||
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
|
||||
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
|
||||
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
|
||||
|
@ -981,15 +989,17 @@ mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jC
|
|||
mvdan.cc/unparam v0.0.0-20190209190245-fbb59629db34/go.mod h1:H6SUd1XjIs+qQCyskXg5OFSrilMRUkD8ePJpHKDPaeY=
|
||||
pault.ag/go/sniff v0.0.0-20200207005214-cf7e4d167732 h1:SAElp8THCfmBdM+4lmWX5gebiSSkEr7PAYDVF91qpfg=
|
||||
pault.ag/go/sniff v0.0.0-20200207005214-cf7e4d167732/go.mod h1:lpvCfhqEHNJSSpG5R5A2EgsVzG8RTt4RfPoQuRAcDmg=
|
||||
sigs.k8s.io/controller-runtime v0.4.0 h1:wATM6/m+3w8lj8FXNaO6Fs/rq/vqoOjO1Q116Z9NPsg=
|
||||
sigs.k8s.io/controller-runtime v0.4.0/go.mod h1:ApC79lpY3PHW9xj/w9pj+lYkLgwAAUZwfXkME1Lajns=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.7/go.mod h1:PHgbrJT7lCHcxMU+mDHEm+nx46H4zuuHZkDP6icnhu0=
|
||||
sigs.k8s.io/controller-runtime v0.5.1-0.20200327213554-2d4c4877f906 h1:GmjdjkxJjSpke49jWgDxBsd9uuHFdxEkBntoImFd2D8=
|
||||
sigs.k8s.io/controller-runtime v0.5.1-0.20200327213554-2d4c4877f906/go.mod h1:j4echH3Y/UPHRpXS65rxGXujda8iWOheMQvDh1uNgaY=
|
||||
sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
|
||||
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
|
||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||
sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06/go.mod h1:/ULNhyfzRopfcjskuui0cTITekDduZ7ycKN3oUT9R18=
|
||||
sigs.k8s.io/testing_frameworks v0.1.2 h1:vK0+tvjF0BZ/RYFeZ1E6BYBwHJJXhjuZ3TdsEKH+UQM=
|
||||
sigs.k8s.io/testing_frameworks v0.1.2/go.mod h1:ToQrwSC3s8Xf/lADdZp3Mktcql9CG0UAmdJG9th5i0w=
|
||||
sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=
|
||||
sigs.k8s.io/structured-merge-diff/v3 v3.0.0 h1:dOmIZBMfhcHS09XZkMyUgkq5trg3/jRyJYFZUiaOp8E=
|
||||
sigs.k8s.io/structured-merge-diff/v3 v3.0.0/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=
|
||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
|
||||
vbom.ml/util v0.0.0-20160121211510-db5cfe13f5cc/go.mod h1:so/NYdZXCz+E3ZpW0uAoCj6uzU2+8OWDFv/HxUSs7kI=
|
||||
|
|
22
vendor/github.com/blang/semver/LICENSE
generated
vendored
Normal file
22
vendor/github.com/blang/semver/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2014 Benedikt Lang <github at benediktlang.de>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
191
vendor/github.com/blang/semver/README.md
generated
vendored
Normal file
191
vendor/github.com/blang/semver/README.md
generated
vendored
Normal file
|
@ -0,0 +1,191 @@
|
|||
semver for golang [](https://drone.io/github.com/blang/semver/latest) [](https://godoc.org/github.com/blang/semver) [](https://coveralls.io/r/blang/semver?branch=master)
|
||||
======
|
||||
|
||||
semver is a [Semantic Versioning](http://semver.org/) library written in golang. It fully covers spec version `2.0.0`.
|
||||
|
||||
Usage
|
||||
-----
|
||||
```bash
|
||||
$ go get github.com/blang/semver
|
||||
```
|
||||
Note: Always vendor your dependencies or fix on a specific version tag.
|
||||
|
||||
```go
|
||||
import github.com/blang/semver
|
||||
v1, err := semver.Make("1.0.0-beta")
|
||||
v2, err := semver.Make("2.0.0-beta")
|
||||
v1.Compare(v2)
|
||||
```
|
||||
|
||||
Also check the [GoDocs](http://godoc.org/github.com/blang/semver).
|
||||
|
||||
Why should I use this lib?
|
||||
-----
|
||||
|
||||
- Fully spec compatible
|
||||
- No reflection
|
||||
- No regex
|
||||
- Fully tested (Coverage >99%)
|
||||
- Readable parsing/validation errors
|
||||
- Fast (See [Benchmarks](#benchmarks))
|
||||
- Only Stdlib
|
||||
- Uses values instead of pointers
|
||||
- Many features, see below
|
||||
|
||||
|
||||
Features
|
||||
-----
|
||||
|
||||
- Parsing and validation at all levels
|
||||
- Comparator-like comparisons
|
||||
- Compare Helper Methods
|
||||
- InPlace manipulation
|
||||
- Ranges `>=1.0.0 <2.0.0 || >=3.0.0 !3.0.1-beta.1`
|
||||
- Sortable (implements sort.Interface)
|
||||
- database/sql compatible (sql.Scanner/Valuer)
|
||||
- encoding/json compatible (json.Marshaler/Unmarshaler)
|
||||
|
||||
Ranges
|
||||
------
|
||||
|
||||
A `Range` is a set of conditions which specify which versions satisfy the range.
|
||||
|
||||
A condition is composed of an operator and a version. The supported operators are:
|
||||
|
||||
- `<1.0.0` Less than `1.0.0`
|
||||
- `<=1.0.0` Less than or equal to `1.0.0`
|
||||
- `>1.0.0` Greater than `1.0.0`
|
||||
- `>=1.0.0` Greater than or equal to `1.0.0`
|
||||
- `1.0.0`, `=1.0.0`, `==1.0.0` Equal to `1.0.0`
|
||||
- `!1.0.0`, `!=1.0.0` Not equal to `1.0.0`. Excludes version `1.0.0`.
|
||||
|
||||
A `Range` can link multiple `Ranges` separated by space:
|
||||
|
||||
Ranges can be linked by logical AND:
|
||||
|
||||
- `>1.0.0 <2.0.0` would match between both ranges, so `1.1.1` and `1.8.7` but not `1.0.0` or `2.0.0`
|
||||
- `>1.0.0 <3.0.0 !2.0.3-beta.2` would match every version between `1.0.0` and `3.0.0` except `2.0.3-beta.2`
|
||||
|
||||
Ranges can also be linked by logical OR:
|
||||
|
||||
- `<2.0.0 || >=3.0.0` would match `1.x.x` and `3.x.x` but not `2.x.x`
|
||||
|
||||
AND has a higher precedence than OR. It's not possible to use brackets.
|
||||
|
||||
Ranges can be combined by both AND and OR
|
||||
|
||||
- `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1`
|
||||
|
||||
Range usage:
|
||||
|
||||
```
|
||||
v, err := semver.Parse("1.2.3")
|
||||
range, err := semver.ParseRange(">1.0.0 <2.0.0 || >=3.0.0")
|
||||
if range(v) {
|
||||
//valid
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Example
|
||||
-----
|
||||
|
||||
Have a look at full examples in [examples/main.go](examples/main.go)
|
||||
|
||||
```go
|
||||
import github.com/blang/semver
|
||||
|
||||
v, err := semver.Make("0.0.1-alpha.preview+123.github")
|
||||
fmt.Printf("Major: %d\n", v.Major)
|
||||
fmt.Printf("Minor: %d\n", v.Minor)
|
||||
fmt.Printf("Patch: %d\n", v.Patch)
|
||||
fmt.Printf("Pre: %s\n", v.Pre)
|
||||
fmt.Printf("Build: %s\n", v.Build)
|
||||
|
||||
// Prerelease versions array
|
||||
if len(v.Pre) > 0 {
|
||||
fmt.Println("Prerelease versions:")
|
||||
for i, pre := range v.Pre {
|
||||
fmt.Printf("%d: %q\n", i, pre)
|
||||
}
|
||||
}
|
||||
|
||||
// Build meta data array
|
||||
if len(v.Build) > 0 {
|
||||
fmt.Println("Build meta data:")
|
||||
for i, build := range v.Build {
|
||||
fmt.Printf("%d: %q\n", i, build)
|
||||
}
|
||||
}
|
||||
|
||||
v001, err := semver.Make("0.0.1")
|
||||
// Compare using helpers: v.GT(v2), v.LT, v.GTE, v.LTE
|
||||
v001.GT(v) == true
|
||||
v.LT(v001) == true
|
||||
v.GTE(v) == true
|
||||
v.LTE(v) == true
|
||||
|
||||
// Or use v.Compare(v2) for comparisons (-1, 0, 1):
|
||||
v001.Compare(v) == 1
|
||||
v.Compare(v001) == -1
|
||||
v.Compare(v) == 0
|
||||
|
||||
// Manipulate Version in place:
|
||||
v.Pre[0], err = semver.NewPRVersion("beta")
|
||||
if err != nil {
|
||||
fmt.Printf("Error parsing pre release version: %q", err)
|
||||
}
|
||||
|
||||
fmt.Println("\nValidate versions:")
|
||||
v.Build[0] = "?"
|
||||
|
||||
err = v.Validate()
|
||||
if err != nil {
|
||||
fmt.Printf("Validation failed: %s\n", err)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Benchmarks
|
||||
-----
|
||||
|
||||
BenchmarkParseSimple-4 5000000 390 ns/op 48 B/op 1 allocs/op
|
||||
BenchmarkParseComplex-4 1000000 1813 ns/op 256 B/op 7 allocs/op
|
||||
BenchmarkParseAverage-4 1000000 1171 ns/op 163 B/op 4 allocs/op
|
||||
BenchmarkStringSimple-4 20000000 119 ns/op 16 B/op 1 allocs/op
|
||||
BenchmarkStringLarger-4 10000000 206 ns/op 32 B/op 2 allocs/op
|
||||
BenchmarkStringComplex-4 5000000 324 ns/op 80 B/op 3 allocs/op
|
||||
BenchmarkStringAverage-4 5000000 273 ns/op 53 B/op 2 allocs/op
|
||||
BenchmarkValidateSimple-4 200000000 9.33 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkValidateComplex-4 3000000 469 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkValidateAverage-4 5000000 256 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkCompareSimple-4 100000000 11.8 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkCompareComplex-4 50000000 30.8 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkCompareAverage-4 30000000 41.5 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkSort-4 3000000 419 ns/op 256 B/op 2 allocs/op
|
||||
BenchmarkRangeParseSimple-4 2000000 850 ns/op 192 B/op 5 allocs/op
|
||||
BenchmarkRangeParseAverage-4 1000000 1677 ns/op 400 B/op 10 allocs/op
|
||||
BenchmarkRangeParseComplex-4 300000 5214 ns/op 1440 B/op 30 allocs/op
|
||||
BenchmarkRangeMatchSimple-4 50000000 25.6 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkRangeMatchAverage-4 30000000 56.4 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkRangeMatchComplex-4 10000000 153 ns/op 0 B/op 0 allocs/op
|
||||
|
||||
See benchmark cases at [semver_test.go](semver_test.go)
|
||||
|
||||
|
||||
Motivation
|
||||
-----
|
||||
|
||||
I simply couldn't find any lib supporting the full spec. Others were just wrong or used reflection and regex which i don't like.
|
||||
|
||||
|
||||
Contribution
|
||||
-----
|
||||
|
||||
Feel free to make a pull request. For bigger changes create a issue first to discuss about it.
|
||||
|
||||
|
||||
License
|
||||
-----
|
||||
|
||||
See [LICENSE](LICENSE) file.
|
23
vendor/github.com/blang/semver/json.go
generated
vendored
Normal file
23
vendor/github.com/blang/semver/json.go
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
package semver
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// MarshalJSON implements the encoding/json.Marshaler interface.
|
||||
func (v Version) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.String())
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the encoding/json.Unmarshaler interface.
|
||||
func (v *Version) UnmarshalJSON(data []byte) (err error) {
|
||||
var versionString string
|
||||
|
||||
if err = json.Unmarshal(data, &versionString); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
*v, err = Parse(versionString)
|
||||
|
||||
return
|
||||
}
|
17
vendor/github.com/blang/semver/package.json
generated
vendored
Normal file
17
vendor/github.com/blang/semver/package.json
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"author": "blang",
|
||||
"bugs": {
|
||||
"URL": "https://github.com/blang/semver/issues",
|
||||
"url": "https://github.com/blang/semver/issues"
|
||||
},
|
||||
"gx": {
|
||||
"dvcsimport": "github.com/blang/semver"
|
||||
},
|
||||
"gxVersion": "0.10.0",
|
||||
"language": "go",
|
||||
"license": "MIT",
|
||||
"name": "semver",
|
||||
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
|
||||
"version": "3.4.0"
|
||||
}
|
||||
|
416
vendor/github.com/blang/semver/range.go
generated
vendored
Normal file
416
vendor/github.com/blang/semver/range.go
generated
vendored
Normal file
|
@ -0,0 +1,416 @@
|
|||
package semver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
type wildcardType int
|
||||
|
||||
const (
|
||||
noneWildcard wildcardType = iota
|
||||
majorWildcard wildcardType = 1
|
||||
minorWildcard wildcardType = 2
|
||||
patchWildcard wildcardType = 3
|
||||
)
|
||||
|
||||
func wildcardTypefromInt(i int) wildcardType {
|
||||
switch i {
|
||||
case 1:
|
||||
return majorWildcard
|
||||
case 2:
|
||||
return minorWildcard
|
||||
case 3:
|
||||
return patchWildcard
|
||||
default:
|
||||
return noneWildcard
|
||||
}
|
||||
}
|
||||
|
||||
type comparator func(Version, Version) bool
|
||||
|
||||
var (
|
||||
compEQ comparator = func(v1 Version, v2 Version) bool {
|
||||
return v1.Compare(v2) == 0
|
||||
}
|
||||
compNE = func(v1 Version, v2 Version) bool {
|
||||
return v1.Compare(v2) != 0
|
||||
}
|
||||
compGT = func(v1 Version, v2 Version) bool {
|
||||
return v1.Compare(v2) == 1
|
||||
}
|
||||
compGE = func(v1 Version, v2 Version) bool {
|
||||
return v1.Compare(v2) >= 0
|
||||
}
|
||||
compLT = func(v1 Version, v2 Version) bool {
|
||||
return v1.Compare(v2) == -1
|
||||
}
|
||||
compLE = func(v1 Version, v2 Version) bool {
|
||||
return v1.Compare(v2) <= 0
|
||||
}
|
||||
)
|
||||
|
||||
type versionRange struct {
|
||||
v Version
|
||||
c comparator
|
||||
}
|
||||
|
||||
// rangeFunc creates a Range from the given versionRange.
|
||||
func (vr *versionRange) rangeFunc() Range {
|
||||
return Range(func(v Version) bool {
|
||||
return vr.c(v, vr.v)
|
||||
})
|
||||
}
|
||||
|
||||
// Range represents a range of versions.
|
||||
// A Range can be used to check if a Version satisfies it:
|
||||
//
|
||||
// range, err := semver.ParseRange(">1.0.0 <2.0.0")
|
||||
// range(semver.MustParse("1.1.1") // returns true
|
||||
type Range func(Version) bool
|
||||
|
||||
// OR combines the existing Range with another Range using logical OR.
|
||||
func (rf Range) OR(f Range) Range {
|
||||
return Range(func(v Version) bool {
|
||||
return rf(v) || f(v)
|
||||
})
|
||||
}
|
||||
|
||||
// AND combines the existing Range with another Range using logical AND.
|
||||
func (rf Range) AND(f Range) Range {
|
||||
return Range(func(v Version) bool {
|
||||
return rf(v) && f(v)
|
||||
})
|
||||
}
|
||||
|
||||
// ParseRange parses a range and returns a Range.
|
||||
// If the range could not be parsed an error is returned.
|
||||
//
|
||||
// Valid ranges are:
|
||||
// - "<1.0.0"
|
||||
// - "<=1.0.0"
|
||||
// - ">1.0.0"
|
||||
// - ">=1.0.0"
|
||||
// - "1.0.0", "=1.0.0", "==1.0.0"
|
||||
// - "!1.0.0", "!=1.0.0"
|
||||
//
|
||||
// A Range can consist of multiple ranges separated by space:
|
||||
// Ranges can be linked by logical AND:
|
||||
// - ">1.0.0 <2.0.0" would match between both ranges, so "1.1.1" and "1.8.7" but not "1.0.0" or "2.0.0"
|
||||
// - ">1.0.0 <3.0.0 !2.0.3-beta.2" would match every version between 1.0.0 and 3.0.0 except 2.0.3-beta.2
|
||||
//
|
||||
// Ranges can also be linked by logical OR:
|
||||
// - "<2.0.0 || >=3.0.0" would match "1.x.x" and "3.x.x" but not "2.x.x"
|
||||
//
|
||||
// AND has a higher precedence than OR. It's not possible to use brackets.
|
||||
//
|
||||
// Ranges can be combined by both AND and OR
|
||||
//
|
||||
// - `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1`
|
||||
func ParseRange(s string) (Range, error) {
|
||||
parts := splitAndTrim(s)
|
||||
orParts, err := splitORParts(parts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
expandedParts, err := expandWildcardVersion(orParts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var orFn Range
|
||||
for _, p := range expandedParts {
|
||||
var andFn Range
|
||||
for _, ap := range p {
|
||||
opStr, vStr, err := splitComparatorVersion(ap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
vr, err := buildVersionRange(opStr, vStr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Could not parse Range %q: %s", ap, err)
|
||||
}
|
||||
rf := vr.rangeFunc()
|
||||
|
||||
// Set function
|
||||
if andFn == nil {
|
||||
andFn = rf
|
||||
} else { // Combine with existing function
|
||||
andFn = andFn.AND(rf)
|
||||
}
|
||||
}
|
||||
if orFn == nil {
|
||||
orFn = andFn
|
||||
} else {
|
||||
orFn = orFn.OR(andFn)
|
||||
}
|
||||
|
||||
}
|
||||
return orFn, nil
|
||||
}
|
||||
|
||||
// splitORParts splits the already cleaned parts by '||'.
|
||||
// Checks for invalid positions of the operator and returns an
|
||||
// error if found.
|
||||
func splitORParts(parts []string) ([][]string, error) {
|
||||
var ORparts [][]string
|
||||
last := 0
|
||||
for i, p := range parts {
|
||||
if p == "||" {
|
||||
if i == 0 {
|
||||
return nil, fmt.Errorf("First element in range is '||'")
|
||||
}
|
||||
ORparts = append(ORparts, parts[last:i])
|
||||
last = i + 1
|
||||
}
|
||||
}
|
||||
if last == len(parts) {
|
||||
return nil, fmt.Errorf("Last element in range is '||'")
|
||||
}
|
||||
ORparts = append(ORparts, parts[last:])
|
||||
return ORparts, nil
|
||||
}
|
||||
|
||||
// buildVersionRange takes a slice of 2: operator and version
|
||||
// and builds a versionRange, otherwise an error.
|
||||
func buildVersionRange(opStr, vStr string) (*versionRange, error) {
|
||||
c := parseComparator(opStr)
|
||||
if c == nil {
|
||||
return nil, fmt.Errorf("Could not parse comparator %q in %q", opStr, strings.Join([]string{opStr, vStr}, ""))
|
||||
}
|
||||
v, err := Parse(vStr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Could not parse version %q in %q: %s", vStr, strings.Join([]string{opStr, vStr}, ""), err)
|
||||
}
|
||||
|
||||
return &versionRange{
|
||||
v: v,
|
||||
c: c,
|
||||
}, nil
|
||||
|
||||
}
|
||||
|
||||
// inArray checks if a byte is contained in an array of bytes
|
||||
func inArray(s byte, list []byte) bool {
|
||||
for _, el := range list {
|
||||
if el == s {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// splitAndTrim splits a range string by spaces and cleans whitespaces
|
||||
func splitAndTrim(s string) (result []string) {
|
||||
last := 0
|
||||
var lastChar byte
|
||||
excludeFromSplit := []byte{'>', '<', '='}
|
||||
for i := 0; i < len(s); i++ {
|
||||
if s[i] == ' ' && !inArray(lastChar, excludeFromSplit) {
|
||||
if last < i-1 {
|
||||
result = append(result, s[last:i])
|
||||
}
|
||||
last = i + 1
|
||||
} else if s[i] != ' ' {
|
||||
lastChar = s[i]
|
||||
}
|
||||
}
|
||||
if last < len(s)-1 {
|
||||
result = append(result, s[last:])
|
||||
}
|
||||
|
||||
for i, v := range result {
|
||||
result[i] = strings.Replace(v, " ", "", -1)
|
||||
}
|
||||
|
||||
// parts := strings.Split(s, " ")
|
||||
// for _, x := range parts {
|
||||
// if s := strings.TrimSpace(x); len(s) != 0 {
|
||||
// result = append(result, s)
|
||||
// }
|
||||
// }
|
||||
return
|
||||
}
|
||||
|
||||
// splitComparatorVersion splits the comparator from the version.
|
||||
// Input must be free of leading or trailing spaces.
|
||||
func splitComparatorVersion(s string) (string, string, error) {
|
||||
i := strings.IndexFunc(s, unicode.IsDigit)
|
||||
if i == -1 {
|
||||
return "", "", fmt.Errorf("Could not get version from string: %q", s)
|
||||
}
|
||||
return strings.TrimSpace(s[0:i]), s[i:], nil
|
||||
}
|
||||
|
||||
// getWildcardType will return the type of wildcard that the
|
||||
// passed version contains
|
||||
func getWildcardType(vStr string) wildcardType {
|
||||
parts := strings.Split(vStr, ".")
|
||||
nparts := len(parts)
|
||||
wildcard := parts[nparts-1]
|
||||
|
||||
possibleWildcardType := wildcardTypefromInt(nparts)
|
||||
if wildcard == "x" {
|
||||
return possibleWildcardType
|
||||
}
|
||||
|
||||
return noneWildcard
|
||||
}
|
||||
|
||||
// createVersionFromWildcard will convert a wildcard version
|
||||
// into a regular version, replacing 'x's with '0's, handling
|
||||
// special cases like '1.x.x' and '1.x'
|
||||
func createVersionFromWildcard(vStr string) string {
|
||||
// handle 1.x.x
|
||||
vStr2 := strings.Replace(vStr, ".x.x", ".x", 1)
|
||||
vStr2 = strings.Replace(vStr2, ".x", ".0", 1)
|
||||
parts := strings.Split(vStr2, ".")
|
||||
|
||||
// handle 1.x
|
||||
if len(parts) == 2 {
|
||||
return vStr2 + ".0"
|
||||
}
|
||||
|
||||
return vStr2
|
||||
}
|
||||
|
||||
// incrementMajorVersion will increment the major version
|
||||
// of the passed version
|
||||
func incrementMajorVersion(vStr string) (string, error) {
|
||||
parts := strings.Split(vStr, ".")
|
||||
i, err := strconv.Atoi(parts[0])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
parts[0] = strconv.Itoa(i + 1)
|
||||
|
||||
return strings.Join(parts, "."), nil
|
||||
}
|
||||
|
||||
// incrementMajorVersion will increment the minor version
|
||||
// of the passed version
|
||||
func incrementMinorVersion(vStr string) (string, error) {
|
||||
parts := strings.Split(vStr, ".")
|
||||
i, err := strconv.Atoi(parts[1])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
parts[1] = strconv.Itoa(i + 1)
|
||||
|
||||
return strings.Join(parts, "."), nil
|
||||
}
|
||||
|
||||
// expandWildcardVersion will expand wildcards inside versions
|
||||
// following these rules:
|
||||
//
|
||||
// * when dealing with patch wildcards:
|
||||
// >= 1.2.x will become >= 1.2.0
|
||||
// <= 1.2.x will become < 1.3.0
|
||||
// > 1.2.x will become >= 1.3.0
|
||||
// < 1.2.x will become < 1.2.0
|
||||
// != 1.2.x will become < 1.2.0 >= 1.3.0
|
||||
//
|
||||
// * when dealing with minor wildcards:
|
||||
// >= 1.x will become >= 1.0.0
|
||||
// <= 1.x will become < 2.0.0
|
||||
// > 1.x will become >= 2.0.0
|
||||
// < 1.0 will become < 1.0.0
|
||||
// != 1.x will become < 1.0.0 >= 2.0.0
|
||||
//
|
||||
// * when dealing with wildcards without
|
||||
// version operator:
|
||||
// 1.2.x will become >= 1.2.0 < 1.3.0
|
||||
// 1.x will become >= 1.0.0 < 2.0.0
|
||||
func expandWildcardVersion(parts [][]string) ([][]string, error) {
|
||||
var expandedParts [][]string
|
||||
for _, p := range parts {
|
||||
var newParts []string
|
||||
for _, ap := range p {
|
||||
if strings.Index(ap, "x") != -1 {
|
||||
opStr, vStr, err := splitComparatorVersion(ap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
versionWildcardType := getWildcardType(vStr)
|
||||
flatVersion := createVersionFromWildcard(vStr)
|
||||
|
||||
var resultOperator string
|
||||
var shouldIncrementVersion bool
|
||||
switch opStr {
|
||||
case ">":
|
||||
resultOperator = ">="
|
||||
shouldIncrementVersion = true
|
||||
case ">=":
|
||||
resultOperator = ">="
|
||||
case "<":
|
||||
resultOperator = "<"
|
||||
case "<=":
|
||||
resultOperator = "<"
|
||||
shouldIncrementVersion = true
|
||||
case "", "=", "==":
|
||||
newParts = append(newParts, ">="+flatVersion)
|
||||
resultOperator = "<"
|
||||
shouldIncrementVersion = true
|
||||
case "!=", "!":
|
||||
newParts = append(newParts, "<"+flatVersion)
|
||||
resultOperator = ">="
|
||||
shouldIncrementVersion = true
|
||||
}
|
||||
|
||||
var resultVersion string
|
||||
if shouldIncrementVersion {
|
||||
switch versionWildcardType {
|
||||
case patchWildcard:
|
||||
resultVersion, _ = incrementMinorVersion(flatVersion)
|
||||
case minorWildcard:
|
||||
resultVersion, _ = incrementMajorVersion(flatVersion)
|
||||
}
|
||||
} else {
|
||||
resultVersion = flatVersion
|
||||
}
|
||||
|
||||
ap = resultOperator + resultVersion
|
||||
}
|
||||
newParts = append(newParts, ap)
|
||||
}
|
||||
expandedParts = append(expandedParts, newParts)
|
||||
}
|
||||
|
||||
return expandedParts, nil
|
||||
}
|
||||
|
||||
func parseComparator(s string) comparator {
|
||||
switch s {
|
||||
case "==":
|
||||
fallthrough
|
||||
case "":
|
||||
fallthrough
|
||||
case "=":
|
||||
return compEQ
|
||||
case ">":
|
||||
return compGT
|
||||
case ">=":
|
||||
return compGE
|
||||
case "<":
|
||||
return compLT
|
||||
case "<=":
|
||||
return compLE
|
||||
case "!":
|
||||
fallthrough
|
||||
case "!=":
|
||||
return compNE
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MustParseRange is like ParseRange but panics if the range cannot be parsed.
|
||||
func MustParseRange(s string) Range {
|
||||
r, err := ParseRange(s)
|
||||
if err != nil {
|
||||
panic(`semver: ParseRange(` + s + `): ` + err.Error())
|
||||
}
|
||||
return r
|
||||
}
|
418
vendor/github.com/blang/semver/semver.go
generated
vendored
Normal file
418
vendor/github.com/blang/semver/semver.go
generated
vendored
Normal file
|
@ -0,0 +1,418 @@
|
|||
package semver
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
numbers string = "0123456789"
|
||||
alphas = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"
|
||||
alphanum = alphas + numbers
|
||||
)
|
||||
|
||||
// SpecVersion is the latest fully supported spec version of semver
|
||||
var SpecVersion = Version{
|
||||
Major: 2,
|
||||
Minor: 0,
|
||||
Patch: 0,
|
||||
}
|
||||
|
||||
// Version represents a semver compatible version
|
||||
type Version struct {
|
||||
Major uint64
|
||||
Minor uint64
|
||||
Patch uint64
|
||||
Pre []PRVersion
|
||||
Build []string //No Precendence
|
||||
}
|
||||
|
||||
// Version to string
|
||||
func (v Version) String() string {
|
||||
b := make([]byte, 0, 5)
|
||||
b = strconv.AppendUint(b, v.Major, 10)
|
||||
b = append(b, '.')
|
||||
b = strconv.AppendUint(b, v.Minor, 10)
|
||||
b = append(b, '.')
|
||||
b = strconv.AppendUint(b, v.Patch, 10)
|
||||
|
||||
if len(v.Pre) > 0 {
|
||||
b = append(b, '-')
|
||||
b = append(b, v.Pre[0].String()...)
|
||||
|
||||
for _, pre := range v.Pre[1:] {
|
||||
b = append(b, '.')
|
||||
b = append(b, pre.String()...)
|
||||
}
|
||||
}
|
||||
|
||||
if len(v.Build) > 0 {
|
||||
b = append(b, '+')
|
||||
b = append(b, v.Build[0]...)
|
||||
|
||||
for _, build := range v.Build[1:] {
|
||||
b = append(b, '.')
|
||||
b = append(b, build...)
|
||||
}
|
||||
}
|
||||
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// Equals checks if v is equal to o.
|
||||
func (v Version) Equals(o Version) bool {
|
||||
return (v.Compare(o) == 0)
|
||||
}
|
||||
|
||||
// EQ checks if v is equal to o.
|
||||
func (v Version) EQ(o Version) bool {
|
||||
return (v.Compare(o) == 0)
|
||||
}
|
||||
|
||||
// NE checks if v is not equal to o.
|
||||
func (v Version) NE(o Version) bool {
|
||||
return (v.Compare(o) != 0)
|
||||
}
|
||||
|
||||
// GT checks if v is greater than o.
|
||||
func (v Version) GT(o Version) bool {
|
||||
return (v.Compare(o) == 1)
|
||||
}
|
||||
|
||||
// GTE checks if v is greater than or equal to o.
|
||||
func (v Version) GTE(o Version) bool {
|
||||
return (v.Compare(o) >= 0)
|
||||
}
|
||||
|
||||
// GE checks if v is greater than or equal to o.
|
||||
func (v Version) GE(o Version) bool {
|
||||
return (v.Compare(o) >= 0)
|
||||
}
|
||||
|
||||
// LT checks if v is less than o.
|
||||
func (v Version) LT(o Version) bool {
|
||||
return (v.Compare(o) == -1)
|
||||
}
|
||||
|
||||
// LTE checks if v is less than or equal to o.
|
||||
func (v Version) LTE(o Version) bool {
|
||||
return (v.Compare(o) <= 0)
|
||||
}
|
||||
|
||||
// LE checks if v is less than or equal to o.
|
||||
func (v Version) LE(o Version) bool {
|
||||
return (v.Compare(o) <= 0)
|
||||
}
|
||||
|
||||
// Compare compares Versions v to o:
|
||||
// -1 == v is less than o
|
||||
// 0 == v is equal to o
|
||||
// 1 == v is greater than o
|
||||
func (v Version) Compare(o Version) int {
|
||||
if v.Major != o.Major {
|
||||
if v.Major > o.Major {
|
||||
return 1
|
||||
}
|
||||
return -1
|
||||
}
|
||||
if v.Minor != o.Minor {
|
||||
if v.Minor > o.Minor {
|
||||
return 1
|
||||
}
|
||||
return -1
|
||||
}
|
||||
if v.Patch != o.Patch {
|
||||
if v.Patch > o.Patch {
|
||||
return 1
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// Quick comparison if a version has no prerelease versions
|
||||
if len(v.Pre) == 0 && len(o.Pre) == 0 {
|
||||
return 0
|
||||
} else if len(v.Pre) == 0 && len(o.Pre) > 0 {
|
||||
return 1
|
||||
} else if len(v.Pre) > 0 && len(o.Pre) == 0 {
|
||||
return -1
|
||||
}
|
||||
|
||||
i := 0
|
||||
for ; i < len(v.Pre) && i < len(o.Pre); i++ {
|
||||
if comp := v.Pre[i].Compare(o.Pre[i]); comp == 0 {
|
||||
continue
|
||||
} else if comp == 1 {
|
||||
return 1
|
||||
} else {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
// If all pr versions are the equal but one has further prversion, this one greater
|
||||
if i == len(v.Pre) && i == len(o.Pre) {
|
||||
return 0
|
||||
} else if i == len(v.Pre) && i < len(o.Pre) {
|
||||
return -1
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Validate validates v and returns error in case
|
||||
func (v Version) Validate() error {
|
||||
// Major, Minor, Patch already validated using uint64
|
||||
|
||||
for _, pre := range v.Pre {
|
||||
if !pre.IsNum { //Numeric prerelease versions already uint64
|
||||
if len(pre.VersionStr) == 0 {
|
||||
return fmt.Errorf("Prerelease can not be empty %q", pre.VersionStr)
|
||||
}
|
||||
if !containsOnly(pre.VersionStr, alphanum) {
|
||||
return fmt.Errorf("Invalid character(s) found in prerelease %q", pre.VersionStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, build := range v.Build {
|
||||
if len(build) == 0 {
|
||||
return fmt.Errorf("Build meta data can not be empty %q", build)
|
||||
}
|
||||
if !containsOnly(build, alphanum) {
|
||||
return fmt.Errorf("Invalid character(s) found in build meta data %q", build)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// New is an alias for Parse and returns a pointer, parses version string and returns a validated Version or error
|
||||
func New(s string) (vp *Version, err error) {
|
||||
v, err := Parse(s)
|
||||
vp = &v
|
||||
return
|
||||
}
|
||||
|
||||
// Make is an alias for Parse, parses version string and returns a validated Version or error
|
||||
func Make(s string) (Version, error) {
|
||||
return Parse(s)
|
||||
}
|
||||
|
||||
// ParseTolerant allows for certain version specifications that do not strictly adhere to semver
|
||||
// specs to be parsed by this library. It does so by normalizing versions before passing them to
|
||||
// Parse(). It currently trims spaces, removes a "v" prefix, and adds a 0 patch number to versions
|
||||
// with only major and minor components specified
|
||||
func ParseTolerant(s string) (Version, error) {
|
||||
s = strings.TrimSpace(s)
|
||||
s = strings.TrimPrefix(s, "v")
|
||||
|
||||
// Split into major.minor.(patch+pr+meta)
|
||||
parts := strings.SplitN(s, ".", 3)
|
||||
if len(parts) < 3 {
|
||||
if strings.ContainsAny(parts[len(parts)-1], "+-") {
|
||||
return Version{}, errors.New("Short version cannot contain PreRelease/Build meta data")
|
||||
}
|
||||
for len(parts) < 3 {
|
||||
parts = append(parts, "0")
|
||||
}
|
||||
s = strings.Join(parts, ".")
|
||||
}
|
||||
|
||||
return Parse(s)
|
||||
}
|
||||
|
||||
// Parse parses version string and returns a validated Version or error
|
||||
func Parse(s string) (Version, error) {
|
||||
if len(s) == 0 {
|
||||
return Version{}, errors.New("Version string empty")
|
||||
}
|
||||
|
||||
// Split into major.minor.(patch+pr+meta)
|
||||
parts := strings.SplitN(s, ".", 3)
|
||||
if len(parts) != 3 {
|
||||
return Version{}, errors.New("No Major.Minor.Patch elements found")
|
||||
}
|
||||
|
||||
// Major
|
||||
if !containsOnly(parts[0], numbers) {
|
||||
return Version{}, fmt.Errorf("Invalid character(s) found in major number %q", parts[0])
|
||||
}
|
||||
if hasLeadingZeroes(parts[0]) {
|
||||
return Version{}, fmt.Errorf("Major number must not contain leading zeroes %q", parts[0])
|
||||
}
|
||||
major, err := strconv.ParseUint(parts[0], 10, 64)
|
||||
if err != nil {
|
||||
return Version{}, err
|
||||
}
|
||||
|
||||
// Minor
|
||||
if !containsOnly(parts[1], numbers) {
|
||||
return Version{}, fmt.Errorf("Invalid character(s) found in minor number %q", parts[1])
|
||||
}
|
||||
if hasLeadingZeroes(parts[1]) {
|
||||
return Version{}, fmt.Errorf("Minor number must not contain leading zeroes %q", parts[1])
|
||||
}
|
||||
minor, err := strconv.ParseUint(parts[1], 10, 64)
|
||||
if err != nil {
|
||||
return Version{}, err
|
||||
}
|
||||
|
||||
v := Version{}
|
||||
v.Major = major
|
||||
v.Minor = minor
|
||||
|
||||
var build, prerelease []string
|
||||
patchStr := parts[2]
|
||||
|
||||
if buildIndex := strings.IndexRune(patchStr, '+'); buildIndex != -1 {
|
||||
build = strings.Split(patchStr[buildIndex+1:], ".")
|
||||
patchStr = patchStr[:buildIndex]
|
||||
}
|
||||
|
||||
if preIndex := strings.IndexRune(patchStr, '-'); preIndex != -1 {
|
||||
prerelease = strings.Split(patchStr[preIndex+1:], ".")
|
||||
patchStr = patchStr[:preIndex]
|
||||
}
|
||||
|
||||
if !containsOnly(patchStr, numbers) {
|
||||
return Version{}, fmt.Errorf("Invalid character(s) found in patch number %q", patchStr)
|
||||
}
|
||||
if hasLeadingZeroes(patchStr) {
|
||||
return Version{}, fmt.Errorf("Patch number must not contain leading zeroes %q", patchStr)
|
||||
}
|
||||
patch, err := strconv.ParseUint(patchStr, 10, 64)
|
||||
if err != nil {
|
||||
return Version{}, err
|
||||
}
|
||||
|
||||
v.Patch = patch
|
||||
|
||||
// Prerelease
|
||||
for _, prstr := range prerelease {
|
||||
parsedPR, err := NewPRVersion(prstr)
|
||||
if err != nil {
|
||||
return Version{}, err
|
||||
}
|
||||
v.Pre = append(v.Pre, parsedPR)
|
||||
}
|
||||
|
||||
// Build meta data
|
||||
for _, str := range build {
|
||||
if len(str) == 0 {
|
||||
return Version{}, errors.New("Build meta data is empty")
|
||||
}
|
||||
if !containsOnly(str, alphanum) {
|
||||
return Version{}, fmt.Errorf("Invalid character(s) found in build meta data %q", str)
|
||||
}
|
||||
v.Build = append(v.Build, str)
|
||||
}
|
||||
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// MustParse is like Parse but panics if the version cannot be parsed.
|
||||
func MustParse(s string) Version {
|
||||
v, err := Parse(s)
|
||||
if err != nil {
|
||||
panic(`semver: Parse(` + s + `): ` + err.Error())
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// PRVersion represents a PreRelease Version
|
||||
type PRVersion struct {
|
||||
VersionStr string
|
||||
VersionNum uint64
|
||||
IsNum bool
|
||||
}
|
||||
|
||||
// NewPRVersion creates a new valid prerelease version
|
||||
func NewPRVersion(s string) (PRVersion, error) {
|
||||
if len(s) == 0 {
|
||||
return PRVersion{}, errors.New("Prerelease is empty")
|
||||
}
|
||||
v := PRVersion{}
|
||||
if containsOnly(s, numbers) {
|
||||
if hasLeadingZeroes(s) {
|
||||
return PRVersion{}, fmt.Errorf("Numeric PreRelease version must not contain leading zeroes %q", s)
|
||||
}
|
||||
num, err := strconv.ParseUint(s, 10, 64)
|
||||
|
||||
// Might never be hit, but just in case
|
||||
if err != nil {
|
||||
return PRVersion{}, err
|
||||
}
|
||||
v.VersionNum = num
|
||||
v.IsNum = true
|
||||
} else if containsOnly(s, alphanum) {
|
||||
v.VersionStr = s
|
||||
v.IsNum = false
|
||||
} else {
|
||||
return PRVersion{}, fmt.Errorf("Invalid character(s) found in prerelease %q", s)
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// IsNumeric checks if prerelease-version is numeric
|
||||
func (v PRVersion) IsNumeric() bool {
|
||||
return v.IsNum
|
||||
}
|
||||
|
||||
// Compare compares two PreRelease Versions v and o:
|
||||
// -1 == v is less than o
|
||||
// 0 == v is equal to o
|
||||
// 1 == v is greater than o
|
||||
func (v PRVersion) Compare(o PRVersion) int {
|
||||
if v.IsNum && !o.IsNum {
|
||||
return -1
|
||||
} else if !v.IsNum && o.IsNum {
|
||||
return 1
|
||||
} else if v.IsNum && o.IsNum {
|
||||
if v.VersionNum == o.VersionNum {
|
||||
return 0
|
||||
} else if v.VersionNum > o.VersionNum {
|
||||
return 1
|
||||
} else {
|
||||
return -1
|
||||
}
|
||||
} else { // both are Alphas
|
||||
if v.VersionStr == o.VersionStr {
|
||||
return 0
|
||||
} else if v.VersionStr > o.VersionStr {
|
||||
return 1
|
||||
} else {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PreRelease version to string
|
||||
func (v PRVersion) String() string {
|
||||
if v.IsNum {
|
||||
return strconv.FormatUint(v.VersionNum, 10)
|
||||
}
|
||||
return v.VersionStr
|
||||
}
|
||||
|
||||
func containsOnly(s string, set string) bool {
|
||||
return strings.IndexFunc(s, func(r rune) bool {
|
||||
return !strings.ContainsRune(set, r)
|
||||
}) == -1
|
||||
}
|
||||
|
||||
func hasLeadingZeroes(s string) bool {
|
||||
return len(s) > 1 && s[0] == '0'
|
||||
}
|
||||
|
||||
// NewBuildVersion creates a new valid build version
|
||||
func NewBuildVersion(s string) (string, error) {
|
||||
if len(s) == 0 {
|
||||
return "", errors.New("Buildversion is empty")
|
||||
}
|
||||
if !containsOnly(s, alphanum) {
|
||||
return "", fmt.Errorf("Invalid character(s) found in build meta data %q", s)
|
||||
}
|
||||
return s, nil
|
||||
}
|
28
vendor/github.com/blang/semver/sort.go
generated
vendored
Normal file
28
vendor/github.com/blang/semver/sort.go
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
package semver
|
||||
|
||||
import (
|
||||
"sort"
|
||||
)
|
||||
|
||||
// Versions represents multiple versions.
|
||||
type Versions []Version
|
||||
|
||||
// Len returns length of version collection
|
||||
func (s Versions) Len() int {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
// Swap swaps two versions inside the collection by its indices
|
||||
func (s Versions) Swap(i, j int) {
|
||||
s[i], s[j] = s[j], s[i]
|
||||
}
|
||||
|
||||
// Less checks if version at index i is less than version at index j
|
||||
func (s Versions) Less(i, j int) bool {
|
||||
return s[i].LT(s[j])
|
||||
}
|
||||
|
||||
// Sort sorts a slice of versions
|
||||
func Sort(versions []Version) {
|
||||
sort.Sort(Versions(versions))
|
||||
}
|
30
vendor/github.com/blang/semver/sql.go
generated
vendored
Normal file
30
vendor/github.com/blang/semver/sql.go
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
package semver
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Scan implements the database/sql.Scanner interface.
|
||||
func (v *Version) Scan(src interface{}) (err error) {
|
||||
var str string
|
||||
switch src := src.(type) {
|
||||
case string:
|
||||
str = src
|
||||
case []byte:
|
||||
str = string(src)
|
||||
default:
|
||||
return fmt.Errorf("Version.Scan: cannot convert %T to string.", src)
|
||||
}
|
||||
|
||||
if t, err := Parse(str); err == nil {
|
||||
*v = t
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Value implements the database/sql/driver.Valuer interface.
|
||||
func (v Version) Value() (driver.Value, error) {
|
||||
return v.String(), nil
|
||||
}
|
2
vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go
generated
vendored
2
vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go
generated
vendored
|
@ -19,7 +19,7 @@ var _ = math.Inf
|
|||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
var E_GoprotoEnumPrefix = &proto.ExtensionDesc{
|
||||
ExtendedType: (*descriptor.EnumOptions)(nil),
|
||||
|
|
2
vendor/github.com/gogo/protobuf/proto/encode.go
generated
vendored
2
vendor/github.com/gogo/protobuf/proto/encode.go
generated
vendored
|
@ -189,6 +189,8 @@ type Marshaler interface {
|
|||
// prefixed by a varint-encoded length.
|
||||
func (p *Buffer) EncodeMessage(pb Message) error {
|
||||
siz := Size(pb)
|
||||
sizVar := SizeVarint(uint64(siz))
|
||||
p.grow(siz + sizVar)
|
||||
p.EncodeVarint(uint64(siz))
|
||||
return p.Marshal(pb)
|
||||
}
|
||||
|
|
18
vendor/github.com/gogo/protobuf/proto/lib.go
generated
vendored
18
vendor/github.com/gogo/protobuf/proto/lib.go
generated
vendored
|
@ -948,13 +948,19 @@ func isProto3Zero(v reflect.Value) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// ProtoPackageIsVersion2 is referenced from generated protocol buffer files
|
||||
// to assert that that code is compatible with this version of the proto package.
|
||||
const GoGoProtoPackageIsVersion2 = true
|
||||
const (
|
||||
// ProtoPackageIsVersion3 is referenced from generated protocol buffer files
|
||||
// to assert that that code is compatible with this version of the proto package.
|
||||
GoGoProtoPackageIsVersion3 = true
|
||||
|
||||
// ProtoPackageIsVersion1 is referenced from generated protocol buffer files
|
||||
// to assert that that code is compatible with this version of the proto package.
|
||||
const GoGoProtoPackageIsVersion1 = true
|
||||
// ProtoPackageIsVersion2 is referenced from generated protocol buffer files
|
||||
// to assert that that code is compatible with this version of the proto package.
|
||||
GoGoProtoPackageIsVersion2 = true
|
||||
|
||||
// ProtoPackageIsVersion1 is referenced from generated protocol buffer files
|
||||
// to assert that that code is compatible with this version of the proto package.
|
||||
GoGoProtoPackageIsVersion1 = true
|
||||
)
|
||||
|
||||
// InternalMessageInfo is a type used internally by generated .pb.go files.
|
||||
// This type is not intended to be used by non-generated code.
|
||||
|
|
29
vendor/github.com/gogo/protobuf/proto/properties.go
generated
vendored
29
vendor/github.com/gogo/protobuf/proto/properties.go
generated
vendored
|
@ -43,7 +43,6 @@ package proto
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
@ -205,7 +204,7 @@ func (p *Properties) Parse(s string) {
|
|||
// "bytes,49,opt,name=foo,def=hello!"
|
||||
fields := strings.Split(s, ",") // breaks def=, but handled below.
|
||||
if len(fields) < 2 {
|
||||
fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s)
|
||||
log.Printf("proto: tag has too few fields: %q", s)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -225,7 +224,7 @@ func (p *Properties) Parse(s string) {
|
|||
p.WireType = WireBytes
|
||||
// no numeric converter for non-numeric types
|
||||
default:
|
||||
fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s)
|
||||
log.Printf("proto: tag has unknown wire type: %q", s)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -400,6 +399,15 @@ func GetProperties(t reflect.Type) *StructProperties {
|
|||
return sprop
|
||||
}
|
||||
|
||||
type (
|
||||
oneofFuncsIface interface {
|
||||
XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
|
||||
}
|
||||
oneofWrappersIface interface {
|
||||
XXX_OneofWrappers() []interface{}
|
||||
}
|
||||
)
|
||||
|
||||
// getPropertiesLocked requires that propertiesMu is held.
|
||||
func getPropertiesLocked(t reflect.Type) *StructProperties {
|
||||
if prop, ok := propertiesMap[t]; ok {
|
||||
|
@ -441,13 +449,15 @@ func getPropertiesLocked(t reflect.Type) *StructProperties {
|
|||
// Re-order prop.order.
|
||||
sort.Sort(prop)
|
||||
|
||||
type oneofMessage interface {
|
||||
XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
|
||||
}
|
||||
if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); isOneofMessage && ok {
|
||||
if isOneofMessage {
|
||||
var oots []interface{}
|
||||
_, _, _, oots = om.XXX_OneofFuncs()
|
||||
|
||||
switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) {
|
||||
case oneofFuncsIface:
|
||||
_, _, _, oots = m.XXX_OneofFuncs()
|
||||
case oneofWrappersIface:
|
||||
oots = m.XXX_OneofWrappers()
|
||||
}
|
||||
if len(oots) > 0 {
|
||||
// Interpret oneof metadata.
|
||||
prop.OneofTypes = make(map[string]*OneofProperties)
|
||||
for _, oot := range oots {
|
||||
|
@ -474,6 +484,7 @@ func getPropertiesLocked(t reflect.Type) *StructProperties {
|
|||
prop.OneofTypes[oop.Prop.OrigName] = oop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// build required counts
|
||||
// build tags
|
||||
|
|
15
vendor/github.com/gogo/protobuf/proto/table_marshal.go
generated
vendored
15
vendor/github.com/gogo/protobuf/proto/table_marshal.go
generated
vendored
|
@ -389,8 +389,13 @@ func (u *marshalInfo) computeMarshalInfo() {
|
|||
// get oneof implementers
|
||||
var oneofImplementers []interface{}
|
||||
// gogo: isOneofMessage is needed for embedded oneof messages, without a marshaler and unmarshaler
|
||||
if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok && isOneofMessage {
|
||||
if isOneofMessage {
|
||||
switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) {
|
||||
case oneofFuncsIface:
|
||||
_, _, _, oneofImplementers = m.XXX_OneofFuncs()
|
||||
case oneofWrappersIface:
|
||||
oneofImplementers = m.XXX_OneofWrappers()
|
||||
}
|
||||
}
|
||||
|
||||
// normal fields
|
||||
|
@ -519,10 +524,6 @@ func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofI
|
|||
}
|
||||
}
|
||||
|
||||
type oneofMessage interface {
|
||||
XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
|
||||
}
|
||||
|
||||
// wiretype returns the wire encoding of the type.
|
||||
func wiretype(encoding string) uint64 {
|
||||
switch encoding {
|
||||
|
@ -2968,7 +2969,9 @@ func (p *Buffer) Marshal(pb Message) error {
|
|||
if m, ok := pb.(newMarshaler); ok {
|
||||
siz := m.XXX_Size()
|
||||
p.grow(siz) // make sure buf has enough capacity
|
||||
p.buf, err = m.XXX_Marshal(p.buf, p.deterministic)
|
||||
pp := p.buf[len(p.buf) : len(p.buf) : len(p.buf)+siz]
|
||||
pp, err = m.XXX_Marshal(pp, p.deterministic)
|
||||
p.buf = append(p.buf, pp...)
|
||||
return err
|
||||
}
|
||||
if m, ok := pb.(Marshaler); ok {
|
||||
|
|
19
vendor/github.com/gogo/protobuf/proto/table_merge.go
generated
vendored
19
vendor/github.com/gogo/protobuf/proto/table_merge.go
generated
vendored
|
@ -530,6 +530,25 @@ func (mi *mergeInfo) computeMergeInfo() {
|
|||
}
|
||||
case reflect.Struct:
|
||||
switch {
|
||||
case isSlice && !isPointer: // E.g. []pb.T
|
||||
mergeInfo := getMergeInfo(tf)
|
||||
zero := reflect.Zero(tf)
|
||||
mfi.merge = func(dst, src pointer) {
|
||||
// TODO: Make this faster?
|
||||
dstsp := dst.asPointerTo(f.Type)
|
||||
dsts := dstsp.Elem()
|
||||
srcs := src.asPointerTo(f.Type).Elem()
|
||||
for i := 0; i < srcs.Len(); i++ {
|
||||
dsts = reflect.Append(dsts, zero)
|
||||
srcElement := srcs.Index(i).Addr()
|
||||
dstElement := dsts.Index(dsts.Len() - 1).Addr()
|
||||
mergeInfo.merge(valToPointer(dstElement), valToPointer(srcElement))
|
||||
}
|
||||
if dsts.IsNil() {
|
||||
dsts = reflect.MakeSlice(f.Type, 0, 0)
|
||||
}
|
||||
dstsp.Elem().Set(dsts)
|
||||
}
|
||||
case !isPointer:
|
||||
mergeInfo := getMergeInfo(tf)
|
||||
mfi.merge = func(dst, src pointer) {
|
||||
|
|
20
vendor/github.com/gogo/protobuf/proto/table_unmarshal.go
generated
vendored
20
vendor/github.com/gogo/protobuf/proto/table_unmarshal.go
generated
vendored
|
@ -371,14 +371,17 @@ func (u *unmarshalInfo) computeUnmarshalInfo() {
|
|||
}
|
||||
|
||||
// Find any types associated with oneof fields.
|
||||
// TODO: XXX_OneofFuncs returns more info than we need. Get rid of some of it?
|
||||
fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("XXX_OneofFuncs")
|
||||
// gogo: len(oneofFields) > 0 is needed for embedded oneof messages, without a marshaler and unmarshaler
|
||||
if fn.IsValid() && len(oneofFields) > 0 {
|
||||
res := fn.Call(nil)[3] // last return value from XXX_OneofFuncs: []interface{}
|
||||
for i := res.Len() - 1; i >= 0; i-- {
|
||||
v := res.Index(i) // interface{}
|
||||
tptr := reflect.ValueOf(v.Interface()).Type() // *Msg_X
|
||||
if len(oneofFields) > 0 {
|
||||
var oneofImplementers []interface{}
|
||||
switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) {
|
||||
case oneofFuncsIface:
|
||||
_, _, _, oneofImplementers = m.XXX_OneofFuncs()
|
||||
case oneofWrappersIface:
|
||||
oneofImplementers = m.XXX_OneofWrappers()
|
||||
}
|
||||
for _, v := range oneofImplementers {
|
||||
tptr := reflect.TypeOf(v) // *Msg_X
|
||||
typ := tptr.Elem() // Msg_X
|
||||
|
||||
f := typ.Field(0) // oneof implementers have one field
|
||||
|
@ -407,11 +410,12 @@ func (u *unmarshalInfo) computeUnmarshalInfo() {
|
|||
u.setTag(fieldNum, of.field, unmarshal, 0, name)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Get extension ranges, if any.
|
||||
fn = reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray")
|
||||
fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray")
|
||||
if fn.IsValid() {
|
||||
if !u.extensions.IsValid() && !u.oldExtensions.IsValid() && !u.bytesExtensions.IsValid() {
|
||||
panic("a message with extensions, but no extensions field in " + t.Name())
|
||||
|
|
6
vendor/github.com/gogo/protobuf/proto/text.go
generated
vendored
6
vendor/github.com/gogo/protobuf/proto/text.go
generated
vendored
|
@ -476,6 +476,8 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
|
||||
|
||||
// writeAny writes an arbitrary field.
|
||||
func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error {
|
||||
v = reflect.Indirect(v)
|
||||
|
@ -589,8 +591,8 @@ func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Propert
|
|||
// mutating this value.
|
||||
v = v.Addr()
|
||||
}
|
||||
if etm, ok := v.Interface().(encoding.TextMarshaler); ok {
|
||||
text, err := etm.MarshalText()
|
||||
if v.Type().Implements(textMarshalerType) {
|
||||
text, err := v.Interface().(encoding.TextMarshaler).MarshalText()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
10
vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go
generated
vendored
10
vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go
generated
vendored
|
@ -18,7 +18,7 @@ var _ = math.Inf
|
|||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type FieldDescriptorProto_Type int32
|
||||
|
||||
|
@ -1364,8 +1364,8 @@ type FileOptions struct {
|
|||
// determining the namespace.
|
||||
PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"`
|
||||
// Use this option to change the namespace of php generated metadata classes.
|
||||
// Default is empty. When this option is empty, the proto file name will be used
|
||||
// for determining the namespace.
|
||||
// Default is empty. When this option is empty, the proto file name will be
|
||||
// used for determining the namespace.
|
||||
PhpMetadataNamespace *string `protobuf:"bytes,44,opt,name=php_metadata_namespace,json=phpMetadataNamespace" json:"php_metadata_namespace,omitempty"`
|
||||
// Use this option to change the package of ruby generated classes. Default
|
||||
// is empty. When this option is not set, the package name will be used for
|
||||
|
@ -1615,7 +1615,7 @@ type MessageOptions struct {
|
|||
//
|
||||
// Implementations may choose not to generate the map_entry=true message, but
|
||||
// use a native map in the target language to hold the keys and values.
|
||||
// The reflection APIs in such implementions still need to work as
|
||||
// The reflection APIs in such implementations still need to work as
|
||||
// if the field is a repeated message field.
|
||||
//
|
||||
// NOTE: Do not set the option in .proto files. Always use the maps syntax
|
||||
|
@ -2363,7 +2363,7 @@ type SourceCodeInfo struct {
|
|||
// beginning of the "extend" block and is shared by all extensions within
|
||||
// the block.
|
||||
// - Just because a location's span is a subset of some other location's span
|
||||
// does not mean that it is a descendent. For example, a "group" defines
|
||||
// does not mean that it is a descendant. For example, a "group" defines
|
||||
// both a type and a field in a single declaration. Thus, the locations
|
||||
// corresponding to the type and field and their components will overlap.
|
||||
// - Code which tries to interpret locations should probably be designed to
|
||||
|
|
2
vendor/github.com/google/gofuzz/README.md
generated
vendored
2
vendor/github.com/google/gofuzz/README.md
generated
vendored
|
@ -3,7 +3,7 @@ gofuzz
|
|||
|
||||
gofuzz is a library for populating go objects with random values.
|
||||
|
||||
[](https://godoc.org/github.com/google/gofuzz)
|
||||
[](https://godoc.org/github.com/google/gofuzz)
|
||||
[](https://travis-ci.org/google/gofuzz)
|
||||
|
||||
This is useful for testing:
|
||||
|
|
19
vendor/github.com/google/gofuzz/fuzz.go
generated
vendored
19
vendor/github.com/google/gofuzz/fuzz.go
generated
vendored
|
@ -20,6 +20,7 @@ import (
|
|||
"fmt"
|
||||
"math/rand"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -35,6 +36,7 @@ type Fuzzer struct {
|
|||
minElements int
|
||||
maxElements int
|
||||
maxDepth int
|
||||
skipFieldPatterns []*regexp.Regexp
|
||||
}
|
||||
|
||||
// New returns a new Fuzzer. Customize your Fuzzer further by calling Funcs,
|
||||
|
@ -150,6 +152,13 @@ func (f *Fuzzer) MaxDepth(d int) *Fuzzer {
|
|||
return f
|
||||
}
|
||||
|
||||
// Skip fields which match the supplied pattern. Call this multiple times if needed
|
||||
// This is useful to skip XXX_ fields generated by protobuf
|
||||
func (f *Fuzzer) SkipFieldsWithPattern(pattern *regexp.Regexp) *Fuzzer {
|
||||
f.skipFieldPatterns = append(f.skipFieldPatterns, pattern)
|
||||
return f
|
||||
}
|
||||
|
||||
// Fuzz recursively fills all of obj's fields with something random. First
|
||||
// this tries to find a custom fuzz function (see Funcs). If there is no
|
||||
// custom function this tests whether the object implements fuzz.Interface and,
|
||||
|
@ -274,8 +283,18 @@ func (fc *fuzzerContext) doFuzz(v reflect.Value, flags uint64) {
|
|||
v.Set(reflect.Zero(v.Type()))
|
||||
case reflect.Struct:
|
||||
for i := 0; i < v.NumField(); i++ {
|
||||
skipField := false
|
||||
fieldName := v.Type().Field(i).Name
|
||||
for _, pattern := range fc.fuzzer.skipFieldPatterns {
|
||||
if pattern.MatchString(fieldName) {
|
||||
skipField = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !skipField {
|
||||
fc.doFuzz(v.Field(i), 0)
|
||||
}
|
||||
}
|
||||
case reflect.Chan:
|
||||
fallthrough
|
||||
case reflect.Func:
|
||||
|
|
3
vendor/github.com/onsi/gomega/.travis.yml
generated
vendored
3
vendor/github.com/onsi/gomega/.travis.yml
generated
vendored
|
@ -1,9 +1,8 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.10.x
|
||||
- 1.11.x
|
||||
- 1.12.x
|
||||
- 1.13.x
|
||||
- gotip
|
||||
|
||||
env:
|
||||
|
|
11
vendor/github.com/onsi/gomega/CHANGELOG.md
generated
vendored
11
vendor/github.com/onsi/gomega/CHANGELOG.md
generated
vendored
|
@ -1,3 +1,14 @@
|
|||
## 1.8.1
|
||||
|
||||
### Fixes
|
||||
- Fix unexpected MatchError() behaviour (#375) [8ae7b2f]
|
||||
|
||||
## 1.8.0
|
||||
|
||||
### Features
|
||||
- Allow optional description to be lazily evaluated function (#364) [bf64010]
|
||||
- Support wrapped errors (#359) [0a981cb]
|
||||
|
||||
## 1.7.1
|
||||
|
||||
### Fixes
|
||||
|
|
1
vendor/github.com/onsi/gomega/go.mod
generated
vendored
1
vendor/github.com/onsi/gomega/go.mod
generated
vendored
|
@ -9,6 +9,7 @@ require (
|
|||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e // indirect
|
||||
golang.org/x/text v0.3.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
|
||||
gopkg.in/fsnotify.v1 v1.4.7 // indirect
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.4
|
||||
|
|
2
vendor/github.com/onsi/gomega/go.sum
generated
vendored
2
vendor/github.com/onsi/gomega/go.sum
generated
vendored
|
@ -14,6 +14,8 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUk
|
|||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
|
|
19
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
19
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
|
@ -24,7 +24,7 @@ import (
|
|||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
const GOMEGA_VERSION = "1.7.1"
|
||||
const GOMEGA_VERSION = "1.8.1"
|
||||
|
||||
const nilFailHandlerPanic = `You are trying to make an assertion, but Gomega's fail handler is nil.
|
||||
If you're using Ginkgo then you probably forgot to put your assertion in an It().
|
||||
|
@ -293,16 +293,18 @@ func SetDefaultConsistentlyPollingInterval(t time.Duration) {
|
|||
// AsyncAssertion is returned by Eventually and Consistently and polls the actual value passed into Eventually against
|
||||
// the matcher passed to the Should and ShouldNot methods.
|
||||
//
|
||||
// Both Should and ShouldNot take a variadic optionalDescription argument. This is passed on to
|
||||
// fmt.Sprintf() and is used to annotate failure messages. This allows you to make your failure messages more
|
||||
// descriptive.
|
||||
// Both Should and ShouldNot take a variadic optionalDescription argument.
|
||||
// This argument allows you to make your failure messages more descriptive.
|
||||
// If a single argument of type `func() string` is passed, this function will be lazily evaluated if a failure occurs
|
||||
// and the returned string is used to annotate the failure message.
|
||||
// Otherwise, this argument is passed on to fmt.Sprintf() and then used to annotate the failure message.
|
||||
//
|
||||
// Both Should and ShouldNot return a boolean that is true if the assertion passed and false if it failed.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// Eventually(myChannel).Should(Receive(), "Something should have come down the pipe.")
|
||||
// Consistently(myChannel).ShouldNot(Receive(), "Nothing should have come down the pipe.")
|
||||
// Consistently(myChannel).ShouldNot(Receive(), func() string { return "Nothing should have come down the pipe." })
|
||||
type AsyncAssertion interface {
|
||||
Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool
|
||||
ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool
|
||||
|
@ -317,8 +319,11 @@ type GomegaAsyncAssertion = AsyncAssertion
|
|||
// Typically Should/ShouldNot are used with Ω and To/ToNot/NotTo are used with Expect
|
||||
// though this is not enforced.
|
||||
//
|
||||
// All methods take a variadic optionalDescription argument. This is passed on to fmt.Sprintf()
|
||||
// and is used to annotate failure messages.
|
||||
// All methods take a variadic optionalDescription argument.
|
||||
// This argument allows you to make your failure messages more descriptive.
|
||||
// If a single argument of type `func() string` is passed, this function will be lazily evaluated if a failure occurs
|
||||
// and the returned string is used to annotate the failure message.
|
||||
// Otherwise, this argument is passed on to fmt.Sprintf() and then used to annotate the failure message.
|
||||
//
|
||||
// All methods return a bool that is true if the assertion passed and false if it failed.
|
||||
//
|
||||
|
|
10
vendor/github.com/onsi/gomega/internal/assertion/assertion.go
generated
vendored
10
vendor/github.com/onsi/gomega/internal/assertion/assertion.go
generated
vendored
|
@ -52,16 +52,19 @@ func (assertion *Assertion) buildDescription(optionalDescription ...interface{})
|
|||
switch len(optionalDescription) {
|
||||
case 0:
|
||||
return ""
|
||||
default:
|
||||
return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n"
|
||||
case 1:
|
||||
if describe, ok := optionalDescription[0].(func() string); ok {
|
||||
return describe() + "\n"
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n"
|
||||
}
|
||||
|
||||
func (assertion *Assertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...interface{}) bool {
|
||||
matches, err := matcher.Match(assertion.actualInput)
|
||||
description := assertion.buildDescription(optionalDescription...)
|
||||
assertion.failWrapper.TWithHelper.Helper()
|
||||
if err != nil {
|
||||
description := assertion.buildDescription(optionalDescription...)
|
||||
assertion.failWrapper.Fail(description+err.Error(), 2+assertion.offset)
|
||||
return false
|
||||
}
|
||||
|
@ -72,6 +75,7 @@ func (assertion *Assertion) match(matcher types.GomegaMatcher, desiredMatch bool
|
|||
} else {
|
||||
message = matcher.NegatedFailureMessage(assertion.actualInput)
|
||||
}
|
||||
description := assertion.buildDescription(optionalDescription...)
|
||||
assertion.failWrapper.Fail(description+message, 2+assertion.offset)
|
||||
return false
|
||||
}
|
||||
|
|
10
vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go
generated
vendored
10
vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go
generated
vendored
|
@ -60,9 +60,12 @@ func (assertion *AsyncAssertion) buildDescription(optionalDescription ...interfa
|
|||
switch len(optionalDescription) {
|
||||
case 0:
|
||||
return ""
|
||||
default:
|
||||
return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n"
|
||||
case 1:
|
||||
if describe, ok := optionalDescription[0].(func() string); ok {
|
||||
return describe() + "\n"
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n"
|
||||
}
|
||||
|
||||
func (assertion *AsyncAssertion) actualInputIsAFunction() bool {
|
||||
|
@ -103,8 +106,6 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch
|
|||
timer := time.Now()
|
||||
timeout := time.After(assertion.timeoutInterval)
|
||||
|
||||
description := assertion.buildDescription(optionalDescription...)
|
||||
|
||||
var matches bool
|
||||
var err error
|
||||
mayChange := true
|
||||
|
@ -129,6 +130,7 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch
|
|||
}
|
||||
}
|
||||
assertion.failWrapper.TWithHelper.Helper()
|
||||
description := assertion.buildDescription(optionalDescription...)
|
||||
assertion.failWrapper.Fail(fmt.Sprintf("%s after %.3fs.\n%s%s%s", preamble, time.Since(timer).Seconds(), description, message, errMsg), 3+assertion.offset)
|
||||
}
|
||||
|
||||
|
|
18
vendor/github.com/onsi/gomega/matchers/match_error_matcher.go
generated
vendored
18
vendor/github.com/onsi/gomega/matchers/match_error_matcher.go
generated
vendored
|
@ -5,6 +5,7 @@ import (
|
|||
"reflect"
|
||||
|
||||
"github.com/onsi/gomega/format"
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
type MatchErrorMatcher struct {
|
||||
|
@ -21,25 +22,28 @@ func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err e
|
|||
}
|
||||
|
||||
actualErr := actual.(error)
|
||||
expected := matcher.Expected
|
||||
|
||||
if isError(matcher.Expected) {
|
||||
return reflect.DeepEqual(actualErr, matcher.Expected), nil
|
||||
if isError(expected) {
|
||||
return reflect.DeepEqual(actualErr, expected) || xerrors.Is(actualErr, expected.(error)), nil
|
||||
}
|
||||
|
||||
if isString(matcher.Expected) {
|
||||
return actualErr.Error() == matcher.Expected, nil
|
||||
if isString(expected) {
|
||||
return actualErr.Error() == expected, nil
|
||||
}
|
||||
|
||||
var subMatcher omegaMatcher
|
||||
var hasSubMatcher bool
|
||||
if matcher.Expected != nil {
|
||||
subMatcher, hasSubMatcher = (matcher.Expected).(omegaMatcher)
|
||||
if expected != nil {
|
||||
subMatcher, hasSubMatcher = (expected).(omegaMatcher)
|
||||
if hasSubMatcher {
|
||||
return subMatcher.Match(actualErr.Error())
|
||||
}
|
||||
}
|
||||
|
||||
return false, fmt.Errorf("MatchError must be passed an error, string, or Matcher that can match on strings. Got:\n%s", format.Object(matcher.Expected, 1))
|
||||
return false, fmt.Errorf(
|
||||
"MatchError must be passed an error, a string, or a Matcher that can match on strings. Got:\n%s",
|
||||
format.Object(expected, 1))
|
||||
}
|
||||
|
||||
func (matcher *MatchErrorMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
|
|
15
vendor/golang.org/x/crypto/ssh/terminal/terminal.go
generated
vendored
15
vendor/golang.org/x/crypto/ssh/terminal/terminal.go
generated
vendored
|
@ -7,6 +7,7 @@ package terminal
|
|||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"sync"
|
||||
"unicode/utf8"
|
||||
|
@ -939,6 +940,8 @@ func (s *stRingBuffer) NthPreviousEntry(n int) (value string, ok bool) {
|
|||
// readPasswordLine reads from reader until it finds \n or io.EOF.
|
||||
// The slice returned does not include the \n.
|
||||
// readPasswordLine also ignores any \r it finds.
|
||||
// Windows uses \r as end of line. So, on Windows, readPasswordLine
|
||||
// reads until it finds \r and ignores any \n it finds during processing.
|
||||
func readPasswordLine(reader io.Reader) ([]byte, error) {
|
||||
var buf [1]byte
|
||||
var ret []byte
|
||||
|
@ -947,10 +950,20 @@ func readPasswordLine(reader io.Reader) ([]byte, error) {
|
|||
n, err := reader.Read(buf[:])
|
||||
if n > 0 {
|
||||
switch buf[0] {
|
||||
case '\b':
|
||||
if len(ret) > 0 {
|
||||
ret = ret[:len(ret)-1]
|
||||
}
|
||||
case '\n':
|
||||
if runtime.GOOS != "windows" {
|
||||
return ret, nil
|
||||
}
|
||||
// otherwise ignore \n
|
||||
case '\r':
|
||||
// remove \r from passwords on Windows
|
||||
if runtime.GOOS == "windows" {
|
||||
return ret, nil
|
||||
}
|
||||
// otherwise ignore \r
|
||||
default:
|
||||
ret = append(ret, buf[0])
|
||||
}
|
||||
|
|
4
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go
generated
vendored
4
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go
generated
vendored
|
@ -85,8 +85,8 @@ func ReadPassword(fd int) ([]byte, error) {
|
|||
}
|
||||
old := st
|
||||
|
||||
st &^= (windows.ENABLE_ECHO_INPUT)
|
||||
st |= (windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
|
||||
st &^= (windows.ENABLE_ECHO_INPUT | windows.ENABLE_LINE_INPUT)
|
||||
st |= (windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_PROCESSED_INPUT)
|
||||
if err := windows.SetConsoleMode(windows.Handle(fd), st); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
27
vendor/golang.org/x/xerrors/LICENSE
generated
vendored
Normal file
27
vendor/golang.org/x/xerrors/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2019 The Go Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
22
vendor/golang.org/x/xerrors/PATENTS
generated
vendored
Normal file
22
vendor/golang.org/x/xerrors/PATENTS
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
Additional IP Rights Grant (Patents)
|
||||
|
||||
"This implementation" means the copyrightable works distributed by
|
||||
Google as part of the Go project.
|
||||
|
||||
Google hereby grants to You a perpetual, worldwide, non-exclusive,
|
||||
no-charge, royalty-free, irrevocable (except as stated in this section)
|
||||
patent license to make, have made, use, offer to sell, sell, import,
|
||||
transfer and otherwise run, modify and propagate the contents of this
|
||||
implementation of Go, where such license applies only to those patent
|
||||
claims, both currently owned or controlled by Google and acquired in
|
||||
the future, licensable by Google that are necessarily infringed by this
|
||||
implementation of Go. This grant does not include claims that would be
|
||||
infringed only as a consequence of further modification of this
|
||||
implementation. If you or your agent or exclusive licensee institute or
|
||||
order or agree to the institution of patent litigation against any
|
||||
entity (including a cross-claim or counterclaim in a lawsuit) alleging
|
||||
that this implementation of Go or any code incorporated within this
|
||||
implementation of Go constitutes direct or contributory patent
|
||||
infringement, or inducement of patent infringement, then any patent
|
||||
rights granted to you under this License for this implementation of Go
|
||||
shall terminate as of the date such litigation is filed.
|
2
vendor/golang.org/x/xerrors/README
generated
vendored
Normal file
2
vendor/golang.org/x/xerrors/README
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
This repository holds the transition packages for the new Go 1.13 error values.
|
||||
See golang.org/design/29934-error-values.
|
193
vendor/golang.org/x/xerrors/adaptor.go
generated
vendored
Normal file
193
vendor/golang.org/x/xerrors/adaptor.go
generated
vendored
Normal file
|
@ -0,0 +1,193 @@
|
|||
// Copyright 2018 The Go 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 xerrors
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// FormatError calls the FormatError method of f with an errors.Printer
|
||||
// configured according to s and verb, and writes the result to s.
|
||||
func FormatError(f Formatter, s fmt.State, verb rune) {
|
||||
// Assuming this function is only called from the Format method, and given
|
||||
// that FormatError takes precedence over Format, it cannot be called from
|
||||
// any package that supports errors.Formatter. It is therefore safe to
|
||||
// disregard that State may be a specific printer implementation and use one
|
||||
// of our choice instead.
|
||||
|
||||
// limitations: does not support printing error as Go struct.
|
||||
|
||||
var (
|
||||
sep = " " // separator before next error
|
||||
p = &state{State: s}
|
||||
direct = true
|
||||
)
|
||||
|
||||
var err error = f
|
||||
|
||||
switch verb {
|
||||
// Note that this switch must match the preference order
|
||||
// for ordinary string printing (%#v before %+v, and so on).
|
||||
|
||||
case 'v':
|
||||
if s.Flag('#') {
|
||||
if stringer, ok := err.(fmt.GoStringer); ok {
|
||||
io.WriteString(&p.buf, stringer.GoString())
|
||||
goto exit
|
||||
}
|
||||
// proceed as if it were %v
|
||||
} else if s.Flag('+') {
|
||||
p.printDetail = true
|
||||
sep = "\n - "
|
||||
}
|
||||
case 's':
|
||||
case 'q', 'x', 'X':
|
||||
// Use an intermediate buffer in the rare cases that precision,
|
||||
// truncation, or one of the alternative verbs (q, x, and X) are
|
||||
// specified.
|
||||
direct = false
|
||||
|
||||
default:
|
||||
p.buf.WriteString("%!")
|
||||
p.buf.WriteRune(verb)
|
||||
p.buf.WriteByte('(')
|
||||
switch {
|
||||
case err != nil:
|
||||
p.buf.WriteString(reflect.TypeOf(f).String())
|
||||
default:
|
||||
p.buf.WriteString("<nil>")
|
||||
}
|
||||
p.buf.WriteByte(')')
|
||||
io.Copy(s, &p.buf)
|
||||
return
|
||||
}
|
||||
|
||||
loop:
|
||||
for {
|
||||
switch v := err.(type) {
|
||||
case Formatter:
|
||||
err = v.FormatError((*printer)(p))
|
||||
case fmt.Formatter:
|
||||
v.Format(p, 'v')
|
||||
break loop
|
||||
default:
|
||||
io.WriteString(&p.buf, v.Error())
|
||||
break loop
|
||||
}
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
if p.needColon || !p.printDetail {
|
||||
p.buf.WriteByte(':')
|
||||
p.needColon = false
|
||||
}
|
||||
p.buf.WriteString(sep)
|
||||
p.inDetail = false
|
||||
p.needNewline = false
|
||||
}
|
||||
|
||||
exit:
|
||||
width, okW := s.Width()
|
||||
prec, okP := s.Precision()
|
||||
|
||||
if !direct || (okW && width > 0) || okP {
|
||||
// Construct format string from State s.
|
||||
format := []byte{'%'}
|
||||
if s.Flag('-') {
|
||||
format = append(format, '-')
|
||||
}
|
||||
if s.Flag('+') {
|
||||
format = append(format, '+')
|
||||
}
|
||||
if s.Flag(' ') {
|
||||
format = append(format, ' ')
|
||||
}
|
||||
if okW {
|
||||
format = strconv.AppendInt(format, int64(width), 10)
|
||||
}
|
||||
if okP {
|
||||
format = append(format, '.')
|
||||
format = strconv.AppendInt(format, int64(prec), 10)
|
||||
}
|
||||
format = append(format, string(verb)...)
|
||||
fmt.Fprintf(s, string(format), p.buf.String())
|
||||
} else {
|
||||
io.Copy(s, &p.buf)
|
||||
}
|
||||
}
|
||||
|
||||
var detailSep = []byte("\n ")
|
||||
|
||||
// state tracks error printing state. It implements fmt.State.
|
||||
type state struct {
|
||||
fmt.State
|
||||
buf bytes.Buffer
|
||||
|
||||
printDetail bool
|
||||
inDetail bool
|
||||
needColon bool
|
||||
needNewline bool
|
||||
}
|
||||
|
||||
func (s *state) Write(b []byte) (n int, err error) {
|
||||
if s.printDetail {
|
||||
if len(b) == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
if s.inDetail && s.needColon {
|
||||
s.needNewline = true
|
||||
if b[0] == '\n' {
|
||||
b = b[1:]
|
||||
}
|
||||
}
|
||||
k := 0
|
||||
for i, c := range b {
|
||||
if s.needNewline {
|
||||
if s.inDetail && s.needColon {
|
||||
s.buf.WriteByte(':')
|
||||
s.needColon = false
|
||||
}
|
||||
s.buf.Write(detailSep)
|
||||
s.needNewline = false
|
||||
}
|
||||
if c == '\n' {
|
||||
s.buf.Write(b[k:i])
|
||||
k = i + 1
|
||||
s.needNewline = true
|
||||
}
|
||||
}
|
||||
s.buf.Write(b[k:])
|
||||
if !s.inDetail {
|
||||
s.needColon = true
|
||||
}
|
||||
} else if !s.inDetail {
|
||||
s.buf.Write(b)
|
||||
}
|
||||
return len(b), nil
|
||||
}
|
||||
|
||||
// printer wraps a state to implement an xerrors.Printer.
|
||||
type printer state
|
||||
|
||||
func (s *printer) Print(args ...interface{}) {
|
||||
if !s.inDetail || s.printDetail {
|
||||
fmt.Fprint((*state)(s), args...)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *printer) Printf(format string, args ...interface{}) {
|
||||
if !s.inDetail || s.printDetail {
|
||||
fmt.Fprintf((*state)(s), format, args...)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *printer) Detail() bool {
|
||||
s.inDetail = true
|
||||
return s.printDetail
|
||||
}
|
1
vendor/golang.org/x/xerrors/codereview.cfg
generated
vendored
Normal file
1
vendor/golang.org/x/xerrors/codereview.cfg
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
issuerepo: golang/go
|
22
vendor/golang.org/x/xerrors/doc.go
generated
vendored
Normal file
22
vendor/golang.org/x/xerrors/doc.go
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2019 The Go 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 xerrors implements functions to manipulate errors.
|
||||
//
|
||||
// This package is based on the Go 2 proposal for error values:
|
||||
// https://golang.org/design/29934-error-values
|
||||
//
|
||||
// These functions were incorporated into the standard library's errors package
|
||||
// in Go 1.13:
|
||||
// - Is
|
||||
// - As
|
||||
// - Unwrap
|
||||
//
|
||||
// Also, Errorf's %w verb was incorporated into fmt.Errorf.
|
||||
//
|
||||
// Use this package to get equivalent behavior in all supported Go versions.
|
||||
//
|
||||
// No other features of this package were included in Go 1.13, and at present
|
||||
// there are no plans to include any of them.
|
||||
package xerrors // import "golang.org/x/xerrors"
|
33
vendor/golang.org/x/xerrors/errors.go
generated
vendored
Normal file
33
vendor/golang.org/x/xerrors/errors.go
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2011 The Go 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 xerrors
|
||||
|
||||
import "fmt"
|
||||
|
||||
// errorString is a trivial implementation of error.
|
||||
type errorString struct {
|
||||
s string
|
||||
frame Frame
|
||||
}
|
||||
|
||||
// New returns an error that formats as the given text.
|
||||
//
|
||||
// The returned error contains a Frame set to the caller's location and
|
||||
// implements Formatter to show this information when printed with details.
|
||||
func New(text string) error {
|
||||
return &errorString{text, Caller(1)}
|
||||
}
|
||||
|
||||
func (e *errorString) Error() string {
|
||||
return e.s
|
||||
}
|
||||
|
||||
func (e *errorString) Format(s fmt.State, v rune) { FormatError(e, s, v) }
|
||||
|
||||
func (e *errorString) FormatError(p Printer) (next error) {
|
||||
p.Print(e.s)
|
||||
e.frame.Format(p)
|
||||
return nil
|
||||
}
|
187
vendor/golang.org/x/xerrors/fmt.go
generated
vendored
Normal file
187
vendor/golang.org/x/xerrors/fmt.go
generated
vendored
Normal file
|
@ -0,0 +1,187 @@
|
|||
// Copyright 2018 The Go 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 xerrors
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/xerrors/internal"
|
||||
)
|
||||
|
||||
const percentBangString = "%!"
|
||||
|
||||
// Errorf formats according to a format specifier and returns the string as a
|
||||
// value that satisfies error.
|
||||
//
|
||||
// The returned error includes the file and line number of the caller when
|
||||
// formatted with additional detail enabled. If the last argument is an error
|
||||
// the returned error's Format method will return it if the format string ends
|
||||
// with ": %s", ": %v", or ": %w". If the last argument is an error and the
|
||||
// format string ends with ": %w", the returned error implements an Unwrap
|
||||
// method returning it.
|
||||
//
|
||||
// If the format specifier includes a %w verb with an error operand in a
|
||||
// position other than at the end, the returned error will still implement an
|
||||
// Unwrap method returning the operand, but the error's Format method will not
|
||||
// return the wrapped error.
|
||||
//
|
||||
// It is invalid to include more than one %w verb or to supply it with an
|
||||
// operand that does not implement the error interface. The %w verb is otherwise
|
||||
// a synonym for %v.
|
||||
func Errorf(format string, a ...interface{}) error {
|
||||
format = formatPlusW(format)
|
||||
// Support a ": %[wsv]" suffix, which works well with xerrors.Formatter.
|
||||
wrap := strings.HasSuffix(format, ": %w")
|
||||
idx, format2, ok := parsePercentW(format)
|
||||
percentWElsewhere := !wrap && idx >= 0
|
||||
if !percentWElsewhere && (wrap || strings.HasSuffix(format, ": %s") || strings.HasSuffix(format, ": %v")) {
|
||||
err := errorAt(a, len(a)-1)
|
||||
if err == nil {
|
||||
return &noWrapError{fmt.Sprintf(format, a...), nil, Caller(1)}
|
||||
}
|
||||
// TODO: this is not entirely correct. The error value could be
|
||||
// printed elsewhere in format if it mixes numbered with unnumbered
|
||||
// substitutions. With relatively small changes to doPrintf we can
|
||||
// have it optionally ignore extra arguments and pass the argument
|
||||
// list in its entirety.
|
||||
msg := fmt.Sprintf(format[:len(format)-len(": %s")], a[:len(a)-1]...)
|
||||
frame := Frame{}
|
||||
if internal.EnableTrace {
|
||||
frame = Caller(1)
|
||||
}
|
||||
if wrap {
|
||||
return &wrapError{msg, err, frame}
|
||||
}
|
||||
return &noWrapError{msg, err, frame}
|
||||
}
|
||||
// Support %w anywhere.
|
||||
// TODO: don't repeat the wrapped error's message when %w occurs in the middle.
|
||||
msg := fmt.Sprintf(format2, a...)
|
||||
if idx < 0 {
|
||||
return &noWrapError{msg, nil, Caller(1)}
|
||||
}
|
||||
err := errorAt(a, idx)
|
||||
if !ok || err == nil {
|
||||
// Too many %ws or argument of %w is not an error. Approximate the Go
|
||||
// 1.13 fmt.Errorf message.
|
||||
return &noWrapError{fmt.Sprintf("%sw(%s)", percentBangString, msg), nil, Caller(1)}
|
||||
}
|
||||
frame := Frame{}
|
||||
if internal.EnableTrace {
|
||||
frame = Caller(1)
|
||||
}
|
||||
return &wrapError{msg, err, frame}
|
||||
}
|
||||
|
||||
func errorAt(args []interface{}, i int) error {
|
||||
if i < 0 || i >= len(args) {
|
||||
return nil
|
||||
}
|
||||
err, ok := args[i].(error)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// formatPlusW is used to avoid the vet check that will barf at %w.
|
||||
func formatPlusW(s string) string {
|
||||
return s
|
||||
}
|
||||
|
||||
// Return the index of the only %w in format, or -1 if none.
|
||||
// Also return a rewritten format string with %w replaced by %v, and
|
||||
// false if there is more than one %w.
|
||||
// TODO: handle "%[N]w".
|
||||
func parsePercentW(format string) (idx int, newFormat string, ok bool) {
|
||||
// Loosely copied from golang.org/x/tools/go/analysis/passes/printf/printf.go.
|
||||
idx = -1
|
||||
ok = true
|
||||
n := 0
|
||||
sz := 0
|
||||
var isW bool
|
||||
for i := 0; i < len(format); i += sz {
|
||||
if format[i] != '%' {
|
||||
sz = 1
|
||||
continue
|
||||
}
|
||||
// "%%" is not a format directive.
|
||||
if i+1 < len(format) && format[i+1] == '%' {
|
||||
sz = 2
|
||||
continue
|
||||
}
|
||||
sz, isW = parsePrintfVerb(format[i:])
|
||||
if isW {
|
||||
if idx >= 0 {
|
||||
ok = false
|
||||
} else {
|
||||
idx = n
|
||||
}
|
||||
// "Replace" the last character, the 'w', with a 'v'.
|
||||
p := i + sz - 1
|
||||
format = format[:p] + "v" + format[p+1:]
|
||||
}
|
||||
n++
|
||||
}
|
||||
return idx, format, ok
|
||||
}
|
||||
|
||||
// Parse the printf verb starting with a % at s[0].
|
||||
// Return how many bytes it occupies and whether the verb is 'w'.
|
||||
func parsePrintfVerb(s string) (int, bool) {
|
||||
// Assume only that the directive is a sequence of non-letters followed by a single letter.
|
||||
sz := 0
|
||||
var r rune
|
||||
for i := 1; i < len(s); i += sz {
|
||||
r, sz = utf8.DecodeRuneInString(s[i:])
|
||||
if unicode.IsLetter(r) {
|
||||
return i + sz, r == 'w'
|
||||
}
|
||||
}
|
||||
return len(s), false
|
||||
}
|
||||
|
||||
type noWrapError struct {
|
||||
msg string
|
||||
err error
|
||||
frame Frame
|
||||
}
|
||||
|
||||
func (e *noWrapError) Error() string {
|
||||
return fmt.Sprint(e)
|
||||
}
|
||||
|
||||
func (e *noWrapError) Format(s fmt.State, v rune) { FormatError(e, s, v) }
|
||||
|
||||
func (e *noWrapError) FormatError(p Printer) (next error) {
|
||||
p.Print(e.msg)
|
||||
e.frame.Format(p)
|
||||
return e.err
|
||||
}
|
||||
|
||||
type wrapError struct {
|
||||
msg string
|
||||
err error
|
||||
frame Frame
|
||||
}
|
||||
|
||||
func (e *wrapError) Error() string {
|
||||
return fmt.Sprint(e)
|
||||
}
|
||||
|
||||
func (e *wrapError) Format(s fmt.State, v rune) { FormatError(e, s, v) }
|
||||
|
||||
func (e *wrapError) FormatError(p Printer) (next error) {
|
||||
p.Print(e.msg)
|
||||
e.frame.Format(p)
|
||||
return e.err
|
||||
}
|
||||
|
||||
func (e *wrapError) Unwrap() error {
|
||||
return e.err
|
||||
}
|
34
vendor/golang.org/x/xerrors/format.go
generated
vendored
Normal file
34
vendor/golang.org/x/xerrors/format.go
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright 2018 The Go 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 xerrors
|
||||
|
||||
// A Formatter formats error messages.
|
||||
type Formatter interface {
|
||||
error
|
||||
|
||||
// FormatError prints the receiver's first error and returns the next error in
|
||||
// the error chain, if any.
|
||||
FormatError(p Printer) (next error)
|
||||
}
|
||||
|
||||
// A Printer formats error messages.
|
||||
//
|
||||
// The most common implementation of Printer is the one provided by package fmt
|
||||
// during Printf (as of Go 1.13). Localization packages such as golang.org/x/text/message
|
||||
// typically provide their own implementations.
|
||||
type Printer interface {
|
||||
// Print appends args to the message output.
|
||||
Print(args ...interface{})
|
||||
|
||||
// Printf writes a formatted string.
|
||||
Printf(format string, args ...interface{})
|
||||
|
||||
// Detail reports whether error detail is requested.
|
||||
// After the first call to Detail, all text written to the Printer
|
||||
// is formatted as additional detail, or ignored when
|
||||
// detail has not been requested.
|
||||
// If Detail returns false, the caller can avoid printing the detail at all.
|
||||
Detail() bool
|
||||
}
|
56
vendor/golang.org/x/xerrors/frame.go
generated
vendored
Normal file
56
vendor/golang.org/x/xerrors/frame.go
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
// Copyright 2018 The Go 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 xerrors
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// A Frame contains part of a call stack.
|
||||
type Frame struct {
|
||||
// Make room for three PCs: the one we were asked for, what it called,
|
||||
// and possibly a PC for skipPleaseUseCallersFrames. See:
|
||||
// https://go.googlesource.com/go/+/032678e0fb/src/runtime/extern.go#169
|
||||
frames [3]uintptr
|
||||
}
|
||||
|
||||
// Caller returns a Frame that describes a frame on the caller's stack.
|
||||
// The argument skip is the number of frames to skip over.
|
||||
// Caller(0) returns the frame for the caller of Caller.
|
||||
func Caller(skip int) Frame {
|
||||
var s Frame
|
||||
runtime.Callers(skip+1, s.frames[:])
|
||||
return s
|
||||
}
|
||||
|
||||
// location reports the file, line, and function of a frame.
|
||||
//
|
||||
// The returned function may be "" even if file and line are not.
|
||||
func (f Frame) location() (function, file string, line int) {
|
||||
frames := runtime.CallersFrames(f.frames[:])
|
||||
if _, ok := frames.Next(); !ok {
|
||||
return "", "", 0
|
||||
}
|
||||
fr, ok := frames.Next()
|
||||
if !ok {
|
||||
return "", "", 0
|
||||
}
|
||||
return fr.Function, fr.File, fr.Line
|
||||
}
|
||||
|
||||
// Format prints the stack as error detail.
|
||||
// It should be called from an error's Format implementation
|
||||
// after printing any other error detail.
|
||||
func (f Frame) Format(p Printer) {
|
||||
if p.Detail() {
|
||||
function, file, line := f.location()
|
||||
if function != "" {
|
||||
p.Printf("%s\n ", function)
|
||||
}
|
||||
if file != "" {
|
||||
p.Printf("%s:%d\n", file, line)
|
||||
}
|
||||
}
|
||||
}
|
3
vendor/golang.org/x/xerrors/go.mod
generated
vendored
Normal file
3
vendor/golang.org/x/xerrors/go.mod
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
module golang.org/x/xerrors
|
||||
|
||||
go 1.11
|
8
vendor/golang.org/x/xerrors/internal/internal.go
generated
vendored
Normal file
8
vendor/golang.org/x/xerrors/internal/internal.go
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
// Copyright 2018 The Go 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 internal
|
||||
|
||||
// EnableTrace indicates whether stack information should be recorded in errors.
|
||||
var EnableTrace = true
|
106
vendor/golang.org/x/xerrors/wrap.go
generated
vendored
Normal file
106
vendor/golang.org/x/xerrors/wrap.go
generated
vendored
Normal file
|
@ -0,0 +1,106 @@
|
|||
// Copyright 2018 The Go 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 xerrors
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// A Wrapper provides context around another error.
|
||||
type Wrapper interface {
|
||||
// Unwrap returns the next error in the error chain.
|
||||
// If there is no next error, Unwrap returns nil.
|
||||
Unwrap() error
|
||||
}
|
||||
|
||||
// Opaque returns an error with the same error formatting as err
|
||||
// but that does not match err and cannot be unwrapped.
|
||||
func Opaque(err error) error {
|
||||
return noWrapper{err}
|
||||
}
|
||||
|
||||
type noWrapper struct {
|
||||
error
|
||||
}
|
||||
|
||||
func (e noWrapper) FormatError(p Printer) (next error) {
|
||||
if f, ok := e.error.(Formatter); ok {
|
||||
return f.FormatError(p)
|
||||
}
|
||||
p.Print(e.error)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Unwrap returns the result of calling the Unwrap method on err, if err implements
|
||||
// Unwrap. Otherwise, Unwrap returns nil.
|
||||
func Unwrap(err error) error {
|
||||
u, ok := err.(Wrapper)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return u.Unwrap()
|
||||
}
|
||||
|
||||
// Is reports whether any error in err's chain matches target.
|
||||
//
|
||||
// An error is considered to match a target if it is equal to that target or if
|
||||
// it implements a method Is(error) bool such that Is(target) returns true.
|
||||
func Is(err, target error) bool {
|
||||
if target == nil {
|
||||
return err == target
|
||||
}
|
||||
|
||||
isComparable := reflect.TypeOf(target).Comparable()
|
||||
for {
|
||||
if isComparable && err == target {
|
||||
return true
|
||||
}
|
||||
if x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) {
|
||||
return true
|
||||
}
|
||||
// TODO: consider supporing target.Is(err). This would allow
|
||||
// user-definable predicates, but also may allow for coping with sloppy
|
||||
// APIs, thereby making it easier to get away with them.
|
||||
if err = Unwrap(err); err == nil {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// As finds the first error in err's chain that matches the type to which target
|
||||
// points, and if so, sets the target to its value and returns true. An error
|
||||
// matches a type if it is assignable to the target type, or if it has a method
|
||||
// As(interface{}) bool such that As(target) returns true. As will panic if target
|
||||
// is not a non-nil pointer to a type which implements error or is of interface type.
|
||||
//
|
||||
// The As method should set the target to its value and return true if err
|
||||
// matches the type to which target points.
|
||||
func As(err error, target interface{}) bool {
|
||||
if target == nil {
|
||||
panic("errors: target cannot be nil")
|
||||
}
|
||||
val := reflect.ValueOf(target)
|
||||
typ := val.Type()
|
||||
if typ.Kind() != reflect.Ptr || val.IsNil() {
|
||||
panic("errors: target must be a non-nil pointer")
|
||||
}
|
||||
if e := typ.Elem(); e.Kind() != reflect.Interface && !e.Implements(errorType) {
|
||||
panic("errors: *target must be interface or implement error")
|
||||
}
|
||||
targetType := typ.Elem()
|
||||
for err != nil {
|
||||
if reflect.TypeOf(err).AssignableTo(targetType) {
|
||||
val.Elem().Set(reflect.ValueOf(err))
|
||||
return true
|
||||
}
|
||||
if x, ok := err.(interface{ As(interface{}) bool }); ok && x.As(target) {
|
||||
return true
|
||||
}
|
||||
err = Unwrap(err)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var errorType = reflect.TypeOf((*error)(nil)).Elem()
|
89
vendor/gonum.org/v1/gonum/AUTHORS
generated
vendored
89
vendor/gonum.org/v1/gonum/AUTHORS
generated
vendored
|
@ -1,89 +0,0 @@
|
|||
# This is the official list of gonum authors for copyright purposes.
|
||||
# This file is distinct from the CONTRIBUTORS files.
|
||||
# See the latter for an explanation.
|
||||
|
||||
# Names should be added to this file as
|
||||
# Name or Organization <email address>
|
||||
# The email address is not required for organizations.
|
||||
|
||||
# Please keep the list sorted.
|
||||
|
||||
Alexander Egurnov <alexander.egurnov@gmail.com>
|
||||
Bill Gray <wgray@gogray.com>
|
||||
Bill Noon <noon.bill@gmail.com>
|
||||
Brendan Tracey <tracey.brendan@gmail.com>
|
||||
Brent Pedersen <bpederse@gmail.com>
|
||||
Chad Kunde <kunde21@gmail.com>
|
||||
Chih-Wei Chang <bert.cwchang@gmail.com>
|
||||
Chris Tessum <ctessum@gmail.com>
|
||||
Christophe Meessen <christophe.meessen@gmail.com>
|
||||
Clayton Northey <clayton.northey@gmail.com>
|
||||
Dan Kortschak <dan.kortschak@adelaide.edu.au> <dan@kortschak.io>
|
||||
Daniel Fireman <danielfireman@gmail.com>
|
||||
David Samborski <bloggingarrow@gmail.com>
|
||||
Davor Kapsa <davor.kapsa@gmail.com>
|
||||
DeepMind Technologies
|
||||
Dezmond Goff <goff.dezmond@gmail.com>
|
||||
Egon Elbre <egonelbre@gmail.com>
|
||||
Ekaterina Efimova <katerina.efimova@gmail.com>
|
||||
Ethan Burns <burns.ethan@gmail.com>
|
||||
Evert Lammerts <evert.lammerts@gmail.com>
|
||||
Facundo Gaich <facugaich@gmail.com>
|
||||
Fazlul Shahriar <fshahriar@gmail.com>
|
||||
Francesc Campoy <campoy@golang.org>
|
||||
Google Inc
|
||||
Gustaf Johansson <gustaf@pinon.se>
|
||||
Iakov Davydov <iakov.davydov@unil.ch>
|
||||
Igor Mikushkin <igor.mikushkin@gmail.com>
|
||||
Iskander Sharipov <quasilyte@gmail.com>
|
||||
Jalem Raj Rohit <jrajrohit33@gmail.com>
|
||||
James Bell <james@stellentus.com>
|
||||
James Bowman <james.edward.bowman@gmail.com>
|
||||
James Holmes <32bitkid@gmail.com>
|
||||
Janne Snabb <snabb@epipe.com>
|
||||
Jeff Juozapaitis <jjjuozap@email.arizona.edu>
|
||||
Jeremy Atkinson <jchatkinson@gmail.com>
|
||||
Jonas Kahler <jonas@derkahler.de>
|
||||
Jonas Schulze <jonas.schulze@ovgu.de>
|
||||
Jonathan J Lawlor <jonathan.lawlor@gmail.com>
|
||||
Jonathan Schroeder <jd.schroeder@gmail.com>
|
||||
Joseph Watson <jtwatson@linux-consulting.us>
|
||||
Josh Wilson <josh.craig.wilson@gmail.com>
|
||||
Julien Roland <juroland@gmail.com>
|
||||
Kai Trukenmüller <ktye78@gmail.com>
|
||||
Kent English <kent.english@gmail.com>
|
||||
Kevin C. Zimmerman <kevinczimmerman@gmail.com>
|
||||
Kirill Motkov <motkov.kirill@gmail.com>
|
||||
Konstantin Shaposhnikov <k.shaposhnikov@gmail.com>
|
||||
Leonid Kneller <recondite.matter@gmail.com>
|
||||
Lyron Winderbaum <lyron.winderbaum@student.adelaide.edu.au>
|
||||
Martin Diz <github@martindiz.com.ar>
|
||||
Matthieu Di Mercurio <matthieu.dimercurio@gmail.com>
|
||||
Max Halford <maxhalford25@gmail.com>
|
||||
MinJae Kwon <k239507@gmail.com>
|
||||
Nick Potts <nick@the-potts.com>
|
||||
Olivier Wulveryck <olivier.wulveryck@gmail.com>
|
||||
Or Rikon <rikonor@gmail.com>
|
||||
Pontus Melke <pontusmelke@gmail.com>
|
||||
Renée French
|
||||
Rishi Desai <desai.rishi1@gmail.com>
|
||||
Robin Eklind <r.eklind.87@gmail.com>
|
||||
Sam Zaydel <szaydel@gmail.com>
|
||||
Samuel Kelemen <Samuel@Kelemen.us>
|
||||
Saran Ahluwalia <ahlusar.ahluwalia@gmail.com>
|
||||
Scott Holden <scott@sshconnection.com>
|
||||
Sebastien Binet <seb.binet@gmail.com>
|
||||
Shawn Smith <shawnpsmith@gmail.com>
|
||||
source{d} <hello@sourced.tech>
|
||||
Spencer Lyon <spencerlyon2@gmail.com>
|
||||
Steve McCoy <mccoyst@gmail.com>
|
||||
Taesu Pyo <pyotaesu@gmail.com>
|
||||
Takeshi Yoneda <cz.rk.t0415y.g@gmail.com>
|
||||
The University of Adelaide
|
||||
The University of Minnesota
|
||||
The University of Washington
|
||||
Thomas Berg <tomfuture@gmail.com>
|
||||
Tobin Harding <me@tobin.cc>
|
||||
Vincent Thiery <vjmthiery@gmail.com>
|
||||
Vladimír Chalupecký <vladimir.chalupecky@gmail.com>
|
||||
Yevgeniy Vahlis <evahlis@gmail.com>
|
91
vendor/gonum.org/v1/gonum/CONTRIBUTORS
generated
vendored
91
vendor/gonum.org/v1/gonum/CONTRIBUTORS
generated
vendored
|
@ -1,91 +0,0 @@
|
|||
# This is the official list of people who can contribute
|
||||
# (and typically have contributed) code to the gonum
|
||||
# repository.
|
||||
#
|
||||
# The AUTHORS file lists the copyright holders; this file
|
||||
# lists people. For example, Google employees would be listed here
|
||||
# but not in AUTHORS, because Google would hold the copyright.
|
||||
#
|
||||
# When adding J Random Contributor's name to this file,
|
||||
# either J's name or J's organization's name should be
|
||||
# added to the AUTHORS file.
|
||||
#
|
||||
# Names should be added to this file like so:
|
||||
# Name <email address>
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
Alexander Egurnov <alexander.egurnov@gmail.com>
|
||||
Andrew Brampton <brampton@gmail.com>
|
||||
Bill Gray <wgray@gogray.com>
|
||||
Bill Noon <noon.bill@gmail.com>
|
||||
Brendan Tracey <tracey.brendan@gmail.com>
|
||||
Brent Pedersen <bpederse@gmail.com>
|
||||
Chad Kunde <kunde21@gmail.com>
|
||||
Chih-Wei Chang <bert.cwchang@gmail.com>
|
||||
Chris Tessum <ctessum@gmail.com>
|
||||
Christophe Meessen <christophe.meessen@gmail.com>
|
||||
Clayton Northey <clayton.northey@gmail.com>
|
||||
Dan Kortschak <dan.kortschak@adelaide.edu.au> <dan@kortschak.io>
|
||||
Daniel Fireman <danielfireman@gmail.com>
|
||||
David Samborski <bloggingarrow@gmail.com>
|
||||
Davor Kapsa <davor.kapsa@gmail.com>
|
||||
Dezmond Goff <goff.dezmond@gmail.com>
|
||||
Egon Elbre <egonelbre@gmail.com>
|
||||
Ekaterina Efimova <katerina.efimova@gmail.com>
|
||||
Ethan Burns <burns.ethan@gmail.com>
|
||||
Evert Lammerts <evert.lammerts@gmail.com>
|
||||
Facundo Gaich <facugaich@gmail.com>
|
||||
Fazlul Shahriar <fshahriar@gmail.com>
|
||||
Francesc Campoy <campoy@golang.org>
|
||||
Gustaf Johansson <gustaf@pinon.se>
|
||||
Iakov Davydov <iakov.davydov@unil.ch>
|
||||
Igor Mikushkin <igor.mikushkin@gmail.com>
|
||||
Iskander Sharipov <quasilyte@gmail.com>
|
||||
Jalem Raj Rohit <jrajrohit33@gmail.com>
|
||||
James Bell <james@stellentus.com>
|
||||
James Bowman <james.edward.bowman@gmail.com>
|
||||
James Holmes <32bitkid@gmail.com>
|
||||
Janne Snabb <snabb@epipe.com>
|
||||
Jeff Juozapaitis <jjjuozap@email.arizona.edu>
|
||||
Jeremy Atkinson <jchatkinson@gmail.com>
|
||||
Jonas Kahler <jonas@derkahler.de>
|
||||
Jonas Schulze <jonas.schulze@ovgu.de>
|
||||
Jonathan J Lawlor <jonathan.lawlor@gmail.com>
|
||||
Jonathan Schroeder <jd.schroeder@gmail.com>
|
||||
Joseph Watson <jtwatson@linux-consulting.us>
|
||||
Josh Wilson <josh.craig.wilson@gmail.com>
|
||||
Julien Roland <juroland@gmail.com>
|
||||
Kai Trukenmüller <ktye78@gmail.com>
|
||||
Kent English <kent.english@gmail.com>
|
||||
Kevin C. Zimmerman <kevinczimmerman@gmail.com>
|
||||
Kirill Motkov <motkov.kirill@gmail.com>
|
||||
Konstantin Shaposhnikov <k.shaposhnikov@gmail.com>
|
||||
Leonid Kneller <recondite.matter@gmail.com>
|
||||
Lyron Winderbaum <lyron.winderbaum@student.adelaide.edu.au>
|
||||
Martin Diz <github@martindiz.com.ar>
|
||||
Matthieu Di Mercurio <matthieu.dimercurio@gmail.com>
|
||||
Max Halford <maxhalford25@gmail.com>
|
||||
MinJae Kwon <k239507@gmail.com>
|
||||
Nick Potts <nick@the-potts.com>
|
||||
Olivier Wulveryck <olivier.wulveryck@gmail.com>
|
||||
Or Rikon <rikonor@gmail.com>
|
||||
Pontus Melke <pontusmelke@gmail.com>
|
||||
Renée French
|
||||
Rishi Desai <desai.rishi1@gmail.com>
|
||||
Robin Eklind <r.eklind.87@gmail.com>
|
||||
Sam Zaydel <szaydel@gmail.com>
|
||||
Samuel Kelemen <Samuel@Kelemen.us>
|
||||
Saran Ahluwalia <ahlusar.ahluwalia@gmail.com>
|
||||
Scott Holden <scott@sshconnection.com>
|
||||
Sebastien Binet <seb.binet@gmail.com>
|
||||
Shawn Smith <shawnpsmith@gmail.com>
|
||||
Spencer Lyon <spencerlyon2@gmail.com>
|
||||
Steve McCoy <mccoyst@gmail.com>
|
||||
Taesu Pyo <pyotaesu@gmail.com>
|
||||
Takeshi Yoneda <cz.rk.t0415y.g@gmail.com>
|
||||
Thomas Berg <tomfuture@gmail.com>
|
||||
Tobin Harding <me@tobin.cc>
|
||||
Vincent Thiery <vjmthiery@gmail.com>
|
||||
Vladimír Chalupecký <vladimir.chalupecky@gmail.com>
|
||||
Yevgeniy Vahlis <evahlis@gmail.com>
|
23
vendor/gonum.org/v1/gonum/LICENSE
generated
vendored
23
vendor/gonum.org/v1/gonum/LICENSE
generated
vendored
|
@ -1,23 +0,0 @@
|
|||
Copyright ©2013 The Gonum Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the gonum project nor the names of its authors and
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
47
vendor/gonum.org/v1/gonum/blas/README.md
generated
vendored
47
vendor/gonum.org/v1/gonum/blas/README.md
generated
vendored
|
@ -1,47 +0,0 @@
|
|||
# Gonum BLAS [](https://godoc.org/gonum.org/v1/gonum/blas)
|
||||
|
||||
A collection of packages to provide BLAS functionality for the [Go programming
|
||||
language](http://golang.org)
|
||||
|
||||
## Installation
|
||||
```sh
|
||||
go get gonum.org/v1/gonum/blas/...
|
||||
```
|
||||
|
||||
## Packages
|
||||
|
||||
### blas
|
||||
|
||||
Defines [BLAS API](http://www.netlib.org/blas/blast-forum/cinterface.pdf) split in several
|
||||
interfaces.
|
||||
|
||||
### blas/gonum
|
||||
|
||||
Go implementation of the BLAS API (incomplete, implements the `float32` and `float64` API).
|
||||
|
||||
### blas/blas64 and blas/blas32
|
||||
|
||||
Wrappers for an implementation of the double (i.e., `float64`) and single (`float32`)
|
||||
precision real parts of the BLAS API.
|
||||
|
||||
```Go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"gonum.org/v1/gonum/blas/blas64"
|
||||
)
|
||||
|
||||
func main() {
|
||||
v := blas64.Vector{Inc: 1, Data: []float64{1, 1, 1}}
|
||||
fmt.Println("v has length:", blas64.Nrm2(len(v.Data), v))
|
||||
}
|
||||
```
|
||||
|
||||
### blas/cblas128 and blas/cblas64
|
||||
|
||||
Wrappers for an implementation of the double (i.e., `complex128`) and single (`complex64`)
|
||||
precision complex parts of the blas API.
|
||||
|
||||
Currently blas/cblas64 and blas/cblas128 require gonum.org/v1/netlib/blas.
|
283
vendor/gonum.org/v1/gonum/blas/blas.go
generated
vendored
283
vendor/gonum.org/v1/gonum/blas/blas.go
generated
vendored
|
@ -1,283 +0,0 @@
|
|||
// Copyright ©2013 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.
|
||||
|
||||
//go:generate ./conversions.bash
|
||||
|
||||
package blas
|
||||
|
||||
// Flag constants indicate Givens transformation H matrix state.
|
||||
type Flag int
|
||||
|
||||
const (
|
||||
Identity Flag = -2 // H is the identity matrix; no rotation is needed.
|
||||
Rescaling Flag = -1 // H specifies rescaling.
|
||||
OffDiagonal Flag = 0 // Off-diagonal elements of H are non-unit.
|
||||
Diagonal Flag = 1 // Diagonal elements of H are non-unit.
|
||||
)
|
||||
|
||||
// SrotmParams contains Givens transformation parameters returned
|
||||
// by the Float32 Srotm method.
|
||||
type SrotmParams struct {
|
||||
Flag
|
||||
H [4]float32 // Column-major 2 by 2 matrix.
|
||||
}
|
||||
|
||||
// DrotmParams contains Givens transformation parameters returned
|
||||
// by the Float64 Drotm method.
|
||||
type DrotmParams struct {
|
||||
Flag
|
||||
H [4]float64 // Column-major 2 by 2 matrix.
|
||||
}
|
||||
|
||||
// Transpose specifies the transposition operation of a matrix.
|
||||
type Transpose byte
|
||||
|
||||
const (
|
||||
NoTrans Transpose = 'N'
|
||||
Trans Transpose = 'T'
|
||||
ConjTrans Transpose = 'C'
|
||||
)
|
||||
|
||||
// Uplo specifies whether a matrix is upper or lower triangular.
|
||||
type Uplo byte
|
||||
|
||||
const (
|
||||
Upper Uplo = 'U'
|
||||
Lower Uplo = 'L'
|
||||
All Uplo = 'A'
|
||||
)
|
||||
|
||||
// Diag specifies whether a matrix is unit triangular.
|
||||
type Diag byte
|
||||
|
||||
const (
|
||||
NonUnit Diag = 'N'
|
||||
Unit Diag = 'U'
|
||||
)
|
||||
|
||||
// Side specifies from which side a multiplication operation is performed.
|
||||
type Side byte
|
||||
|
||||
const (
|
||||
Left Side = 'L'
|
||||
Right Side = 'R'
|
||||
)
|
||||
|
||||
// Float32 implements the single precision real BLAS routines.
|
||||
type Float32 interface {
|
||||
Float32Level1
|
||||
Float32Level2
|
||||
Float32Level3
|
||||
}
|
||||
|
||||
// Float32Level1 implements the single precision real BLAS Level 1 routines.
|
||||
type Float32Level1 interface {
|
||||
Sdsdot(n int, alpha float32, x []float32, incX int, y []float32, incY int) float32
|
||||
Dsdot(n int, x []float32, incX int, y []float32, incY int) float64
|
||||
Sdot(n int, x []float32, incX int, y []float32, incY int) float32
|
||||
Snrm2(n int, x []float32, incX int) float32
|
||||
Sasum(n int, x []float32, incX int) float32
|
||||
Isamax(n int, x []float32, incX int) int
|
||||
Sswap(n int, x []float32, incX int, y []float32, incY int)
|
||||
Scopy(n int, x []float32, incX int, y []float32, incY int)
|
||||
Saxpy(n int, alpha float32, x []float32, incX int, y []float32, incY int)
|
||||
Srotg(a, b float32) (c, s, r, z float32)
|
||||
Srotmg(d1, d2, b1, b2 float32) (p SrotmParams, rd1, rd2, rb1 float32)
|
||||
Srot(n int, x []float32, incX int, y []float32, incY int, c, s float32)
|
||||
Srotm(n int, x []float32, incX int, y []float32, incY int, p SrotmParams)
|
||||
Sscal(n int, alpha float32, x []float32, incX int)
|
||||
}
|
||||
|
||||
// Float32Level2 implements the single precision real BLAS Level 2 routines.
|
||||
type Float32Level2 interface {
|
||||
Sgemv(tA Transpose, m, n int, alpha float32, a []float32, lda int, x []float32, incX int, beta float32, y []float32, incY int)
|
||||
Sgbmv(tA Transpose, m, n, kL, kU int, alpha float32, a []float32, lda int, x []float32, incX int, beta float32, y []float32, incY int)
|
||||
Strmv(ul Uplo, tA Transpose, d Diag, n int, a []float32, lda int, x []float32, incX int)
|
||||
Stbmv(ul Uplo, tA Transpose, d Diag, n, k int, a []float32, lda int, x []float32, incX int)
|
||||
Stpmv(ul Uplo, tA Transpose, d Diag, n int, ap []float32, x []float32, incX int)
|
||||
Strsv(ul Uplo, tA Transpose, d Diag, n int, a []float32, lda int, x []float32, incX int)
|
||||
Stbsv(ul Uplo, tA Transpose, d Diag, n, k int, a []float32, lda int, x []float32, incX int)
|
||||
Stpsv(ul Uplo, tA Transpose, d Diag, n int, ap []float32, x []float32, incX int)
|
||||
Ssymv(ul Uplo, n int, alpha float32, a []float32, lda int, x []float32, incX int, beta float32, y []float32, incY int)
|
||||
Ssbmv(ul Uplo, n, k int, alpha float32, a []float32, lda int, x []float32, incX int, beta float32, y []float32, incY int)
|
||||
Sspmv(ul Uplo, n int, alpha float32, ap []float32, x []float32, incX int, beta float32, y []float32, incY int)
|
||||
Sger(m, n int, alpha float32, x []float32, incX int, y []float32, incY int, a []float32, lda int)
|
||||
Ssyr(ul Uplo, n int, alpha float32, x []float32, incX int, a []float32, lda int)
|
||||
Sspr(ul Uplo, n int, alpha float32, x []float32, incX int, ap []float32)
|
||||
Ssyr2(ul Uplo, n int, alpha float32, x []float32, incX int, y []float32, incY int, a []float32, lda int)
|
||||
Sspr2(ul Uplo, n int, alpha float32, x []float32, incX int, y []float32, incY int, a []float32)
|
||||
}
|
||||
|
||||
// Float32Level3 implements the single precision real BLAS Level 3 routines.
|
||||
type Float32Level3 interface {
|
||||
Sgemm(tA, tB Transpose, m, n, k int, alpha float32, a []float32, lda int, b []float32, ldb int, beta float32, c []float32, ldc int)
|
||||
Ssymm(s Side, ul Uplo, m, n int, alpha float32, a []float32, lda int, b []float32, ldb int, beta float32, c []float32, ldc int)
|
||||
Ssyrk(ul Uplo, t Transpose, n, k int, alpha float32, a []float32, lda int, beta float32, c []float32, ldc int)
|
||||
Ssyr2k(ul Uplo, t Transpose, n, k int, alpha float32, a []float32, lda int, b []float32, ldb int, beta float32, c []float32, ldc int)
|
||||
Strmm(s Side, ul Uplo, tA Transpose, d Diag, m, n int, alpha float32, a []float32, lda int, b []float32, ldb int)
|
||||
Strsm(s Side, ul Uplo, tA Transpose, d Diag, m, n int, alpha float32, a []float32, lda int, b []float32, ldb int)
|
||||
}
|
||||
|
||||
// Float64 implements the single precision real BLAS routines.
|
||||
type Float64 interface {
|
||||
Float64Level1
|
||||
Float64Level2
|
||||
Float64Level3
|
||||
}
|
||||
|
||||
// Float64Level1 implements the double precision real BLAS Level 1 routines.
|
||||
type Float64Level1 interface {
|
||||
Ddot(n int, x []float64, incX int, y []float64, incY int) float64
|
||||
Dnrm2(n int, x []float64, incX int) float64
|
||||
Dasum(n int, x []float64, incX int) float64
|
||||
Idamax(n int, x []float64, incX int) int
|
||||
Dswap(n int, x []float64, incX int, y []float64, incY int)
|
||||
Dcopy(n int, x []float64, incX int, y []float64, incY int)
|
||||
Daxpy(n int, alpha float64, x []float64, incX int, y []float64, incY int)
|
||||
Drotg(a, b float64) (c, s, r, z float64)
|
||||
Drotmg(d1, d2, b1, b2 float64) (p DrotmParams, rd1, rd2, rb1 float64)
|
||||
Drot(n int, x []float64, incX int, y []float64, incY int, c float64, s float64)
|
||||
Drotm(n int, x []float64, incX int, y []float64, incY int, p DrotmParams)
|
||||
Dscal(n int, alpha float64, x []float64, incX int)
|
||||
}
|
||||
|
||||
// Float64Level2 implements the double precision real BLAS Level 2 routines.
|
||||
type Float64Level2 interface {
|
||||
Dgemv(tA Transpose, m, n int, alpha float64, a []float64, lda int, x []float64, incX int, beta float64, y []float64, incY int)
|
||||
Dgbmv(tA Transpose, m, n, kL, kU int, alpha float64, a []float64, lda int, x []float64, incX int, beta float64, y []float64, incY int)
|
||||
Dtrmv(ul Uplo, tA Transpose, d Diag, n int, a []float64, lda int, x []float64, incX int)
|
||||
Dtbmv(ul Uplo, tA Transpose, d Diag, n, k int, a []float64, lda int, x []float64, incX int)
|
||||
Dtpmv(ul Uplo, tA Transpose, d Diag, n int, ap []float64, x []float64, incX int)
|
||||
Dtrsv(ul Uplo, tA Transpose, d Diag, n int, a []float64, lda int, x []float64, incX int)
|
||||
Dtbsv(ul Uplo, tA Transpose, d Diag, n, k int, a []float64, lda int, x []float64, incX int)
|
||||
Dtpsv(ul Uplo, tA Transpose, d Diag, n int, ap []float64, x []float64, incX int)
|
||||
Dsymv(ul Uplo, n int, alpha float64, a []float64, lda int, x []float64, incX int, beta float64, y []float64, incY int)
|
||||
Dsbmv(ul Uplo, n, k int, alpha float64, a []float64, lda int, x []float64, incX int, beta float64, y []float64, incY int)
|
||||
Dspmv(ul Uplo, n int, alpha float64, ap []float64, x []float64, incX int, beta float64, y []float64, incY int)
|
||||
Dger(m, n int, alpha float64, x []float64, incX int, y []float64, incY int, a []float64, lda int)
|
||||
Dsyr(ul Uplo, n int, alpha float64, x []float64, incX int, a []float64, lda int)
|
||||
Dspr(ul Uplo, n int, alpha float64, x []float64, incX int, ap []float64)
|
||||
Dsyr2(ul Uplo, n int, alpha float64, x []float64, incX int, y []float64, incY int, a []float64, lda int)
|
||||
Dspr2(ul Uplo, n int, alpha float64, x []float64, incX int, y []float64, incY int, a []float64)
|
||||
}
|
||||
|
||||
// Float64Level3 implements the double precision real BLAS Level 3 routines.
|
||||
type Float64Level3 interface {
|
||||
Dgemm(tA, tB Transpose, m, n, k int, alpha float64, a []float64, lda int, b []float64, ldb int, beta float64, c []float64, ldc int)
|
||||
Dsymm(s Side, ul Uplo, m, n int, alpha float64, a []float64, lda int, b []float64, ldb int, beta float64, c []float64, ldc int)
|
||||
Dsyrk(ul Uplo, t Transpose, n, k int, alpha float64, a []float64, lda int, beta float64, c []float64, ldc int)
|
||||
Dsyr2k(ul Uplo, t Transpose, n, k int, alpha float64, a []float64, lda int, b []float64, ldb int, beta float64, c []float64, ldc int)
|
||||
Dtrmm(s Side, ul Uplo, tA Transpose, d Diag, m, n int, alpha float64, a []float64, lda int, b []float64, ldb int)
|
||||
Dtrsm(s Side, ul Uplo, tA Transpose, d Diag, m, n int, alpha float64, a []float64, lda int, b []float64, ldb int)
|
||||
}
|
||||
|
||||
// Complex64 implements the single precision complex BLAS routines.
|
||||
type Complex64 interface {
|
||||
Complex64Level1
|
||||
Complex64Level2
|
||||
Complex64Level3
|
||||
}
|
||||
|
||||
// Complex64Level1 implements the single precision complex BLAS Level 1 routines.
|
||||
type Complex64Level1 interface {
|
||||
Cdotu(n int, x []complex64, incX int, y []complex64, incY int) (dotu complex64)
|
||||
Cdotc(n int, x []complex64, incX int, y []complex64, incY int) (dotc complex64)
|
||||
Scnrm2(n int, x []complex64, incX int) float32
|
||||
Scasum(n int, x []complex64, incX int) float32
|
||||
Icamax(n int, x []complex64, incX int) int
|
||||
Cswap(n int, x []complex64, incX int, y []complex64, incY int)
|
||||
Ccopy(n int, x []complex64, incX int, y []complex64, incY int)
|
||||
Caxpy(n int, alpha complex64, x []complex64, incX int, y []complex64, incY int)
|
||||
Cscal(n int, alpha complex64, x []complex64, incX int)
|
||||
Csscal(n int, alpha float32, x []complex64, incX int)
|
||||
}
|
||||
|
||||
// Complex64Level2 implements the single precision complex BLAS routines Level 2 routines.
|
||||
type Complex64Level2 interface {
|
||||
Cgemv(tA Transpose, m, n int, alpha complex64, a []complex64, lda int, x []complex64, incX int, beta complex64, y []complex64, incY int)
|
||||
Cgbmv(tA Transpose, m, n, kL, kU int, alpha complex64, a []complex64, lda int, x []complex64, incX int, beta complex64, y []complex64, incY int)
|
||||
Ctrmv(ul Uplo, tA Transpose, d Diag, n int, a []complex64, lda int, x []complex64, incX int)
|
||||
Ctbmv(ul Uplo, tA Transpose, d Diag, n, k int, a []complex64, lda int, x []complex64, incX int)
|
||||
Ctpmv(ul Uplo, tA Transpose, d Diag, n int, ap []complex64, x []complex64, incX int)
|
||||
Ctrsv(ul Uplo, tA Transpose, d Diag, n int, a []complex64, lda int, x []complex64, incX int)
|
||||
Ctbsv(ul Uplo, tA Transpose, d Diag, n, k int, a []complex64, lda int, x []complex64, incX int)
|
||||
Ctpsv(ul Uplo, tA Transpose, d Diag, n int, ap []complex64, x []complex64, incX int)
|
||||
Chemv(ul Uplo, n int, alpha complex64, a []complex64, lda int, x []complex64, incX int, beta complex64, y []complex64, incY int)
|
||||
Chbmv(ul Uplo, n, k int, alpha complex64, a []complex64, lda int, x []complex64, incX int, beta complex64, y []complex64, incY int)
|
||||
Chpmv(ul Uplo, n int, alpha complex64, ap []complex64, x []complex64, incX int, beta complex64, y []complex64, incY int)
|
||||
Cgeru(m, n int, alpha complex64, x []complex64, incX int, y []complex64, incY int, a []complex64, lda int)
|
||||
Cgerc(m, n int, alpha complex64, x []complex64, incX int, y []complex64, incY int, a []complex64, lda int)
|
||||
Cher(ul Uplo, n int, alpha float32, x []complex64, incX int, a []complex64, lda int)
|
||||
Chpr(ul Uplo, n int, alpha float32, x []complex64, incX int, a []complex64)
|
||||
Cher2(ul Uplo, n int, alpha complex64, x []complex64, incX int, y []complex64, incY int, a []complex64, lda int)
|
||||
Chpr2(ul Uplo, n int, alpha complex64, x []complex64, incX int, y []complex64, incY int, ap []complex64)
|
||||
}
|
||||
|
||||
// Complex64Level3 implements the single precision complex BLAS Level 3 routines.
|
||||
type Complex64Level3 interface {
|
||||
Cgemm(tA, tB Transpose, m, n, k int, alpha complex64, a []complex64, lda int, b []complex64, ldb int, beta complex64, c []complex64, ldc int)
|
||||
Csymm(s Side, ul Uplo, m, n int, alpha complex64, a []complex64, lda int, b []complex64, ldb int, beta complex64, c []complex64, ldc int)
|
||||
Csyrk(ul Uplo, t Transpose, n, k int, alpha complex64, a []complex64, lda int, beta complex64, c []complex64, ldc int)
|
||||
Csyr2k(ul Uplo, t Transpose, n, k int, alpha complex64, a []complex64, lda int, b []complex64, ldb int, beta complex64, c []complex64, ldc int)
|
||||
Ctrmm(s Side, ul Uplo, tA Transpose, d Diag, m, n int, alpha complex64, a []complex64, lda int, b []complex64, ldb int)
|
||||
Ctrsm(s Side, ul Uplo, tA Transpose, d Diag, m, n int, alpha complex64, a []complex64, lda int, b []complex64, ldb int)
|
||||
Chemm(s Side, ul Uplo, m, n int, alpha complex64, a []complex64, lda int, b []complex64, ldb int, beta complex64, c []complex64, ldc int)
|
||||
Cherk(ul Uplo, t Transpose, n, k int, alpha float32, a []complex64, lda int, beta float32, c []complex64, ldc int)
|
||||
Cher2k(ul Uplo, t Transpose, n, k int, alpha complex64, a []complex64, lda int, b []complex64, ldb int, beta float32, c []complex64, ldc int)
|
||||
}
|
||||
|
||||
// Complex128 implements the double precision complex BLAS routines.
|
||||
type Complex128 interface {
|
||||
Complex128Level1
|
||||
Complex128Level2
|
||||
Complex128Level3
|
||||
}
|
||||
|
||||
// Complex128Level1 implements the double precision complex BLAS Level 1 routines.
|
||||
type Complex128Level1 interface {
|
||||
Zdotu(n int, x []complex128, incX int, y []complex128, incY int) (dotu complex128)
|
||||
Zdotc(n int, x []complex128, incX int, y []complex128, incY int) (dotc complex128)
|
||||
Dznrm2(n int, x []complex128, incX int) float64
|
||||
Dzasum(n int, x []complex128, incX int) float64
|
||||
Izamax(n int, x []complex128, incX int) int
|
||||
Zswap(n int, x []complex128, incX int, y []complex128, incY int)
|
||||
Zcopy(n int, x []complex128, incX int, y []complex128, incY int)
|
||||
Zaxpy(n int, alpha complex128, x []complex128, incX int, y []complex128, incY int)
|
||||
Zscal(n int, alpha complex128, x []complex128, incX int)
|
||||
Zdscal(n int, alpha float64, x []complex128, incX int)
|
||||
}
|
||||
|
||||
// Complex128Level2 implements the double precision complex BLAS Level 2 routines.
|
||||
type Complex128Level2 interface {
|
||||
Zgemv(tA Transpose, m, n int, alpha complex128, a []complex128, lda int, x []complex128, incX int, beta complex128, y []complex128, incY int)
|
||||
Zgbmv(tA Transpose, m, n int, kL int, kU int, alpha complex128, a []complex128, lda int, x []complex128, incX int, beta complex128, y []complex128, incY int)
|
||||
Ztrmv(ul Uplo, tA Transpose, d Diag, n int, a []complex128, lda int, x []complex128, incX int)
|
||||
Ztbmv(ul Uplo, tA Transpose, d Diag, n, k int, a []complex128, lda int, x []complex128, incX int)
|
||||
Ztpmv(ul Uplo, tA Transpose, d Diag, n int, ap []complex128, x []complex128, incX int)
|
||||
Ztrsv(ul Uplo, tA Transpose, d Diag, n int, a []complex128, lda int, x []complex128, incX int)
|
||||
Ztbsv(ul Uplo, tA Transpose, d Diag, n, k int, a []complex128, lda int, x []complex128, incX int)
|
||||
Ztpsv(ul Uplo, tA Transpose, d Diag, n int, ap []complex128, x []complex128, incX int)
|
||||
Zhemv(ul Uplo, n int, alpha complex128, a []complex128, lda int, x []complex128, incX int, beta complex128, y []complex128, incY int)
|
||||
Zhbmv(ul Uplo, n, k int, alpha complex128, a []complex128, lda int, x []complex128, incX int, beta complex128, y []complex128, incY int)
|
||||
Zhpmv(ul Uplo, n int, alpha complex128, ap []complex128, x []complex128, incX int, beta complex128, y []complex128, incY int)
|
||||
Zgeru(m, n int, alpha complex128, x []complex128, incX int, y []complex128, incY int, a []complex128, lda int)
|
||||
Zgerc(m, n int, alpha complex128, x []complex128, incX int, y []complex128, incY int, a []complex128, lda int)
|
||||
Zher(ul Uplo, n int, alpha float64, x []complex128, incX int, a []complex128, lda int)
|
||||
Zhpr(ul Uplo, n int, alpha float64, x []complex128, incX int, a []complex128)
|
||||
Zher2(ul Uplo, n int, alpha complex128, x []complex128, incX int, y []complex128, incY int, a []complex128, lda int)
|
||||
Zhpr2(ul Uplo, n int, alpha complex128, x []complex128, incX int, y []complex128, incY int, ap []complex128)
|
||||
}
|
||||
|
||||
// Complex128Level3 implements the double precision complex BLAS Level 3 routines.
|
||||
type Complex128Level3 interface {
|
||||
Zgemm(tA, tB Transpose, m, n, k int, alpha complex128, a []complex128, lda int, b []complex128, ldb int, beta complex128, c []complex128, ldc int)
|
||||
Zsymm(s Side, ul Uplo, m, n int, alpha complex128, a []complex128, lda int, b []complex128, ldb int, beta complex128, c []complex128, ldc int)
|
||||
Zsyrk(ul Uplo, t Transpose, n, k int, alpha complex128, a []complex128, lda int, beta complex128, c []complex128, ldc int)
|
||||
Zsyr2k(ul Uplo, t Transpose, n, k int, alpha complex128, a []complex128, lda int, b []complex128, ldb int, beta complex128, c []complex128, ldc int)
|
||||
Ztrmm(s Side, ul Uplo, tA Transpose, d Diag, m, n int, alpha complex128, a []complex128, lda int, b []complex128, ldb int)
|
||||
Ztrsm(s Side, ul Uplo, tA Transpose, d Diag, m, n int, alpha complex128, a []complex128, lda int, b []complex128, ldb int)
|
||||
Zhemm(s Side, ul Uplo, m, n int, alpha complex128, a []complex128, lda int, b []complex128, ldb int, beta complex128, c []complex128, ldc int)
|
||||
Zherk(ul Uplo, t Transpose, n, k int, alpha float64, a []complex128, lda int, beta float64, c []complex128, ldc int)
|
||||
Zher2k(ul Uplo, t Transpose, n, k int, alpha complex128, a []complex128, lda int, b []complex128, ldb int, beta float64, c []complex128, ldc int)
|
||||
}
|
469
vendor/gonum.org/v1/gonum/blas/blas64/blas64.go
generated
vendored
469
vendor/gonum.org/v1/gonum/blas/blas64/blas64.go
generated
vendored
|
@ -1,469 +0,0 @@
|
|||
// 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 blas64
|
||||
|
||||
import (
|
||||
"gonum.org/v1/gonum/blas"
|
||||
"gonum.org/v1/gonum/blas/gonum"
|
||||
)
|
||||
|
||||
var blas64 blas.Float64 = gonum.Implementation{}
|
||||
|
||||
// Use sets the BLAS float64 implementation to be used by subsequent BLAS calls.
|
||||
// The default implementation is
|
||||
// gonum.org/v1/gonum/blas/gonum.Implementation.
|
||||
func Use(b blas.Float64) {
|
||||
blas64 = b
|
||||
}
|
||||
|
||||
// Implementation returns the current BLAS float64 implementation.
|
||||
//
|
||||
// Implementation allows direct calls to the current the BLAS float64 implementation
|
||||
// giving finer control of parameters.
|
||||
func Implementation() blas.Float64 {
|
||||
return blas64
|
||||
}
|
||||
|
||||
// Vector represents a vector with an associated element increment.
|
||||
type Vector struct {
|
||||
N int
|
||||
Data []float64
|
||||
Inc int
|
||||
}
|
||||
|
||||
// General represents a matrix using the conventional storage scheme.
|
||||
type General struct {
|
||||
Rows, Cols int
|
||||
Data []float64
|
||||
Stride int
|
||||
}
|
||||
|
||||
// Band represents a band matrix using the band storage scheme.
|
||||
type Band struct {
|
||||
Rows, Cols int
|
||||
KL, KU int
|
||||
Data []float64
|
||||
Stride int
|
||||
}
|
||||
|
||||
// Triangular represents a triangular matrix using the conventional storage scheme.
|
||||
type Triangular struct {
|
||||
Uplo blas.Uplo
|
||||
Diag blas.Diag
|
||||
N int
|
||||
Data []float64
|
||||
Stride int
|
||||
}
|
||||
|
||||
// TriangularBand represents a triangular matrix using the band storage scheme.
|
||||
type TriangularBand struct {
|
||||
Uplo blas.Uplo
|
||||
Diag blas.Diag
|
||||
N, K int
|
||||
Data []float64
|
||||
Stride int
|
||||
}
|
||||
|
||||
// TriangularPacked represents a triangular matrix using the packed storage scheme.
|
||||
type TriangularPacked struct {
|
||||
Uplo blas.Uplo
|
||||
Diag blas.Diag
|
||||
N int
|
||||
Data []float64
|
||||
}
|
||||
|
||||
// Symmetric represents a symmetric matrix using the conventional storage scheme.
|
||||
type Symmetric struct {
|
||||
Uplo blas.Uplo
|
||||
N int
|
||||
Data []float64
|
||||
Stride int
|
||||
}
|
||||
|
||||
// SymmetricBand represents a symmetric matrix using the band storage scheme.
|
||||
type SymmetricBand struct {
|
||||
Uplo blas.Uplo
|
||||
N, K int
|
||||
Data []float64
|
||||
Stride int
|
||||
}
|
||||
|
||||
// SymmetricPacked represents a symmetric matrix using the packed storage scheme.
|
||||
type SymmetricPacked struct {
|
||||
Uplo blas.Uplo
|
||||
N int
|
||||
Data []float64
|
||||
}
|
||||
|
||||
// Level 1
|
||||
|
||||
const (
|
||||
negInc = "blas64: negative vector increment"
|
||||
badLength = "blas64: vector length mismatch"
|
||||
)
|
||||
|
||||
// Dot computes the dot product of the two vectors:
|
||||
// \sum_i x[i]*y[i].
|
||||
func Dot(x, y Vector) float64 {
|
||||
if x.N != y.N {
|
||||
panic(badLength)
|
||||
}
|
||||
return blas64.Ddot(x.N, x.Data, x.Inc, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Nrm2 computes the Euclidean norm of the vector x:
|
||||
// sqrt(\sum_i x[i]*x[i]).
|
||||
//
|
||||
// Nrm2 will panic if the vector increment is negative.
|
||||
func Nrm2(x Vector) float64 {
|
||||
if x.Inc < 0 {
|
||||
panic(negInc)
|
||||
}
|
||||
return blas64.Dnrm2(x.N, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Asum computes the sum of the absolute values of the elements of x:
|
||||
// \sum_i |x[i]|.
|
||||
//
|
||||
// Asum will panic if the vector increment is negative.
|
||||
func Asum(x Vector) float64 {
|
||||
if x.Inc < 0 {
|
||||
panic(negInc)
|
||||
}
|
||||
return blas64.Dasum(x.N, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Iamax returns the index of an element of x with the largest absolute value.
|
||||
// If there are multiple such indices the earliest is returned.
|
||||
// Iamax returns -1 if n == 0.
|
||||
//
|
||||
// Iamax will panic if the vector increment is negative.
|
||||
func Iamax(x Vector) int {
|
||||
if x.Inc < 0 {
|
||||
panic(negInc)
|
||||
}
|
||||
return blas64.Idamax(x.N, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Swap exchanges the elements of the two vectors:
|
||||
// x[i], y[i] = y[i], x[i] for all i.
|
||||
func Swap(x, y Vector) {
|
||||
if x.N != y.N {
|
||||
panic(badLength)
|
||||
}
|
||||
blas64.Dswap(x.N, x.Data, x.Inc, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Copy copies the elements of x into the elements of y:
|
||||
// y[i] = x[i] for all i.
|
||||
// Copy requires that the lengths of x and y match and will panic otherwise.
|
||||
func Copy(x, y Vector) {
|
||||
if x.N != y.N {
|
||||
panic(badLength)
|
||||
}
|
||||
blas64.Dcopy(x.N, x.Data, x.Inc, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Axpy adds x scaled by alpha to y:
|
||||
// y[i] += alpha*x[i] for all i.
|
||||
func Axpy(alpha float64, x, y Vector) {
|
||||
if x.N != y.N {
|
||||
panic(badLength)
|
||||
}
|
||||
blas64.Daxpy(x.N, alpha, x.Data, x.Inc, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Rotg computes the parameters of a Givens plane rotation so that
|
||||
// ⎡ c s⎤ ⎡a⎤ ⎡r⎤
|
||||
// ⎣-s c⎦ * ⎣b⎦ = ⎣0⎦
|
||||
// where a and b are the Cartesian coordinates of a given point.
|
||||
// c, s, and r are defined as
|
||||
// r = ±Sqrt(a^2 + b^2),
|
||||
// c = a/r, the cosine of the rotation angle,
|
||||
// s = a/r, the sine of the rotation angle,
|
||||
// and z is defined such that
|
||||
// if |a| > |b|, z = s,
|
||||
// otherwise if c != 0, z = 1/c,
|
||||
// otherwise z = 1.
|
||||
func Rotg(a, b float64) (c, s, r, z float64) {
|
||||
return blas64.Drotg(a, b)
|
||||
}
|
||||
|
||||
// Rotmg computes the modified Givens rotation. See
|
||||
// http://www.netlib.org/lapack/explore-html/df/deb/drotmg_8f.html
|
||||
// for more details.
|
||||
func Rotmg(d1, d2, b1, b2 float64) (p blas.DrotmParams, rd1, rd2, rb1 float64) {
|
||||
return blas64.Drotmg(d1, d2, b1, b2)
|
||||
}
|
||||
|
||||
// Rot applies a plane transformation to n points represented by the vectors x
|
||||
// and y:
|
||||
// x[i] = c*x[i] + s*y[i],
|
||||
// y[i] = -s*x[i] + c*y[i], for all i.
|
||||
func Rot(x, y Vector, c, s float64) {
|
||||
if x.N != y.N {
|
||||
panic(badLength)
|
||||
}
|
||||
blas64.Drot(x.N, x.Data, x.Inc, y.Data, y.Inc, c, s)
|
||||
}
|
||||
|
||||
// Rotm applies the modified Givens rotation to n points represented by the
|
||||
// vectors x and y.
|
||||
func Rotm(x, y Vector, p blas.DrotmParams) {
|
||||
if x.N != y.N {
|
||||
panic(badLength)
|
||||
}
|
||||
blas64.Drotm(x.N, x.Data, x.Inc, y.Data, y.Inc, p)
|
||||
}
|
||||
|
||||
// Scal scales the vector x by alpha:
|
||||
// x[i] *= alpha for all i.
|
||||
//
|
||||
// Scal will panic if the vector increment is negative.
|
||||
func Scal(alpha float64, x Vector) {
|
||||
if x.Inc < 0 {
|
||||
panic(negInc)
|
||||
}
|
||||
blas64.Dscal(x.N, alpha, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Level 2
|
||||
|
||||
// Gemv computes
|
||||
// y = alpha * A * x + beta * y, if t == blas.NoTrans,
|
||||
// y = alpha * A^T * x + beta * y, if t == blas.Trans or blas.ConjTrans,
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha and beta are scalars.
|
||||
func Gemv(t blas.Transpose, alpha float64, a General, x Vector, beta float64, y Vector) {
|
||||
blas64.Dgemv(t, a.Rows, a.Cols, alpha, a.Data, a.Stride, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Gbmv computes
|
||||
// y = alpha * A * x + beta * y, if t == blas.NoTrans,
|
||||
// y = alpha * A^T * x + beta * y, if t == blas.Trans or blas.ConjTrans,
|
||||
// where A is an m×n band matrix, x and y are vectors, and alpha and beta are scalars.
|
||||
func Gbmv(t blas.Transpose, alpha float64, a Band, x Vector, beta float64, y Vector) {
|
||||
blas64.Dgbmv(t, a.Rows, a.Cols, a.KL, a.KU, alpha, a.Data, a.Stride, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Trmv computes
|
||||
// x = A * x, if t == blas.NoTrans,
|
||||
// x = A^T * x, if t == blas.Trans or blas.ConjTrans,
|
||||
// where A is an n×n triangular matrix, and x is a vector.
|
||||
func Trmv(t blas.Transpose, a Triangular, x Vector) {
|
||||
blas64.Dtrmv(a.Uplo, t, a.Diag, a.N, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tbmv computes
|
||||
// x = A * x, if t == blas.NoTrans,
|
||||
// x = A^T * x, if t == blas.Trans or blas.ConjTrans,
|
||||
// where A is an n×n triangular band matrix, and x is a vector.
|
||||
func Tbmv(t blas.Transpose, a TriangularBand, x Vector) {
|
||||
blas64.Dtbmv(a.Uplo, t, a.Diag, a.N, a.K, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tpmv computes
|
||||
// x = A * x, if t == blas.NoTrans,
|
||||
// x = A^T * x, if t == blas.Trans or blas.ConjTrans,
|
||||
// where A is an n×n triangular matrix in packed format, and x is a vector.
|
||||
func Tpmv(t blas.Transpose, a TriangularPacked, x Vector) {
|
||||
blas64.Dtpmv(a.Uplo, t, a.Diag, a.N, a.Data, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Trsv solves
|
||||
// A * x = b, if t == blas.NoTrans,
|
||||
// A^T * x = b, if t == blas.Trans or blas.ConjTrans,
|
||||
// where A is an n×n triangular matrix, and x and b are vectors.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
// stored in-place into x.
|
||||
//
|
||||
// No test for singularity or near-singularity is included in this
|
||||
// routine. Such tests must be performed before calling this routine.
|
||||
func Trsv(t blas.Transpose, a Triangular, x Vector) {
|
||||
blas64.Dtrsv(a.Uplo, t, a.Diag, a.N, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tbsv solves
|
||||
// A * x = b, if t == blas.NoTrans,
|
||||
// A^T * x = b, if t == blas.Trans or blas.ConjTrans,
|
||||
// where A is an n×n triangular band matrix, and x and b are vectors.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
// stored in place into x.
|
||||
//
|
||||
// No test for singularity or near-singularity is included in this
|
||||
// routine. Such tests must be performed before calling this routine.
|
||||
func Tbsv(t blas.Transpose, a TriangularBand, x Vector) {
|
||||
blas64.Dtbsv(a.Uplo, t, a.Diag, a.N, a.K, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tpsv solves
|
||||
// A * x = b, if t == blas.NoTrans,
|
||||
// A^T * x = b, if t == blas.Trans or blas.ConjTrans,
|
||||
// where A is an n×n triangular matrix in packed format, and x and b are
|
||||
// vectors.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
// stored in place into x.
|
||||
//
|
||||
// No test for singularity or near-singularity is included in this
|
||||
// routine. Such tests must be performed before calling this routine.
|
||||
func Tpsv(t blas.Transpose, a TriangularPacked, x Vector) {
|
||||
blas64.Dtpsv(a.Uplo, t, a.Diag, a.N, a.Data, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Symv computes
|
||||
// y = alpha * A * x + beta * y,
|
||||
// where A is an n×n symmetric matrix, x and y are vectors, and alpha and
|
||||
// beta are scalars.
|
||||
func Symv(alpha float64, a Symmetric, x Vector, beta float64, y Vector) {
|
||||
blas64.Dsymv(a.Uplo, a.N, alpha, a.Data, a.Stride, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Sbmv performs
|
||||
// y = alpha * A * x + beta * y,
|
||||
// where A is an n×n symmetric band matrix, x and y are vectors, and alpha
|
||||
// and beta are scalars.
|
||||
func Sbmv(alpha float64, a SymmetricBand, x Vector, beta float64, y Vector) {
|
||||
blas64.Dsbmv(a.Uplo, a.N, a.K, alpha, a.Data, a.Stride, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Spmv performs
|
||||
// y = alpha * A * x + beta * y,
|
||||
// where A is an n×n symmetric matrix in packed format, x and y are vectors,
|
||||
// and alpha and beta are scalars.
|
||||
func Spmv(alpha float64, a SymmetricPacked, x Vector, beta float64, y Vector) {
|
||||
blas64.Dspmv(a.Uplo, a.N, alpha, a.Data, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Ger performs a rank-1 update
|
||||
// A += alpha * x * y^T,
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Ger(alpha float64, x, y Vector, a General) {
|
||||
blas64.Dger(a.Rows, a.Cols, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Syr performs a rank-1 update
|
||||
// A += alpha * x * x^T,
|
||||
// where A is an n×n symmetric matrix, x is a vector, and alpha is a scalar.
|
||||
func Syr(alpha float64, x Vector, a Symmetric) {
|
||||
blas64.Dsyr(a.Uplo, a.N, alpha, x.Data, x.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Spr performs the rank-1 update
|
||||
// A += alpha * x * x^T,
|
||||
// where A is an n×n symmetric matrix in packed format, x is a vector, and
|
||||
// alpha is a scalar.
|
||||
func Spr(alpha float64, x Vector, a SymmetricPacked) {
|
||||
blas64.Dspr(a.Uplo, a.N, alpha, x.Data, x.Inc, a.Data)
|
||||
}
|
||||
|
||||
// Syr2 performs a rank-2 update
|
||||
// A += alpha * x * y^T + alpha * y * x^T,
|
||||
// where A is a symmetric n×n matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Syr2(alpha float64, x, y Vector, a Symmetric) {
|
||||
blas64.Dsyr2(a.Uplo, a.N, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Spr2 performs a rank-2 update
|
||||
// A += alpha * x * y^T + alpha * y * x^T,
|
||||
// where A is an n×n symmetric matrix in packed format, x and y are vectors,
|
||||
// and alpha is a scalar.
|
||||
func Spr2(alpha float64, x, y Vector, a SymmetricPacked) {
|
||||
blas64.Dspr2(a.Uplo, a.N, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data)
|
||||
}
|
||||
|
||||
// Level 3
|
||||
|
||||
// Gemm computes
|
||||
// C = alpha * A * B + beta * C,
|
||||
// where A, B, and C are dense matrices, and alpha and beta are scalars.
|
||||
// tA and tB specify whether A or B are transposed.
|
||||
func Gemm(tA, tB blas.Transpose, alpha float64, a, b General, beta float64, c General) {
|
||||
var m, n, k int
|
||||
if tA == blas.NoTrans {
|
||||
m, k = a.Rows, a.Cols
|
||||
} else {
|
||||
m, k = a.Cols, a.Rows
|
||||
}
|
||||
if tB == blas.NoTrans {
|
||||
n = b.Cols
|
||||
} else {
|
||||
n = b.Rows
|
||||
}
|
||||
blas64.Dgemm(tA, tB, m, n, k, alpha, a.Data, a.Stride, b.Data, b.Stride, beta, c.Data, c.Stride)
|
||||
}
|
||||
|
||||
// Symm performs
|
||||
// C = alpha * A * B + beta * C, if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C, if s == blas.Right,
|
||||
// where A is an n×n or m×m symmetric matrix, B and C are m×n matrices, and
|
||||
// alpha is a scalar.
|
||||
func Symm(s blas.Side, alpha float64, a Symmetric, b General, beta float64, c General) {
|
||||
var m, n int
|
||||
if s == blas.Left {
|
||||
m, n = a.N, b.Cols
|
||||
} else {
|
||||
m, n = b.Rows, a.N
|
||||
}
|
||||
blas64.Dsymm(s, a.Uplo, m, n, alpha, a.Data, a.Stride, b.Data, b.Stride, beta, c.Data, c.Stride)
|
||||
}
|
||||
|
||||
// Syrk performs a symmetric rank-k update
|
||||
// C = alpha * A * A^T + beta * C, if t == blas.NoTrans,
|
||||
// C = alpha * A^T * A + beta * C, if t == blas.Trans or blas.ConjTrans,
|
||||
// where C is an n×n symmetric matrix, A is an n×k matrix if t == blas.NoTrans and
|
||||
// a k×n matrix otherwise, and alpha and beta are scalars.
|
||||
func Syrk(t blas.Transpose, alpha float64, a General, beta float64, c Symmetric) {
|
||||
var n, k int
|
||||
if t == blas.NoTrans {
|
||||
n, k = a.Rows, a.Cols
|
||||
} else {
|
||||
n, k = a.Cols, a.Rows
|
||||
}
|
||||
blas64.Dsyrk(c.Uplo, t, n, k, alpha, a.Data, a.Stride, beta, c.Data, c.Stride)
|
||||
}
|
||||
|
||||
// Syr2k performs a symmetric rank-2k update
|
||||
// C = alpha * A * B^T + alpha * B * A^T + beta * C, if t == blas.NoTrans,
|
||||
// C = alpha * A^T * B + alpha * B^T * A + beta * C, if t == blas.Trans or blas.ConjTrans,
|
||||
// where C is an n×n symmetric matrix, A and B are n×k matrices if t == NoTrans
|
||||
// and k×n matrices otherwise, and alpha and beta are scalars.
|
||||
func Syr2k(t blas.Transpose, alpha float64, a, b General, beta float64, c Symmetric) {
|
||||
var n, k int
|
||||
if t == blas.NoTrans {
|
||||
n, k = a.Rows, a.Cols
|
||||
} else {
|
||||
n, k = a.Cols, a.Rows
|
||||
}
|
||||
blas64.Dsyr2k(c.Uplo, t, n, k, alpha, a.Data, a.Stride, b.Data, b.Stride, beta, c.Data, c.Stride)
|
||||
}
|
||||
|
||||
// Trmm performs
|
||||
// B = alpha * A * B, if tA == blas.NoTrans and s == blas.Left,
|
||||
// B = alpha * A^T * B, if tA == blas.Trans or blas.ConjTrans, and s == blas.Left,
|
||||
// B = alpha * B * A, if tA == blas.NoTrans and s == blas.Right,
|
||||
// B = alpha * B * A^T, if tA == blas.Trans or blas.ConjTrans, and s == blas.Right,
|
||||
// where A is an n×n or m×m triangular matrix, B is an m×n matrix, and alpha is
|
||||
// a scalar.
|
||||
func Trmm(s blas.Side, tA blas.Transpose, alpha float64, a Triangular, b General) {
|
||||
blas64.Dtrmm(s, a.Uplo, tA, a.Diag, b.Rows, b.Cols, alpha, a.Data, a.Stride, b.Data, b.Stride)
|
||||
}
|
||||
|
||||
// Trsm solves
|
||||
// A * X = alpha * B, if tA == blas.NoTrans and s == blas.Left,
|
||||
// A^T * X = alpha * B, if tA == blas.Trans or blas.ConjTrans, and s == blas.Left,
|
||||
// X * A = alpha * B, if tA == blas.NoTrans and s == blas.Right,
|
||||
// X * A^T = alpha * B, if tA == blas.Trans or blas.ConjTrans, and s == blas.Right,
|
||||
// where A is an n×n or m×m triangular matrix, X and B are m×n matrices, and
|
||||
// alpha is a scalar.
|
||||
//
|
||||
// At entry to the function, X contains the values of B, and the result is
|
||||
// stored in-place into X.
|
||||
//
|
||||
// No check is made that A is invertible.
|
||||
func Trsm(s blas.Side, tA blas.Transpose, alpha float64, a Triangular, b General) {
|
||||
blas64.Dtrsm(s, a.Uplo, tA, a.Diag, b.Rows, b.Cols, alpha, a.Data, a.Stride, b.Data, b.Stride)
|
||||
}
|
277
vendor/gonum.org/v1/gonum/blas/blas64/conv.go
generated
vendored
277
vendor/gonum.org/v1/gonum/blas/blas64/conv.go
generated
vendored
|
@ -1,277 +0,0 @@
|
|||
// 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 blas64
|
||||
|
||||
import "gonum.org/v1/gonum/blas"
|
||||
|
||||
// GeneralCols represents a matrix using the conventional column-major storage scheme.
|
||||
type GeneralCols General
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions as a and have adequate backing
|
||||
// data storage.
|
||||
func (t GeneralCols) From(a General) {
|
||||
if t.Rows != a.Rows || t.Cols != a.Cols {
|
||||
panic("blas64: mismatched dimension")
|
||||
}
|
||||
if len(t.Data) < (t.Cols-1)*t.Stride+t.Rows {
|
||||
panic("blas64: short data slice")
|
||||
}
|
||||
for i := 0; i < a.Rows; i++ {
|
||||
for j, v := range a.Data[i*a.Stride : i*a.Stride+a.Cols] {
|
||||
t.Data[i+j*t.Stride] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions as a and have adequate backing
|
||||
// data storage.
|
||||
func (t General) From(a GeneralCols) {
|
||||
if t.Rows != a.Rows || t.Cols != a.Cols {
|
||||
panic("blas64: mismatched dimension")
|
||||
}
|
||||
if len(t.Data) < (t.Rows-1)*t.Stride+t.Cols {
|
||||
panic("blas64: short data slice")
|
||||
}
|
||||
for j := 0; j < a.Cols; j++ {
|
||||
for i, v := range a.Data[j*a.Stride : j*a.Stride+a.Rows] {
|
||||
t.Data[i*t.Stride+j] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TriangularCols represents a matrix using the conventional column-major storage scheme.
|
||||
type TriangularCols Triangular
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, uplo and diag as a and have
|
||||
// adequate backing data storage.
|
||||
func (t TriangularCols) From(a Triangular) {
|
||||
if t.N != a.N {
|
||||
panic("blas64: mismatched dimension")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("blas64: mismatched BLAS uplo")
|
||||
}
|
||||
if t.Diag != a.Diag {
|
||||
panic("blas64: mismatched BLAS diag")
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("blas64: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := i; j < a.N; j++ {
|
||||
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
|
||||
}
|
||||
}
|
||||
case blas.Lower:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j <= i; j++ {
|
||||
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
|
||||
}
|
||||
}
|
||||
case blas.All:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j < a.N; j++ {
|
||||
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, uplo and diag as a and have
|
||||
// adequate backing data storage.
|
||||
func (t Triangular) From(a TriangularCols) {
|
||||
if t.N != a.N {
|
||||
panic("blas64: mismatched dimension")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("blas64: mismatched BLAS uplo")
|
||||
}
|
||||
if t.Diag != a.Diag {
|
||||
panic("blas64: mismatched BLAS diag")
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("blas64: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := i; j < a.N; j++ {
|
||||
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
|
||||
}
|
||||
}
|
||||
case blas.Lower:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j <= i; j++ {
|
||||
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
|
||||
}
|
||||
}
|
||||
case blas.All:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j < a.N; j++ {
|
||||
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// BandCols represents a matrix using the band column-major storage scheme.
|
||||
type BandCols Band
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions and bandwidth as a and have
|
||||
// adequate backing data storage.
|
||||
func (t BandCols) From(a Band) {
|
||||
if t.Rows != a.Rows || t.Cols != a.Cols {
|
||||
panic("blas64: mismatched dimension")
|
||||
}
|
||||
if t.KL != a.KL || t.KU != a.KU {
|
||||
panic("blas64: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.KL+a.KU+1 {
|
||||
panic("blas64: short stride for source")
|
||||
}
|
||||
if t.Stride < t.KL+t.KU+1 {
|
||||
panic("blas64: short stride for destination")
|
||||
}
|
||||
for i := 0; i < a.Rows; i++ {
|
||||
for j := max(0, i-a.KL); j < min(i+a.KU+1, a.Cols); j++ {
|
||||
t.Data[i+t.KU-j+j*t.Stride] = a.Data[j+a.KL-i+i*a.Stride]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions and bandwidth as a and have
|
||||
// adequate backing data storage.
|
||||
func (t Band) From(a BandCols) {
|
||||
if t.Rows != a.Rows || t.Cols != a.Cols {
|
||||
panic("blas64: mismatched dimension")
|
||||
}
|
||||
if t.KL != a.KL || t.KU != a.KU {
|
||||
panic("blas64: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.KL+a.KU+1 {
|
||||
panic("blas64: short stride for source")
|
||||
}
|
||||
if t.Stride < t.KL+t.KU+1 {
|
||||
panic("blas64: short stride for destination")
|
||||
}
|
||||
for j := 0; j < a.Cols; j++ {
|
||||
for i := max(0, j-a.KU); i < min(j+a.KL+1, a.Rows); i++ {
|
||||
t.Data[j+a.KL-i+i*a.Stride] = a.Data[i+t.KU-j+j*t.Stride]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TriangularBandCols represents a symmetric matrix using the band column-major storage scheme.
|
||||
type TriangularBandCols TriangularBand
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, bandwidth and uplo as a and
|
||||
// have adequate backing data storage.
|
||||
func (t TriangularBandCols) From(a TriangularBand) {
|
||||
if t.N != a.N {
|
||||
panic("blas64: mismatched dimension")
|
||||
}
|
||||
if t.K != a.K {
|
||||
panic("blas64: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.K+1 {
|
||||
panic("blas64: short stride for source")
|
||||
}
|
||||
if t.Stride < t.K+1 {
|
||||
panic("blas64: short stride for destination")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("blas64: mismatched BLAS uplo")
|
||||
}
|
||||
if t.Diag != a.Diag {
|
||||
panic("blas64: mismatched BLAS diag")
|
||||
}
|
||||
dst := BandCols{
|
||||
Rows: t.N, Cols: t.N,
|
||||
Stride: t.Stride,
|
||||
Data: t.Data,
|
||||
}
|
||||
src := Band{
|
||||
Rows: a.N, Cols: a.N,
|
||||
Stride: a.Stride,
|
||||
Data: a.Data,
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("blas64: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
dst.KU = t.K
|
||||
src.KU = a.K
|
||||
case blas.Lower:
|
||||
dst.KL = t.K
|
||||
src.KL = a.K
|
||||
}
|
||||
dst.From(src)
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, bandwidth and uplo as a and
|
||||
// have adequate backing data storage.
|
||||
func (t TriangularBand) From(a TriangularBandCols) {
|
||||
if t.N != a.N {
|
||||
panic("blas64: mismatched dimension")
|
||||
}
|
||||
if t.K != a.K {
|
||||
panic("blas64: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.K+1 {
|
||||
panic("blas64: short stride for source")
|
||||
}
|
||||
if t.Stride < t.K+1 {
|
||||
panic("blas64: short stride for destination")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("blas64: mismatched BLAS uplo")
|
||||
}
|
||||
if t.Diag != a.Diag {
|
||||
panic("blas64: mismatched BLAS diag")
|
||||
}
|
||||
dst := Band{
|
||||
Rows: t.N, Cols: t.N,
|
||||
Stride: t.Stride,
|
||||
Data: t.Data,
|
||||
}
|
||||
src := BandCols{
|
||||
Rows: a.N, Cols: a.N,
|
||||
Stride: a.Stride,
|
||||
Data: a.Data,
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("blas64: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
dst.KU = t.K
|
||||
src.KU = a.K
|
||||
case blas.Lower:
|
||||
dst.KL = t.K
|
||||
src.KL = a.K
|
||||
}
|
||||
dst.From(src)
|
||||
}
|
||||
|
||||
func min(a, b int) int {
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func max(a, b int) int {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
153
vendor/gonum.org/v1/gonum/blas/blas64/conv_symmetric.go
generated
vendored
153
vendor/gonum.org/v1/gonum/blas/blas64/conv_symmetric.go
generated
vendored
|
@ -1,153 +0,0 @@
|
|||
// 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 blas64
|
||||
|
||||
import "gonum.org/v1/gonum/blas"
|
||||
|
||||
// SymmetricCols represents a matrix using the conventional column-major storage scheme.
|
||||
type SymmetricCols Symmetric
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions and uplo as a and have adequate
|
||||
// backing data storage.
|
||||
func (t SymmetricCols) From(a Symmetric) {
|
||||
if t.N != a.N {
|
||||
panic("blas64: mismatched dimension")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("blas64: mismatched BLAS uplo")
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("blas64: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := i; j < a.N; j++ {
|
||||
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
|
||||
}
|
||||
}
|
||||
case blas.Lower:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j <= i; j++ {
|
||||
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions and uplo as a and have adequate
|
||||
// backing data storage.
|
||||
func (t Symmetric) From(a SymmetricCols) {
|
||||
if t.N != a.N {
|
||||
panic("blas64: mismatched dimension")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("blas64: mismatched BLAS uplo")
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("blas64: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := i; j < a.N; j++ {
|
||||
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
|
||||
}
|
||||
}
|
||||
case blas.Lower:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j <= i; j++ {
|
||||
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SymmetricBandCols represents a symmetric matrix using the band column-major storage scheme.
|
||||
type SymmetricBandCols SymmetricBand
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, bandwidth and uplo as a and
|
||||
// have adequate backing data storage.
|
||||
func (t SymmetricBandCols) From(a SymmetricBand) {
|
||||
if t.N != a.N {
|
||||
panic("blas64: mismatched dimension")
|
||||
}
|
||||
if t.K != a.K {
|
||||
panic("blas64: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.K+1 {
|
||||
panic("blas64: short stride for source")
|
||||
}
|
||||
if t.Stride < t.K+1 {
|
||||
panic("blas64: short stride for destination")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("blas64: mismatched BLAS uplo")
|
||||
}
|
||||
dst := BandCols{
|
||||
Rows: t.N, Cols: t.N,
|
||||
Stride: t.Stride,
|
||||
Data: t.Data,
|
||||
}
|
||||
src := Band{
|
||||
Rows: a.N, Cols: a.N,
|
||||
Stride: a.Stride,
|
||||
Data: a.Data,
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("blas64: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
dst.KU = t.K
|
||||
src.KU = a.K
|
||||
case blas.Lower:
|
||||
dst.KL = t.K
|
||||
src.KL = a.K
|
||||
}
|
||||
dst.From(src)
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, bandwidth and uplo as a and
|
||||
// have adequate backing data storage.
|
||||
func (t SymmetricBand) From(a SymmetricBandCols) {
|
||||
if t.N != a.N {
|
||||
panic("blas64: mismatched dimension")
|
||||
}
|
||||
if t.K != a.K {
|
||||
panic("blas64: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.K+1 {
|
||||
panic("blas64: short stride for source")
|
||||
}
|
||||
if t.Stride < t.K+1 {
|
||||
panic("blas64: short stride for destination")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("blas64: mismatched BLAS uplo")
|
||||
}
|
||||
dst := Band{
|
||||
Rows: t.N, Cols: t.N,
|
||||
Stride: t.Stride,
|
||||
Data: t.Data,
|
||||
}
|
||||
src := BandCols{
|
||||
Rows: a.N, Cols: a.N,
|
||||
Stride: a.Stride,
|
||||
Data: a.Data,
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("blas64: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
dst.KU = t.K
|
||||
src.KU = a.K
|
||||
case blas.Lower:
|
||||
dst.KL = t.K
|
||||
src.KL = a.K
|
||||
}
|
||||
dst.From(src)
|
||||
}
|
6
vendor/gonum.org/v1/gonum/blas/blas64/doc.go
generated
vendored
6
vendor/gonum.org/v1/gonum/blas/blas64/doc.go
generated
vendored
|
@ -1,6 +0,0 @@
|
|||
// Copyright ©2017 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 blas64 provides a simple interface to the float64 BLAS API.
|
||||
package blas64 // import "gonum.org/v1/gonum/blas/blas64"
|
508
vendor/gonum.org/v1/gonum/blas/cblas128/cblas128.go
generated
vendored
508
vendor/gonum.org/v1/gonum/blas/cblas128/cblas128.go
generated
vendored
|
@ -1,508 +0,0 @@
|
|||
// 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 cblas128
|
||||
|
||||
import (
|
||||
"gonum.org/v1/gonum/blas"
|
||||
"gonum.org/v1/gonum/blas/gonum"
|
||||
)
|
||||
|
||||
var cblas128 blas.Complex128 = gonum.Implementation{}
|
||||
|
||||
// Use sets the BLAS complex128 implementation to be used by subsequent BLAS calls.
|
||||
// The default implementation is
|
||||
// gonum.org/v1/gonum/blas/gonum.Implementation.
|
||||
func Use(b blas.Complex128) {
|
||||
cblas128 = b
|
||||
}
|
||||
|
||||
// Implementation returns the current BLAS complex128 implementation.
|
||||
//
|
||||
// Implementation allows direct calls to the current the BLAS complex128 implementation
|
||||
// giving finer control of parameters.
|
||||
func Implementation() blas.Complex128 {
|
||||
return cblas128
|
||||
}
|
||||
|
||||
// Vector represents a vector with an associated element increment.
|
||||
type Vector struct {
|
||||
Inc int
|
||||
Data []complex128
|
||||
}
|
||||
|
||||
// General represents a matrix using the conventional storage scheme.
|
||||
type General struct {
|
||||
Rows, Cols int
|
||||
Stride int
|
||||
Data []complex128
|
||||
}
|
||||
|
||||
// Band represents a band matrix using the band storage scheme.
|
||||
type Band struct {
|
||||
Rows, Cols int
|
||||
KL, KU int
|
||||
Stride int
|
||||
Data []complex128
|
||||
}
|
||||
|
||||
// Triangular represents a triangular matrix using the conventional storage scheme.
|
||||
type Triangular struct {
|
||||
N int
|
||||
Stride int
|
||||
Data []complex128
|
||||
Uplo blas.Uplo
|
||||
Diag blas.Diag
|
||||
}
|
||||
|
||||
// TriangularBand represents a triangular matrix using the band storage scheme.
|
||||
type TriangularBand struct {
|
||||
N, K int
|
||||
Stride int
|
||||
Data []complex128
|
||||
Uplo blas.Uplo
|
||||
Diag blas.Diag
|
||||
}
|
||||
|
||||
// TriangularPacked represents a triangular matrix using the packed storage scheme.
|
||||
type TriangularPacked struct {
|
||||
N int
|
||||
Data []complex128
|
||||
Uplo blas.Uplo
|
||||
Diag blas.Diag
|
||||
}
|
||||
|
||||
// Symmetric represents a symmetric matrix using the conventional storage scheme.
|
||||
type Symmetric struct {
|
||||
N int
|
||||
Stride int
|
||||
Data []complex128
|
||||
Uplo blas.Uplo
|
||||
}
|
||||
|
||||
// SymmetricBand represents a symmetric matrix using the band storage scheme.
|
||||
type SymmetricBand struct {
|
||||
N, K int
|
||||
Stride int
|
||||
Data []complex128
|
||||
Uplo blas.Uplo
|
||||
}
|
||||
|
||||
// SymmetricPacked represents a symmetric matrix using the packed storage scheme.
|
||||
type SymmetricPacked struct {
|
||||
N int
|
||||
Data []complex128
|
||||
Uplo blas.Uplo
|
||||
}
|
||||
|
||||
// Hermitian represents an Hermitian matrix using the conventional storage scheme.
|
||||
type Hermitian Symmetric
|
||||
|
||||
// HermitianBand represents an Hermitian matrix using the band storage scheme.
|
||||
type HermitianBand SymmetricBand
|
||||
|
||||
// HermitianPacked represents an Hermitian matrix using the packed storage scheme.
|
||||
type HermitianPacked SymmetricPacked
|
||||
|
||||
// Level 1
|
||||
|
||||
const negInc = "cblas128: negative vector increment"
|
||||
|
||||
// Dotu computes the dot product of the two vectors without
|
||||
// complex conjugation:
|
||||
// x^T * y.
|
||||
func Dotu(n int, x, y Vector) complex128 {
|
||||
return cblas128.Zdotu(n, x.Data, x.Inc, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Dotc computes the dot product of the two vectors with
|
||||
// complex conjugation:
|
||||
// x^H * y.
|
||||
func Dotc(n int, x, y Vector) complex128 {
|
||||
return cblas128.Zdotc(n, x.Data, x.Inc, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Nrm2 computes the Euclidean norm of the vector x:
|
||||
// sqrt(\sum_i x[i] * x[i]).
|
||||
//
|
||||
// Nrm2 will panic if the vector increment is negative.
|
||||
func Nrm2(n int, x Vector) float64 {
|
||||
if x.Inc < 0 {
|
||||
panic(negInc)
|
||||
}
|
||||
return cblas128.Dznrm2(n, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Asum computes the sum of magnitudes of the real and imaginary parts of
|
||||
// elements of the vector x:
|
||||
// \sum_i (|Re x[i]| + |Im x[i]|).
|
||||
//
|
||||
// Asum will panic if the vector increment is negative.
|
||||
func Asum(n int, x Vector) float64 {
|
||||
if x.Inc < 0 {
|
||||
panic(negInc)
|
||||
}
|
||||
return cblas128.Dzasum(n, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Iamax returns the index of an element of x with the largest sum of
|
||||
// magnitudes of the real and imaginary parts (|Re x[i]|+|Im x[i]|).
|
||||
// If there are multiple such indices, the earliest is returned.
|
||||
//
|
||||
// Iamax returns -1 if n == 0.
|
||||
//
|
||||
// Iamax will panic if the vector increment is negative.
|
||||
func Iamax(n int, x Vector) int {
|
||||
if x.Inc < 0 {
|
||||
panic(negInc)
|
||||
}
|
||||
return cblas128.Izamax(n, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Swap exchanges the elements of two vectors:
|
||||
// x[i], y[i] = y[i], x[i] for all i.
|
||||
func Swap(n int, x, y Vector) {
|
||||
cblas128.Zswap(n, x.Data, x.Inc, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Copy copies the elements of x into the elements of y:
|
||||
// y[i] = x[i] for all i.
|
||||
func Copy(n int, x, y Vector) {
|
||||
cblas128.Zcopy(n, x.Data, x.Inc, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Axpy computes
|
||||
// y = alpha * x + y,
|
||||
// where x and y are vectors, and alpha is a scalar.
|
||||
func Axpy(n int, alpha complex128, x, y Vector) {
|
||||
cblas128.Zaxpy(n, alpha, x.Data, x.Inc, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Scal computes
|
||||
// x = alpha * x,
|
||||
// where x is a vector, and alpha is a scalar.
|
||||
//
|
||||
// Scal will panic if the vector increment is negative.
|
||||
func Scal(n int, alpha complex128, x Vector) {
|
||||
if x.Inc < 0 {
|
||||
panic(negInc)
|
||||
}
|
||||
cblas128.Zscal(n, alpha, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Dscal computes
|
||||
// x = alpha * x,
|
||||
// where x is a vector, and alpha is a real scalar.
|
||||
//
|
||||
// Dscal will panic if the vector increment is negative.
|
||||
func Dscal(n int, alpha float64, x Vector) {
|
||||
if x.Inc < 0 {
|
||||
panic(negInc)
|
||||
}
|
||||
cblas128.Zdscal(n, alpha, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Level 2
|
||||
|
||||
// Gemv computes
|
||||
// y = alpha * A * x + beta * y, if t == blas.NoTrans,
|
||||
// y = alpha * A^T * x + beta * y, if t == blas.Trans,
|
||||
// y = alpha * A^H * x + beta * y, if t == blas.ConjTrans,
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha and beta are
|
||||
// scalars.
|
||||
func Gemv(t blas.Transpose, alpha complex128, a General, x Vector, beta complex128, y Vector) {
|
||||
cblas128.Zgemv(t, a.Rows, a.Cols, alpha, a.Data, a.Stride, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Gbmv computes
|
||||
// y = alpha * A * x + beta * y, if t == blas.NoTrans,
|
||||
// y = alpha * A^T * x + beta * y, if t == blas.Trans,
|
||||
// y = alpha * A^H * x + beta * y, if t == blas.ConjTrans,
|
||||
// where A is an m×n band matrix, x and y are vectors, and alpha and beta are
|
||||
// scalars.
|
||||
func Gbmv(t blas.Transpose, alpha complex128, a Band, x Vector, beta complex128, y Vector) {
|
||||
cblas128.Zgbmv(t, a.Rows, a.Cols, a.KL, a.KU, alpha, a.Data, a.Stride, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Trmv computes
|
||||
// x = A * x, if t == blas.NoTrans,
|
||||
// x = A^T * x, if t == blas.Trans,
|
||||
// x = A^H * x, if t == blas.ConjTrans,
|
||||
// where A is an n×n triangular matrix, and x is a vector.
|
||||
func Trmv(t blas.Transpose, a Triangular, x Vector) {
|
||||
cblas128.Ztrmv(a.Uplo, t, a.Diag, a.N, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tbmv computes
|
||||
// x = A * x, if t == blas.NoTrans,
|
||||
// x = A^T * x, if t == blas.Trans,
|
||||
// x = A^H * x, if t == blas.ConjTrans,
|
||||
// where A is an n×n triangular band matrix, and x is a vector.
|
||||
func Tbmv(t blas.Transpose, a TriangularBand, x Vector) {
|
||||
cblas128.Ztbmv(a.Uplo, t, a.Diag, a.N, a.K, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tpmv computes
|
||||
// x = A * x, if t == blas.NoTrans,
|
||||
// x = A^T * x, if t == blas.Trans,
|
||||
// x = A^H * x, if t == blas.ConjTrans,
|
||||
// where A is an n×n triangular matrix in packed format, and x is a vector.
|
||||
func Tpmv(t blas.Transpose, a TriangularPacked, x Vector) {
|
||||
cblas128.Ztpmv(a.Uplo, t, a.Diag, a.N, a.Data, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Trsv solves
|
||||
// A * x = b, if t == blas.NoTrans,
|
||||
// A^T * x = b, if t == blas.Trans,
|
||||
// A^H * x = b, if t == blas.ConjTrans,
|
||||
// where A is an n×n triangular matrix and x is a vector.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
// stored in-place into x.
|
||||
//
|
||||
// No test for singularity or near-singularity is included in this
|
||||
// routine. Such tests must be performed before calling this routine.
|
||||
func Trsv(t blas.Transpose, a Triangular, x Vector) {
|
||||
cblas128.Ztrsv(a.Uplo, t, a.Diag, a.N, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tbsv solves
|
||||
// A * x = b, if t == blas.NoTrans,
|
||||
// A^T * x = b, if t == blas.Trans,
|
||||
// A^H * x = b, if t == blas.ConjTrans,
|
||||
// where A is an n×n triangular band matrix, and x is a vector.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
// stored in-place into x.
|
||||
//
|
||||
// No test for singularity or near-singularity is included in this
|
||||
// routine. Such tests must be performed before calling this routine.
|
||||
func Tbsv(t blas.Transpose, a TriangularBand, x Vector) {
|
||||
cblas128.Ztbsv(a.Uplo, t, a.Diag, a.N, a.K, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tpsv solves
|
||||
// A * x = b, if t == blas.NoTrans,
|
||||
// A^T * x = b, if t == blas.Trans,
|
||||
// A^H * x = b, if t == blas.ConjTrans,
|
||||
// where A is an n×n triangular matrix in packed format and x is a vector.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
// stored in-place into x.
|
||||
//
|
||||
// No test for singularity or near-singularity is included in this
|
||||
// routine. Such tests must be performed before calling this routine.
|
||||
func Tpsv(t blas.Transpose, a TriangularPacked, x Vector) {
|
||||
cblas128.Ztpsv(a.Uplo, t, a.Diag, a.N, a.Data, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Hemv computes
|
||||
// y = alpha * A * x + beta * y,
|
||||
// where A is an n×n Hermitian matrix, x and y are vectors, and alpha and
|
||||
// beta are scalars.
|
||||
func Hemv(alpha complex128, a Hermitian, x Vector, beta complex128, y Vector) {
|
||||
cblas128.Zhemv(a.Uplo, a.N, alpha, a.Data, a.Stride, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Hbmv performs
|
||||
// y = alpha * A * x + beta * y,
|
||||
// where A is an n×n Hermitian band matrix, x and y are vectors, and alpha
|
||||
// and beta are scalars.
|
||||
func Hbmv(alpha complex128, a HermitianBand, x Vector, beta complex128, y Vector) {
|
||||
cblas128.Zhbmv(a.Uplo, a.N, a.K, alpha, a.Data, a.Stride, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Hpmv performs
|
||||
// y = alpha * A * x + beta * y,
|
||||
// where A is an n×n Hermitian matrix in packed format, x and y are vectors,
|
||||
// and alpha and beta are scalars.
|
||||
func Hpmv(alpha complex128, a HermitianPacked, x Vector, beta complex128, y Vector) {
|
||||
cblas128.Zhpmv(a.Uplo, a.N, alpha, a.Data, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Geru performs a rank-1 update
|
||||
// A += alpha * x * y^T,
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Geru(alpha complex128, x, y Vector, a General) {
|
||||
cblas128.Zgeru(a.Rows, a.Cols, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Gerc performs a rank-1 update
|
||||
// A += alpha * x * y^H,
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Gerc(alpha complex128, x, y Vector, a General) {
|
||||
cblas128.Zgerc(a.Rows, a.Cols, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Her performs a rank-1 update
|
||||
// A += alpha * x * y^T,
|
||||
// where A is an m×n Hermitian matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Her(alpha float64, x Vector, a Hermitian) {
|
||||
cblas128.Zher(a.Uplo, a.N, alpha, x.Data, x.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Hpr performs a rank-1 update
|
||||
// A += alpha * x * x^H,
|
||||
// where A is an n×n Hermitian matrix in packed format, x is a vector, and
|
||||
// alpha is a scalar.
|
||||
func Hpr(alpha float64, x Vector, a HermitianPacked) {
|
||||
cblas128.Zhpr(a.Uplo, a.N, alpha, x.Data, x.Inc, a.Data)
|
||||
}
|
||||
|
||||
// Her2 performs a rank-2 update
|
||||
// A += alpha * x * y^H + conj(alpha) * y * x^H,
|
||||
// where A is an n×n Hermitian matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Her2(alpha complex128, x, y Vector, a Hermitian) {
|
||||
cblas128.Zher2(a.Uplo, a.N, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Hpr2 performs a rank-2 update
|
||||
// A += alpha * x * y^H + conj(alpha) * y * x^H,
|
||||
// where A is an n×n Hermitian matrix in packed format, x and y are vectors,
|
||||
// and alpha is a scalar.
|
||||
func Hpr2(alpha complex128, x, y Vector, a HermitianPacked) {
|
||||
cblas128.Zhpr2(a.Uplo, a.N, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data)
|
||||
}
|
||||
|
||||
// Level 3
|
||||
|
||||
// Gemm computes
|
||||
// C = alpha * A * B + beta * C,
|
||||
// where A, B, and C are dense matrices, and alpha and beta are scalars.
|
||||
// tA and tB specify whether A or B are transposed or conjugated.
|
||||
func Gemm(tA, tB blas.Transpose, alpha complex128, a, b General, beta complex128, c General) {
|
||||
var m, n, k int
|
||||
if tA == blas.NoTrans {
|
||||
m, k = a.Rows, a.Cols
|
||||
} else {
|
||||
m, k = a.Cols, a.Rows
|
||||
}
|
||||
if tB == blas.NoTrans {
|
||||
n = b.Cols
|
||||
} else {
|
||||
n = b.Rows
|
||||
}
|
||||
cblas128.Zgemm(tA, tB, m, n, k, alpha, a.Data, a.Stride, b.Data, b.Stride, beta, c.Data, c.Stride)
|
||||
}
|
||||
|
||||
// Symm performs
|
||||
// C = alpha * A * B + beta * C, if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C, if s == blas.Right,
|
||||
// where A is an n×n or m×m symmetric matrix, B and C are m×n matrices, and
|
||||
// alpha and beta are scalars.
|
||||
func Symm(s blas.Side, alpha complex128, a Symmetric, b General, beta complex128, c General) {
|
||||
var m, n int
|
||||
if s == blas.Left {
|
||||
m, n = a.N, b.Cols
|
||||
} else {
|
||||
m, n = b.Rows, a.N
|
||||
}
|
||||
cblas128.Zsymm(s, a.Uplo, m, n, alpha, a.Data, a.Stride, b.Data, b.Stride, beta, c.Data, c.Stride)
|
||||
}
|
||||
|
||||
// Syrk performs a symmetric rank-k update
|
||||
// C = alpha * A * A^T + beta * C, if t == blas.NoTrans,
|
||||
// C = alpha * A^T * A + beta * C, if t == blas.Trans,
|
||||
// where C is an n×n symmetric matrix, A is an n×k matrix if t == blas.NoTrans
|
||||
// and a k×n matrix otherwise, and alpha and beta are scalars.
|
||||
func Syrk(t blas.Transpose, alpha complex128, a General, beta complex128, c Symmetric) {
|
||||
var n, k int
|
||||
if t == blas.NoTrans {
|
||||
n, k = a.Rows, a.Cols
|
||||
} else {
|
||||
n, k = a.Cols, a.Rows
|
||||
}
|
||||
cblas128.Zsyrk(c.Uplo, t, n, k, alpha, a.Data, a.Stride, beta, c.Data, c.Stride)
|
||||
}
|
||||
|
||||
// Syr2k performs a symmetric rank-2k update
|
||||
// C = alpha * A * B^T + alpha * B * A^T + beta * C, if t == blas.NoTrans,
|
||||
// C = alpha * A^T * B + alpha * B^T * A + beta * C, if t == blas.Trans,
|
||||
// where C is an n×n symmetric matrix, A and B are n×k matrices if
|
||||
// t == blas.NoTrans and k×n otherwise, and alpha and beta are scalars.
|
||||
func Syr2k(t blas.Transpose, alpha complex128, a, b General, beta complex128, c Symmetric) {
|
||||
var n, k int
|
||||
if t == blas.NoTrans {
|
||||
n, k = a.Rows, a.Cols
|
||||
} else {
|
||||
n, k = a.Cols, a.Rows
|
||||
}
|
||||
cblas128.Zsyr2k(c.Uplo, t, n, k, alpha, a.Data, a.Stride, b.Data, b.Stride, beta, c.Data, c.Stride)
|
||||
}
|
||||
|
||||
// Trmm performs
|
||||
// B = alpha * A * B, if tA == blas.NoTrans and s == blas.Left,
|
||||
// B = alpha * A^T * B, if tA == blas.Trans and s == blas.Left,
|
||||
// B = alpha * A^H * B, if tA == blas.ConjTrans and s == blas.Left,
|
||||
// B = alpha * B * A, if tA == blas.NoTrans and s == blas.Right,
|
||||
// B = alpha * B * A^T, if tA == blas.Trans and s == blas.Right,
|
||||
// B = alpha * B * A^H, if tA == blas.ConjTrans and s == blas.Right,
|
||||
// where A is an n×n or m×m triangular matrix, B is an m×n matrix, and alpha is
|
||||
// a scalar.
|
||||
func Trmm(s blas.Side, tA blas.Transpose, alpha complex128, a Triangular, b General) {
|
||||
cblas128.Ztrmm(s, a.Uplo, tA, a.Diag, b.Rows, b.Cols, alpha, a.Data, a.Stride, b.Data, b.Stride)
|
||||
}
|
||||
|
||||
// Trsm solves
|
||||
// A * X = alpha * B, if tA == blas.NoTrans and s == blas.Left,
|
||||
// A^T * X = alpha * B, if tA == blas.Trans and s == blas.Left,
|
||||
// A^H * X = alpha * B, if tA == blas.ConjTrans and s == blas.Left,
|
||||
// X * A = alpha * B, if tA == blas.NoTrans and s == blas.Right,
|
||||
// X * A^T = alpha * B, if tA == blas.Trans and s == blas.Right,
|
||||
// X * A^H = alpha * B, if tA == blas.ConjTrans and s == blas.Right,
|
||||
// where A is an n×n or m×m triangular matrix, X and B are m×n matrices, and
|
||||
// alpha is a scalar.
|
||||
//
|
||||
// At entry to the function, b contains the values of B, and the result is
|
||||
// stored in-place into b.
|
||||
//
|
||||
// No check is made that A is invertible.
|
||||
func Trsm(s blas.Side, tA blas.Transpose, alpha complex128, a Triangular, b General) {
|
||||
cblas128.Ztrsm(s, a.Uplo, tA, a.Diag, b.Rows, b.Cols, alpha, a.Data, a.Stride, b.Data, b.Stride)
|
||||
}
|
||||
|
||||
// Hemm performs
|
||||
// C = alpha * A * B + beta * C, if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C, if s == blas.Right,
|
||||
// where A is an n×n or m×m Hermitian matrix, B and C are m×n matrices, and
|
||||
// alpha and beta are scalars.
|
||||
func Hemm(s blas.Side, alpha complex128, a Hermitian, b General, beta complex128, c General) {
|
||||
var m, n int
|
||||
if s == blas.Left {
|
||||
m, n = a.N, b.Cols
|
||||
} else {
|
||||
m, n = b.Rows, a.N
|
||||
}
|
||||
cblas128.Zhemm(s, a.Uplo, m, n, alpha, a.Data, a.Stride, b.Data, b.Stride, beta, c.Data, c.Stride)
|
||||
}
|
||||
|
||||
// Herk performs the Hermitian rank-k update
|
||||
// C = alpha * A * A^H + beta*C, if t == blas.NoTrans,
|
||||
// C = alpha * A^H * A + beta*C, if t == blas.ConjTrans,
|
||||
// where C is an n×n Hermitian matrix, A is an n×k matrix if t == blas.NoTrans
|
||||
// and a k×n matrix otherwise, and alpha and beta are scalars.
|
||||
func Herk(t blas.Transpose, alpha float64, a General, beta float64, c Hermitian) {
|
||||
var n, k int
|
||||
if t == blas.NoTrans {
|
||||
n, k = a.Rows, a.Cols
|
||||
} else {
|
||||
n, k = a.Cols, a.Rows
|
||||
}
|
||||
cblas128.Zherk(c.Uplo, t, n, k, alpha, a.Data, a.Stride, beta, c.Data, c.Stride)
|
||||
}
|
||||
|
||||
// Her2k performs the Hermitian rank-2k update
|
||||
// C = alpha * A * B^H + conj(alpha) * B * A^H + beta * C, if t == blas.NoTrans,
|
||||
// C = alpha * A^H * B + conj(alpha) * B^H * A + beta * C, if t == blas.ConjTrans,
|
||||
// where C is an n×n Hermitian matrix, A and B are n×k matrices if t == NoTrans
|
||||
// and k×n matrices otherwise, and alpha and beta are scalars.
|
||||
func Her2k(t blas.Transpose, alpha complex128, a, b General, beta float64, c Hermitian) {
|
||||
var n, k int
|
||||
if t == blas.NoTrans {
|
||||
n, k = a.Rows, a.Cols
|
||||
} else {
|
||||
n, k = a.Cols, a.Rows
|
||||
}
|
||||
cblas128.Zher2k(c.Uplo, t, n, k, alpha, a.Data, a.Stride, b.Data, b.Stride, beta, c.Data, c.Stride)
|
||||
}
|
279
vendor/gonum.org/v1/gonum/blas/cblas128/conv.go
generated
vendored
279
vendor/gonum.org/v1/gonum/blas/cblas128/conv.go
generated
vendored
|
@ -1,279 +0,0 @@
|
|||
// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.
|
||||
|
||||
// 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 cblas128
|
||||
|
||||
import "gonum.org/v1/gonum/blas"
|
||||
|
||||
// GeneralCols represents a matrix using the conventional column-major storage scheme.
|
||||
type GeneralCols General
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions as a and have adequate backing
|
||||
// data storage.
|
||||
func (t GeneralCols) From(a General) {
|
||||
if t.Rows != a.Rows || t.Cols != a.Cols {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if len(t.Data) < (t.Cols-1)*t.Stride+t.Rows {
|
||||
panic("cblas128: short data slice")
|
||||
}
|
||||
for i := 0; i < a.Rows; i++ {
|
||||
for j, v := range a.Data[i*a.Stride : i*a.Stride+a.Cols] {
|
||||
t.Data[i+j*t.Stride] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions as a and have adequate backing
|
||||
// data storage.
|
||||
func (t General) From(a GeneralCols) {
|
||||
if t.Rows != a.Rows || t.Cols != a.Cols {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if len(t.Data) < (t.Rows-1)*t.Stride+t.Cols {
|
||||
panic("cblas128: short data slice")
|
||||
}
|
||||
for j := 0; j < a.Cols; j++ {
|
||||
for i, v := range a.Data[j*a.Stride : j*a.Stride+a.Rows] {
|
||||
t.Data[i*t.Stride+j] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TriangularCols represents a matrix using the conventional column-major storage scheme.
|
||||
type TriangularCols Triangular
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, uplo and diag as a and have
|
||||
// adequate backing data storage.
|
||||
func (t TriangularCols) From(a Triangular) {
|
||||
if t.N != a.N {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("cblas128: mismatched BLAS uplo")
|
||||
}
|
||||
if t.Diag != a.Diag {
|
||||
panic("cblas128: mismatched BLAS diag")
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("cblas128: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := i; j < a.N; j++ {
|
||||
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
|
||||
}
|
||||
}
|
||||
case blas.Lower:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j <= i; j++ {
|
||||
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
|
||||
}
|
||||
}
|
||||
case blas.All:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j < a.N; j++ {
|
||||
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, uplo and diag as a and have
|
||||
// adequate backing data storage.
|
||||
func (t Triangular) From(a TriangularCols) {
|
||||
if t.N != a.N {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("cblas128: mismatched BLAS uplo")
|
||||
}
|
||||
if t.Diag != a.Diag {
|
||||
panic("cblas128: mismatched BLAS diag")
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("cblas128: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := i; j < a.N; j++ {
|
||||
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
|
||||
}
|
||||
}
|
||||
case blas.Lower:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j <= i; j++ {
|
||||
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
|
||||
}
|
||||
}
|
||||
case blas.All:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j < a.N; j++ {
|
||||
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// BandCols represents a matrix using the band column-major storage scheme.
|
||||
type BandCols Band
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions and bandwidth as a and have
|
||||
// adequate backing data storage.
|
||||
func (t BandCols) From(a Band) {
|
||||
if t.Rows != a.Rows || t.Cols != a.Cols {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.KL != a.KL || t.KU != a.KU {
|
||||
panic("cblas128: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.KL+a.KU+1 {
|
||||
panic("cblas128: short stride for source")
|
||||
}
|
||||
if t.Stride < t.KL+t.KU+1 {
|
||||
panic("cblas128: short stride for destination")
|
||||
}
|
||||
for i := 0; i < a.Rows; i++ {
|
||||
for j := max(0, i-a.KL); j < min(i+a.KU+1, a.Cols); j++ {
|
||||
t.Data[i+t.KU-j+j*t.Stride] = a.Data[j+a.KL-i+i*a.Stride]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions and bandwidth as a and have
|
||||
// adequate backing data storage.
|
||||
func (t Band) From(a BandCols) {
|
||||
if t.Rows != a.Rows || t.Cols != a.Cols {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.KL != a.KL || t.KU != a.KU {
|
||||
panic("cblas128: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.KL+a.KU+1 {
|
||||
panic("cblas128: short stride for source")
|
||||
}
|
||||
if t.Stride < t.KL+t.KU+1 {
|
||||
panic("cblas128: short stride for destination")
|
||||
}
|
||||
for j := 0; j < a.Cols; j++ {
|
||||
for i := max(0, j-a.KU); i < min(j+a.KL+1, a.Rows); i++ {
|
||||
t.Data[j+a.KL-i+i*a.Stride] = a.Data[i+t.KU-j+j*t.Stride]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TriangularBandCols represents a symmetric matrix using the band column-major storage scheme.
|
||||
type TriangularBandCols TriangularBand
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, bandwidth and uplo as a and
|
||||
// have adequate backing data storage.
|
||||
func (t TriangularBandCols) From(a TriangularBand) {
|
||||
if t.N != a.N {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.K != a.K {
|
||||
panic("cblas128: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.K+1 {
|
||||
panic("cblas128: short stride for source")
|
||||
}
|
||||
if t.Stride < t.K+1 {
|
||||
panic("cblas128: short stride for destination")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("cblas128: mismatched BLAS uplo")
|
||||
}
|
||||
if t.Diag != a.Diag {
|
||||
panic("cblas128: mismatched BLAS diag")
|
||||
}
|
||||
dst := BandCols{
|
||||
Rows: t.N, Cols: t.N,
|
||||
Stride: t.Stride,
|
||||
Data: t.Data,
|
||||
}
|
||||
src := Band{
|
||||
Rows: a.N, Cols: a.N,
|
||||
Stride: a.Stride,
|
||||
Data: a.Data,
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("cblas128: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
dst.KU = t.K
|
||||
src.KU = a.K
|
||||
case blas.Lower:
|
||||
dst.KL = t.K
|
||||
src.KL = a.K
|
||||
}
|
||||
dst.From(src)
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, bandwidth and uplo as a and
|
||||
// have adequate backing data storage.
|
||||
func (t TriangularBand) From(a TriangularBandCols) {
|
||||
if t.N != a.N {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.K != a.K {
|
||||
panic("cblas128: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.K+1 {
|
||||
panic("cblas128: short stride for source")
|
||||
}
|
||||
if t.Stride < t.K+1 {
|
||||
panic("cblas128: short stride for destination")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("cblas128: mismatched BLAS uplo")
|
||||
}
|
||||
if t.Diag != a.Diag {
|
||||
panic("cblas128: mismatched BLAS diag")
|
||||
}
|
||||
dst := Band{
|
||||
Rows: t.N, Cols: t.N,
|
||||
Stride: t.Stride,
|
||||
Data: t.Data,
|
||||
}
|
||||
src := BandCols{
|
||||
Rows: a.N, Cols: a.N,
|
||||
Stride: a.Stride,
|
||||
Data: a.Data,
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("cblas128: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
dst.KU = t.K
|
||||
src.KU = a.K
|
||||
case blas.Lower:
|
||||
dst.KL = t.K
|
||||
src.KL = a.K
|
||||
}
|
||||
dst.From(src)
|
||||
}
|
||||
|
||||
func min(a, b int) int {
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func max(a, b int) int {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
155
vendor/gonum.org/v1/gonum/blas/cblas128/conv_hermitian.go
generated
vendored
155
vendor/gonum.org/v1/gonum/blas/cblas128/conv_hermitian.go
generated
vendored
|
@ -1,155 +0,0 @@
|
|||
// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.
|
||||
|
||||
// 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 cblas128
|
||||
|
||||
import "gonum.org/v1/gonum/blas"
|
||||
|
||||
// HermitianCols represents a matrix using the conventional column-major storage scheme.
|
||||
type HermitianCols Hermitian
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions and uplo as a and have adequate
|
||||
// backing data storage.
|
||||
func (t HermitianCols) From(a Hermitian) {
|
||||
if t.N != a.N {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("cblas128: mismatched BLAS uplo")
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("cblas128: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := i; j < a.N; j++ {
|
||||
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
|
||||
}
|
||||
}
|
||||
case blas.Lower:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j <= i; j++ {
|
||||
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions and uplo as a and have adequate
|
||||
// backing data storage.
|
||||
func (t Hermitian) From(a HermitianCols) {
|
||||
if t.N != a.N {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("cblas128: mismatched BLAS uplo")
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("cblas128: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := i; j < a.N; j++ {
|
||||
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
|
||||
}
|
||||
}
|
||||
case blas.Lower:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j <= i; j++ {
|
||||
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// HermitianBandCols represents an Hermitian matrix using the band column-major storage scheme.
|
||||
type HermitianBandCols HermitianBand
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, bandwidth and uplo as a and
|
||||
// have adequate backing data storage.
|
||||
func (t HermitianBandCols) From(a HermitianBand) {
|
||||
if t.N != a.N {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.K != a.K {
|
||||
panic("cblas128: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.K+1 {
|
||||
panic("cblas128: short stride for source")
|
||||
}
|
||||
if t.Stride < t.K+1 {
|
||||
panic("cblas128: short stride for destination")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("cblas128: mismatched BLAS uplo")
|
||||
}
|
||||
dst := BandCols{
|
||||
Rows: t.N, Cols: t.N,
|
||||
Stride: t.Stride,
|
||||
Data: t.Data,
|
||||
}
|
||||
src := Band{
|
||||
Rows: a.N, Cols: a.N,
|
||||
Stride: a.Stride,
|
||||
Data: a.Data,
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("cblas128: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
dst.KU = t.K
|
||||
src.KU = a.K
|
||||
case blas.Lower:
|
||||
dst.KL = t.K
|
||||
src.KL = a.K
|
||||
}
|
||||
dst.From(src)
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, bandwidth and uplo as a and
|
||||
// have adequate backing data storage.
|
||||
func (t HermitianBand) From(a HermitianBandCols) {
|
||||
if t.N != a.N {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.K != a.K {
|
||||
panic("cblas128: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.K+1 {
|
||||
panic("cblas128: short stride for source")
|
||||
}
|
||||
if t.Stride < t.K+1 {
|
||||
panic("cblas128: short stride for destination")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("cblas128: mismatched BLAS uplo")
|
||||
}
|
||||
dst := Band{
|
||||
Rows: t.N, Cols: t.N,
|
||||
Stride: t.Stride,
|
||||
Data: t.Data,
|
||||
}
|
||||
src := BandCols{
|
||||
Rows: a.N, Cols: a.N,
|
||||
Stride: a.Stride,
|
||||
Data: a.Data,
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("cblas128: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
dst.KU = t.K
|
||||
src.KU = a.K
|
||||
case blas.Lower:
|
||||
dst.KL = t.K
|
||||
src.KL = a.K
|
||||
}
|
||||
dst.From(src)
|
||||
}
|
155
vendor/gonum.org/v1/gonum/blas/cblas128/conv_symmetric.go
generated
vendored
155
vendor/gonum.org/v1/gonum/blas/cblas128/conv_symmetric.go
generated
vendored
|
@ -1,155 +0,0 @@
|
|||
// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.
|
||||
|
||||
// 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 cblas128
|
||||
|
||||
import "gonum.org/v1/gonum/blas"
|
||||
|
||||
// SymmetricCols represents a matrix using the conventional column-major storage scheme.
|
||||
type SymmetricCols Symmetric
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions and uplo as a and have adequate
|
||||
// backing data storage.
|
||||
func (t SymmetricCols) From(a Symmetric) {
|
||||
if t.N != a.N {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("cblas128: mismatched BLAS uplo")
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("cblas128: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := i; j < a.N; j++ {
|
||||
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
|
||||
}
|
||||
}
|
||||
case blas.Lower:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j <= i; j++ {
|
||||
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions and uplo as a and have adequate
|
||||
// backing data storage.
|
||||
func (t Symmetric) From(a SymmetricCols) {
|
||||
if t.N != a.N {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("cblas128: mismatched BLAS uplo")
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("cblas128: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := i; j < a.N; j++ {
|
||||
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
|
||||
}
|
||||
}
|
||||
case blas.Lower:
|
||||
for i := 0; i < a.N; i++ {
|
||||
for j := 0; j <= i; j++ {
|
||||
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SymmetricBandCols represents a symmetric matrix using the band column-major storage scheme.
|
||||
type SymmetricBandCols SymmetricBand
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, bandwidth and uplo as a and
|
||||
// have adequate backing data storage.
|
||||
func (t SymmetricBandCols) From(a SymmetricBand) {
|
||||
if t.N != a.N {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.K != a.K {
|
||||
panic("cblas128: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.K+1 {
|
||||
panic("cblas128: short stride for source")
|
||||
}
|
||||
if t.Stride < t.K+1 {
|
||||
panic("cblas128: short stride for destination")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("cblas128: mismatched BLAS uplo")
|
||||
}
|
||||
dst := BandCols{
|
||||
Rows: t.N, Cols: t.N,
|
||||
Stride: t.Stride,
|
||||
Data: t.Data,
|
||||
}
|
||||
src := Band{
|
||||
Rows: a.N, Cols: a.N,
|
||||
Stride: a.Stride,
|
||||
Data: a.Data,
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("cblas128: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
dst.KU = t.K
|
||||
src.KU = a.K
|
||||
case blas.Lower:
|
||||
dst.KL = t.K
|
||||
src.KL = a.K
|
||||
}
|
||||
dst.From(src)
|
||||
}
|
||||
|
||||
// From fills the receiver with elements from a. The receiver
|
||||
// must have the same dimensions, bandwidth and uplo as a and
|
||||
// have adequate backing data storage.
|
||||
func (t SymmetricBand) From(a SymmetricBandCols) {
|
||||
if t.N != a.N {
|
||||
panic("cblas128: mismatched dimension")
|
||||
}
|
||||
if t.K != a.K {
|
||||
panic("cblas128: mismatched bandwidth")
|
||||
}
|
||||
if a.Stride < a.K+1 {
|
||||
panic("cblas128: short stride for source")
|
||||
}
|
||||
if t.Stride < t.K+1 {
|
||||
panic("cblas128: short stride for destination")
|
||||
}
|
||||
if t.Uplo != a.Uplo {
|
||||
panic("cblas128: mismatched BLAS uplo")
|
||||
}
|
||||
dst := Band{
|
||||
Rows: t.N, Cols: t.N,
|
||||
Stride: t.Stride,
|
||||
Data: t.Data,
|
||||
}
|
||||
src := BandCols{
|
||||
Rows: a.N, Cols: a.N,
|
||||
Stride: a.Stride,
|
||||
Data: a.Data,
|
||||
}
|
||||
switch a.Uplo {
|
||||
default:
|
||||
panic("cblas128: bad BLAS uplo")
|
||||
case blas.Upper:
|
||||
dst.KU = t.K
|
||||
src.KU = a.K
|
||||
case blas.Lower:
|
||||
dst.KL = t.K
|
||||
src.KL = a.K
|
||||
}
|
||||
dst.From(src)
|
||||
}
|
6
vendor/gonum.org/v1/gonum/blas/cblas128/doc.go
generated
vendored
6
vendor/gonum.org/v1/gonum/blas/cblas128/doc.go
generated
vendored
|
@ -1,6 +0,0 @@
|
|||
// Copyright ©2017 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 cblas128 provides a simple interface to the complex128 BLAS API.
|
||||
package cblas128 // import "gonum.org/v1/gonum/blas/cblas128"
|
159
vendor/gonum.org/v1/gonum/blas/conversions.bash
generated
vendored
159
vendor/gonum.org/v1/gonum/blas/conversions.bash
generated
vendored
|
@ -1,159 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright ©2017 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.
|
||||
|
||||
# Generate code for blas32.
|
||||
echo Generating blas32/conv.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > blas32/conv.go
|
||||
cat blas64/conv.go \
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
\
|
||||
| sed -e 's/blas64/blas32/' \
|
||||
\
|
||||
>> blas32/conv.go
|
||||
|
||||
echo Generating blas32/conv_test.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > blas32/conv_test.go
|
||||
cat blas64/conv_test.go \
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
\
|
||||
| sed -e 's/blas64/blas32/' \
|
||||
-e 's_"math"_math "gonum.org/v1/gonum/internal/math32"_' \
|
||||
\
|
||||
>> blas32/conv_test.go
|
||||
|
||||
echo Generating blas32/conv_symmetric.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > blas32/conv_symmetric.go
|
||||
cat blas64/conv_symmetric.go \
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
\
|
||||
| sed -e 's/blas64/blas32/' \
|
||||
\
|
||||
>> blas32/conv_symmetric.go
|
||||
|
||||
echo Generating blas32/conv_symmetric_test.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > blas32/conv_symmetric_test.go
|
||||
cat blas64/conv_symmetric_test.go \
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
\
|
||||
| sed -e 's/blas64/blas32/' \
|
||||
-e 's_"math"_math "gonum.org/v1/gonum/internal/math32"_' \
|
||||
\
|
||||
>> blas32/conv_symmetric_test.go
|
||||
|
||||
|
||||
# Generate code for cblas128.
|
||||
echo Generating cblas128/conv.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > cblas128/conv.go
|
||||
cat blas64/conv.go \
|
||||
| gofmt -r 'float64 -> complex128' \
|
||||
\
|
||||
| sed -e 's/blas64/cblas128/' \
|
||||
\
|
||||
>> cblas128/conv.go
|
||||
|
||||
echo Generating cblas128/conv_test.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > cblas128/conv_test.go
|
||||
cat blas64/conv_test.go \
|
||||
| gofmt -r 'float64 -> complex128' \
|
||||
\
|
||||
| sed -e 's/blas64/cblas128/' \
|
||||
-e 's_"math"_math "math/cmplx"_' \
|
||||
\
|
||||
>> cblas128/conv_test.go
|
||||
|
||||
echo Generating cblas128/conv_symmetric.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > cblas128/conv_symmetric.go
|
||||
cat blas64/conv_symmetric.go \
|
||||
| gofmt -r 'float64 -> complex128' \
|
||||
\
|
||||
| sed -e 's/blas64/cblas128/' \
|
||||
\
|
||||
>> cblas128/conv_symmetric.go
|
||||
|
||||
echo Generating cblas128/conv_symmetric_test.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > cblas128/conv_symmetric_test.go
|
||||
cat blas64/conv_symmetric_test.go \
|
||||
| gofmt -r 'float64 -> complex128' \
|
||||
\
|
||||
| sed -e 's/blas64/cblas128/' \
|
||||
-e 's_"math"_math "math/cmplx"_' \
|
||||
\
|
||||
>> cblas128/conv_symmetric_test.go
|
||||
|
||||
echo Generating cblas128/conv_hermitian.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > cblas128/conv_hermitian.go
|
||||
cat blas64/conv_symmetric.go \
|
||||
| gofmt -r 'float64 -> complex128' \
|
||||
\
|
||||
| sed -e 's/blas64/cblas128/' \
|
||||
-e 's/Symmetric/Hermitian/g' \
|
||||
-e 's/a symmetric/an Hermitian/g' \
|
||||
-e 's/symmetric/hermitian/g' \
|
||||
-e 's/Sym/Herm/g' \
|
||||
\
|
||||
>> cblas128/conv_hermitian.go
|
||||
|
||||
echo Generating cblas128/conv_hermitian_test.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > cblas128/conv_hermitian_test.go
|
||||
cat blas64/conv_symmetric_test.go \
|
||||
| gofmt -r 'float64 -> complex128' \
|
||||
\
|
||||
| sed -e 's/blas64/cblas128/' \
|
||||
-e 's/Symmetric/Hermitian/g' \
|
||||
-e 's/a symmetric/an Hermitian/g' \
|
||||
-e 's/symmetric/hermitian/g' \
|
||||
-e 's/Sym/Herm/g' \
|
||||
-e 's_"math"_math "math/cmplx"_' \
|
||||
\
|
||||
>> cblas128/conv_hermitian_test.go
|
||||
|
||||
|
||||
# Generate code for cblas64.
|
||||
echo Generating cblas64/conv.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > cblas64/conv.go
|
||||
cat blas64/conv.go \
|
||||
| gofmt -r 'float64 -> complex64' \
|
||||
\
|
||||
| sed -e 's/blas64/cblas64/' \
|
||||
\
|
||||
>> cblas64/conv.go
|
||||
|
||||
echo Generating cblas64/conv_test.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > cblas64/conv_test.go
|
||||
cat blas64/conv_test.go \
|
||||
| gofmt -r 'float64 -> complex64' \
|
||||
\
|
||||
| sed -e 's/blas64/cblas64/' \
|
||||
-e 's_"math"_math "gonum.org/v1/gonum/internal/cmplx64"_' \
|
||||
\
|
||||
>> cblas64/conv_test.go
|
||||
|
||||
echo Generating cblas64/conv_hermitian.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > cblas64/conv_hermitian.go
|
||||
cat blas64/conv_symmetric.go \
|
||||
| gofmt -r 'float64 -> complex64' \
|
||||
\
|
||||
| sed -e 's/blas64/cblas64/' \
|
||||
-e 's/Symmetric/Hermitian/g' \
|
||||
-e 's/a symmetric/an Hermitian/g' \
|
||||
-e 's/symmetric/hermitian/g' \
|
||||
-e 's/Sym/Herm/g' \
|
||||
\
|
||||
>> cblas64/conv_hermitian.go
|
||||
|
||||
echo Generating cblas64/conv_hermitian_test.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.\n' > cblas64/conv_hermitian_test.go
|
||||
cat blas64/conv_symmetric_test.go \
|
||||
| gofmt -r 'float64 -> complex64' \
|
||||
\
|
||||
| sed -e 's/blas64/cblas64/' \
|
||||
-e 's/Symmetric/Hermitian/g' \
|
||||
-e 's/a symmetric/an Hermitian/g' \
|
||||
-e 's/symmetric/hermitian/g' \
|
||||
-e 's/Sym/Herm/g' \
|
||||
-e 's_"math"_math "gonum.org/v1/gonum/internal/cmplx64"_' \
|
||||
\
|
||||
>> cblas64/conv_hermitian_test.go
|
108
vendor/gonum.org/v1/gonum/blas/doc.go
generated
vendored
108
vendor/gonum.org/v1/gonum/blas/doc.go
generated
vendored
|
@ -1,108 +0,0 @@
|
|||
// Copyright ©2017 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 blas provides interfaces for the BLAS linear algebra standard.
|
||||
|
||||
All methods must perform appropriate parameter checking and panic if
|
||||
provided parameters that do not conform to the requirements specified
|
||||
by the BLAS standard.
|
||||
|
||||
Quick Reference Guide to the BLAS from http://www.netlib.org/lapack/lug/node145.html
|
||||
|
||||
This version is modified to remove the "order" option. All matrix operations are
|
||||
on row-order matrices.
|
||||
|
||||
Level 1 BLAS
|
||||
|
||||
dim scalar vector vector scalars 5-element prefixes
|
||||
struct
|
||||
|
||||
_rotg ( a, b ) S, D
|
||||
_rotmg( d1, d2, a, b ) S, D
|
||||
_rot ( n, x, incX, y, incY, c, s ) S, D
|
||||
_rotm ( n, x, incX, y, incY, param ) S, D
|
||||
_swap ( n, x, incX, y, incY ) S, D, C, Z
|
||||
_scal ( n, alpha, x, incX ) S, D, C, Z, Cs, Zd
|
||||
_copy ( n, x, incX, y, incY ) S, D, C, Z
|
||||
_axpy ( n, alpha, x, incX, y, incY ) S, D, C, Z
|
||||
_dot ( n, x, incX, y, incY ) S, D, Ds
|
||||
_dotu ( n, x, incX, y, incY ) C, Z
|
||||
_dotc ( n, x, incX, y, incY ) C, Z
|
||||
__dot ( n, alpha, x, incX, y, incY ) Sds
|
||||
_nrm2 ( n, x, incX ) S, D, Sc, Dz
|
||||
_asum ( n, x, incX ) S, D, Sc, Dz
|
||||
I_amax( n, x, incX ) s, d, c, z
|
||||
|
||||
Level 2 BLAS
|
||||
|
||||
options dim b-width scalar matrix vector scalar vector prefixes
|
||||
|
||||
_gemv ( trans, m, n, alpha, a, lda, x, incX, beta, y, incY ) S, D, C, Z
|
||||
_gbmv ( trans, m, n, kL, kU, alpha, a, lda, x, incX, beta, y, incY ) S, D, C, Z
|
||||
_hemv ( uplo, n, alpha, a, lda, x, incX, beta, y, incY ) C, Z
|
||||
_hbmv ( uplo, n, k, alpha, a, lda, x, incX, beta, y, incY ) C, Z
|
||||
_hpmv ( uplo, n, alpha, ap, x, incX, beta, y, incY ) C, Z
|
||||
_symv ( uplo, n, alpha, a, lda, x, incX, beta, y, incY ) S, D
|
||||
_sbmv ( uplo, n, k, alpha, a, lda, x, incX, beta, y, incY ) S, D
|
||||
_spmv ( uplo, n, alpha, ap, x, incX, beta, y, incY ) S, D
|
||||
_trmv ( uplo, trans, diag, n, a, lda, x, incX ) S, D, C, Z
|
||||
_tbmv ( uplo, trans, diag, n, k, a, lda, x, incX ) S, D, C, Z
|
||||
_tpmv ( uplo, trans, diag, n, ap, x, incX ) S, D, C, Z
|
||||
_trsv ( uplo, trans, diag, n, a, lda, x, incX ) S, D, C, Z
|
||||
_tbsv ( uplo, trans, diag, n, k, a, lda, x, incX ) S, D, C, Z
|
||||
_tpsv ( uplo, trans, diag, n, ap, x, incX ) S, D, C, Z
|
||||
|
||||
options dim scalar vector vector matrix prefixes
|
||||
|
||||
_ger ( m, n, alpha, x, incX, y, incY, a, lda ) S, D
|
||||
_geru ( m, n, alpha, x, incX, y, incY, a, lda ) C, Z
|
||||
_gerc ( m, n, alpha, x, incX, y, incY, a, lda ) C, Z
|
||||
_her ( uplo, n, alpha, x, incX, a, lda ) C, Z
|
||||
_hpr ( uplo, n, alpha, x, incX, ap ) C, Z
|
||||
_her2 ( uplo, n, alpha, x, incX, y, incY, a, lda ) C, Z
|
||||
_hpr2 ( uplo, n, alpha, x, incX, y, incY, ap ) C, Z
|
||||
_syr ( uplo, n, alpha, x, incX, a, lda ) S, D
|
||||
_spr ( uplo, n, alpha, x, incX, ap ) S, D
|
||||
_syr2 ( uplo, n, alpha, x, incX, y, incY, a, lda ) S, D
|
||||
_spr2 ( uplo, n, alpha, x, incX, y, incY, ap ) S, D
|
||||
|
||||
Level 3 BLAS
|
||||
|
||||
options dim scalar matrix matrix scalar matrix prefixes
|
||||
|
||||
_gemm ( transA, transB, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc ) S, D, C, Z
|
||||
_symm ( side, uplo, m, n, alpha, a, lda, b, ldb, beta, c, ldc ) S, D, C, Z
|
||||
_hemm ( side, uplo, m, n, alpha, a, lda, b, ldb, beta, c, ldc ) C, Z
|
||||
_syrk ( uplo, trans, n, k, alpha, a, lda, beta, c, ldc ) S, D, C, Z
|
||||
_herk ( uplo, trans, n, k, alpha, a, lda, beta, c, ldc ) C, Z
|
||||
_syr2k( uplo, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc ) S, D, C, Z
|
||||
_her2k( uplo, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc ) C, Z
|
||||
_trmm ( side, uplo, transA, diag, m, n, alpha, a, lda, b, ldb ) S, D, C, Z
|
||||
_trsm ( side, uplo, transA, diag, m, n, alpha, a, lda, b, ldb ) S, D, C, Z
|
||||
|
||||
Meaning of prefixes
|
||||
|
||||
S - float32 C - complex64
|
||||
D - float64 Z - complex128
|
||||
|
||||
Matrix types
|
||||
|
||||
GE - GEneral GB - General Band
|
||||
SY - SYmmetric SB - Symmetric Band SP - Symmetric Packed
|
||||
HE - HErmitian HB - Hermitian Band HP - Hermitian Packed
|
||||
TR - TRiangular TB - Triangular Band TP - Triangular Packed
|
||||
|
||||
Options
|
||||
|
||||
trans = NoTrans, Trans, ConjTrans
|
||||
uplo = Upper, Lower
|
||||
diag = Nonunit, Unit
|
||||
side = Left, Right (A or op(A) on the left, or A or op(A) on the right)
|
||||
|
||||
For real matrices, Trans and ConjTrans have the same meaning.
|
||||
For Hermitian matrices, trans = Trans is not allowed.
|
||||
For complex symmetric matrices, trans = ConjTrans is not allowed.
|
||||
*/
|
||||
package blas // import "gonum.org/v1/gonum/blas"
|
314
vendor/gonum.org/v1/gonum/blas/gonum/dgemm.go
generated
vendored
314
vendor/gonum.org/v1/gonum/blas/gonum/dgemm.go
generated
vendored
|
@ -1,314 +0,0 @@
|
|||
// Copyright ©2014 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 gonum
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"sync"
|
||||
|
||||
"gonum.org/v1/gonum/blas"
|
||||
"gonum.org/v1/gonum/internal/asm/f64"
|
||||
)
|
||||
|
||||
// Dgemm performs one of the matrix-matrix operations
|
||||
// C = alpha * A * B + beta * C
|
||||
// C = alpha * A^T * B + beta * C
|
||||
// C = alpha * A * B^T + beta * C
|
||||
// C = alpha * A^T * B^T + beta * C
|
||||
// where A is an m×k or k×m dense matrix, B is an n×k or k×n dense matrix, C is
|
||||
// an m×n matrix, and alpha and beta are scalars. tA and tB specify whether A or
|
||||
// B are transposed.
|
||||
func (Implementation) Dgemm(tA, tB blas.Transpose, m, n, k int, alpha float64, a []float64, lda int, b []float64, ldb int, beta float64, c []float64, ldc int) {
|
||||
switch tA {
|
||||
default:
|
||||
panic(badTranspose)
|
||||
case blas.NoTrans, blas.Trans, blas.ConjTrans:
|
||||
}
|
||||
switch tB {
|
||||
default:
|
||||
panic(badTranspose)
|
||||
case blas.NoTrans, blas.Trans, blas.ConjTrans:
|
||||
}
|
||||
if m < 0 {
|
||||
panic(mLT0)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
if k < 0 {
|
||||
panic(kLT0)
|
||||
}
|
||||
aTrans := tA == blas.Trans || tA == blas.ConjTrans
|
||||
if aTrans {
|
||||
if lda < max(1, m) {
|
||||
panic(badLdA)
|
||||
}
|
||||
} else {
|
||||
if lda < max(1, k) {
|
||||
panic(badLdA)
|
||||
}
|
||||
}
|
||||
bTrans := tB == blas.Trans || tB == blas.ConjTrans
|
||||
if bTrans {
|
||||
if ldb < max(1, k) {
|
||||
panic(badLdB)
|
||||
}
|
||||
} else {
|
||||
if ldb < max(1, n) {
|
||||
panic(badLdB)
|
||||
}
|
||||
}
|
||||
if ldc < max(1, n) {
|
||||
panic(badLdC)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if m == 0 || n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// For zero matrix size the following slice length checks are trivially satisfied.
|
||||
if aTrans {
|
||||
if len(a) < (k-1)*lda+m {
|
||||
panic(shortA)
|
||||
}
|
||||
} else {
|
||||
if len(a) < (m-1)*lda+k {
|
||||
panic(shortA)
|
||||
}
|
||||
}
|
||||
if bTrans {
|
||||
if len(b) < (n-1)*ldb+k {
|
||||
panic(shortB)
|
||||
}
|
||||
} else {
|
||||
if len(b) < (k-1)*ldb+n {
|
||||
panic(shortB)
|
||||
}
|
||||
}
|
||||
if len(c) < (m-1)*ldc+n {
|
||||
panic(shortC)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if (alpha == 0 || k == 0) && beta == 1 {
|
||||
return
|
||||
}
|
||||
|
||||
// scale c
|
||||
if beta != 1 {
|
||||
if beta == 0 {
|
||||
for i := 0; i < m; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for i := 0; i < m; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dgemmParallel(aTrans, bTrans, m, n, k, a, lda, b, ldb, c, ldc, alpha)
|
||||
}
|
||||
|
||||
func dgemmParallel(aTrans, bTrans bool, m, n, k int, a []float64, lda int, b []float64, ldb int, c []float64, ldc int, alpha float64) {
|
||||
// dgemmParallel computes a parallel matrix multiplication by partitioning
|
||||
// a and b into sub-blocks, and updating c with the multiplication of the sub-block
|
||||
// In all cases,
|
||||
// A = [ A_11 A_12 ... A_1j
|
||||
// A_21 A_22 ... A_2j
|
||||
// ...
|
||||
// A_i1 A_i2 ... A_ij]
|
||||
//
|
||||
// and same for B. All of the submatrix sizes are blockSize×blockSize except
|
||||
// at the edges.
|
||||
//
|
||||
// In all cases, there is one dimension for each matrix along which
|
||||
// C must be updated sequentially.
|
||||
// Cij = \sum_k Aik Bki, (A * B)
|
||||
// Cij = \sum_k Aki Bkj, (A^T * B)
|
||||
// Cij = \sum_k Aik Bjk, (A * B^T)
|
||||
// Cij = \sum_k Aki Bjk, (A^T * B^T)
|
||||
//
|
||||
// This code computes one {i, j} block sequentially along the k dimension,
|
||||
// and computes all of the {i, j} blocks concurrently. This
|
||||
// partitioning allows Cij to be updated in-place without race-conditions.
|
||||
// Instead of launching a goroutine for each possible concurrent computation,
|
||||
// a number of worker goroutines are created and channels are used to pass
|
||||
// available and completed cases.
|
||||
//
|
||||
// http://alexkr.com/docs/matrixmult.pdf is a good reference on matrix-matrix
|
||||
// multiplies, though this code does not copy matrices to attempt to eliminate
|
||||
// cache misses.
|
||||
|
||||
maxKLen := k
|
||||
parBlocks := blocks(m, blockSize) * blocks(n, blockSize)
|
||||
if parBlocks < minParBlock {
|
||||
// The matrix multiplication is small in the dimensions where it can be
|
||||
// computed concurrently. Just do it in serial.
|
||||
dgemmSerial(aTrans, bTrans, m, n, k, a, lda, b, ldb, c, ldc, alpha)
|
||||
return
|
||||
}
|
||||
|
||||
nWorkers := runtime.GOMAXPROCS(0)
|
||||
if parBlocks < nWorkers {
|
||||
nWorkers = parBlocks
|
||||
}
|
||||
// There is a tradeoff between the workers having to wait for work
|
||||
// and a large buffer making operations slow.
|
||||
buf := buffMul * nWorkers
|
||||
if buf > parBlocks {
|
||||
buf = parBlocks
|
||||
}
|
||||
|
||||
sendChan := make(chan subMul, buf)
|
||||
|
||||
// Launch workers. A worker receives an {i, j} submatrix of c, and computes
|
||||
// A_ik B_ki (or the transposed version) storing the result in c_ij. When the
|
||||
// channel is finally closed, it signals to the waitgroup that it has finished
|
||||
// computing.
|
||||
var wg sync.WaitGroup
|
||||
for i := 0; i < nWorkers; i++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for sub := range sendChan {
|
||||
i := sub.i
|
||||
j := sub.j
|
||||
leni := blockSize
|
||||
if i+leni > m {
|
||||
leni = m - i
|
||||
}
|
||||
lenj := blockSize
|
||||
if j+lenj > n {
|
||||
lenj = n - j
|
||||
}
|
||||
|
||||
cSub := sliceView64(c, ldc, i, j, leni, lenj)
|
||||
|
||||
// Compute A_ik B_kj for all k
|
||||
for k := 0; k < maxKLen; k += blockSize {
|
||||
lenk := blockSize
|
||||
if k+lenk > maxKLen {
|
||||
lenk = maxKLen - k
|
||||
}
|
||||
var aSub, bSub []float64
|
||||
if aTrans {
|
||||
aSub = sliceView64(a, lda, k, i, lenk, leni)
|
||||
} else {
|
||||
aSub = sliceView64(a, lda, i, k, leni, lenk)
|
||||
}
|
||||
if bTrans {
|
||||
bSub = sliceView64(b, ldb, j, k, lenj, lenk)
|
||||
} else {
|
||||
bSub = sliceView64(b, ldb, k, j, lenk, lenj)
|
||||
}
|
||||
dgemmSerial(aTrans, bTrans, leni, lenj, lenk, aSub, lda, bSub, ldb, cSub, ldc, alpha)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// Send out all of the {i, j} subblocks for computation.
|
||||
for i := 0; i < m; i += blockSize {
|
||||
for j := 0; j < n; j += blockSize {
|
||||
sendChan <- subMul{
|
||||
i: i,
|
||||
j: j,
|
||||
}
|
||||
}
|
||||
}
|
||||
close(sendChan)
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
// dgemmSerial is serial matrix multiply
|
||||
func dgemmSerial(aTrans, bTrans bool, m, n, k int, a []float64, lda int, b []float64, ldb int, c []float64, ldc int, alpha float64) {
|
||||
switch {
|
||||
case !aTrans && !bTrans:
|
||||
dgemmSerialNotNot(m, n, k, a, lda, b, ldb, c, ldc, alpha)
|
||||
return
|
||||
case aTrans && !bTrans:
|
||||
dgemmSerialTransNot(m, n, k, a, lda, b, ldb, c, ldc, alpha)
|
||||
return
|
||||
case !aTrans && bTrans:
|
||||
dgemmSerialNotTrans(m, n, k, a, lda, b, ldb, c, ldc, alpha)
|
||||
return
|
||||
case aTrans && bTrans:
|
||||
dgemmSerialTransTrans(m, n, k, a, lda, b, ldb, c, ldc, alpha)
|
||||
return
|
||||
default:
|
||||
panic("unreachable")
|
||||
}
|
||||
}
|
||||
|
||||
// dgemmSerial where neither a nor b are transposed
|
||||
func dgemmSerialNotNot(m, n, k int, a []float64, lda int, b []float64, ldb int, c []float64, ldc int, alpha float64) {
|
||||
// This style is used instead of the literal [i*stride +j]) is used because
|
||||
// approximately 5 times faster as of go 1.3.
|
||||
for i := 0; i < m; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for l, v := range a[i*lda : i*lda+k] {
|
||||
tmp := alpha * v
|
||||
if tmp != 0 {
|
||||
f64.AxpyUnitary(tmp, b[l*ldb:l*ldb+n], ctmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dgemmSerial where neither a is transposed and b is not
|
||||
func dgemmSerialTransNot(m, n, k int, a []float64, lda int, b []float64, ldb int, c []float64, ldc int, alpha float64) {
|
||||
// This style is used instead of the literal [i*stride +j]) is used because
|
||||
// approximately 5 times faster as of go 1.3.
|
||||
for l := 0; l < k; l++ {
|
||||
btmp := b[l*ldb : l*ldb+n]
|
||||
for i, v := range a[l*lda : l*lda+m] {
|
||||
tmp := alpha * v
|
||||
if tmp != 0 {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
f64.AxpyUnitary(tmp, btmp, ctmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dgemmSerial where neither a is not transposed and b is
|
||||
func dgemmSerialNotTrans(m, n, k int, a []float64, lda int, b []float64, ldb int, c []float64, ldc int, alpha float64) {
|
||||
// This style is used instead of the literal [i*stride +j]) is used because
|
||||
// approximately 5 times faster as of go 1.3.
|
||||
for i := 0; i < m; i++ {
|
||||
atmp := a[i*lda : i*lda+k]
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for j := 0; j < n; j++ {
|
||||
ctmp[j] += alpha * f64.DotUnitary(atmp, b[j*ldb:j*ldb+k])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dgemmSerial where both are transposed
|
||||
func dgemmSerialTransTrans(m, n, k int, a []float64, lda int, b []float64, ldb int, c []float64, ldc int, alpha float64) {
|
||||
// This style is used instead of the literal [i*stride +j]) is used because
|
||||
// approximately 5 times faster as of go 1.3.
|
||||
for l := 0; l < k; l++ {
|
||||
for i, v := range a[l*lda : l*lda+m] {
|
||||
tmp := alpha * v
|
||||
if tmp != 0 {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
f64.AxpyInc(tmp, b[l:], ctmp, uintptr(n), uintptr(ldb), 1, 0, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func sliceView64(a []float64, lda, i, j, r, c int) []float64 {
|
||||
return a[i*lda+j : (i+r-1)*lda+j+c]
|
||||
}
|
88
vendor/gonum.org/v1/gonum/blas/gonum/doc.go
generated
vendored
88
vendor/gonum.org/v1/gonum/blas/gonum/doc.go
generated
vendored
|
@ -1,88 +0,0 @@
|
|||
// 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.
|
||||
|
||||
// Ensure changes made to blas/native are reflected in blas/cgo where relevant.
|
||||
|
||||
/*
|
||||
Package gonum is a Go implementation of the BLAS API. This implementation
|
||||
panics when the input arguments are invalid as per the standard, for example
|
||||
if a vector increment is zero. Note that the treatment of NaN values
|
||||
is not specified, and differs among the BLAS implementations.
|
||||
gonum.org/v1/gonum/blas/blas64 provides helpful wrapper functions to the BLAS
|
||||
interface. The rest of this text describes the layout of the data for the input types.
|
||||
|
||||
Note that in the function documentation, x[i] refers to the i^th element
|
||||
of the vector, which will be different from the i^th element of the slice if
|
||||
incX != 1.
|
||||
|
||||
See http://www.netlib.org/lapack/explore-html/d4/de1/_l_i_c_e_n_s_e_source.html
|
||||
for more license information.
|
||||
|
||||
Vector arguments are effectively strided slices. They have two input arguments,
|
||||
a number of elements, n, and an increment, incX. The increment specifies the
|
||||
distance between elements of the vector. The actual Go slice may be longer
|
||||
than necessary.
|
||||
The increment may be positive or negative, except in functions with only
|
||||
a single vector argument where the increment may only be positive. If the increment
|
||||
is negative, s[0] is the last element in the slice. Note that this is not the same
|
||||
as counting backward from the end of the slice, as len(s) may be longer than
|
||||
necessary. So, for example, if n = 5 and incX = 3, the elements of s are
|
||||
[0 * * 1 * * 2 * * 3 * * 4 * * * ...]
|
||||
where ∗ elements are never accessed. If incX = -3, the same elements are
|
||||
accessed, just in reverse order (4, 3, 2, 1, 0).
|
||||
|
||||
Dense matrices are specified by a number of rows, a number of columns, and a stride.
|
||||
The stride specifies the number of entries in the slice between the first element
|
||||
of successive rows. The stride must be at least as large as the number of columns
|
||||
but may be longer.
|
||||
[a00 ... a0n a0* ... a1stride-1 a21 ... amn am* ... amstride-1]
|
||||
Thus, dense[i*ld + j] refers to the {i, j}th element of the matrix.
|
||||
|
||||
Symmetric and triangular matrices (non-packed) are stored identically to Dense,
|
||||
except that only elements in one triangle of the matrix are accessed.
|
||||
|
||||
Packed symmetric and packed triangular matrices are laid out with the entries
|
||||
condensed such that all of the unreferenced elements are removed. So, the upper triangular
|
||||
matrix
|
||||
[
|
||||
1 2 3
|
||||
0 4 5
|
||||
0 0 6
|
||||
]
|
||||
and the lower-triangular matrix
|
||||
[
|
||||
1 0 0
|
||||
2 3 0
|
||||
4 5 6
|
||||
]
|
||||
will both be compacted as [1 2 3 4 5 6]. The (i, j) element of the original
|
||||
dense matrix can be found at element i*n - (i-1)*i/2 + j for upper triangular,
|
||||
and at element i * (i+1) /2 + j for lower triangular.
|
||||
|
||||
Banded matrices are laid out in a compact format, constructed by removing the
|
||||
zeros in the rows and aligning the diagonals. For example, the matrix
|
||||
[
|
||||
1 2 3 0 0 0
|
||||
4 5 6 7 0 0
|
||||
0 8 9 10 11 0
|
||||
0 0 12 13 14 15
|
||||
0 0 0 16 17 18
|
||||
0 0 0 0 19 20
|
||||
]
|
||||
|
||||
implicitly becomes (∗ entries are never accessed)
|
||||
[
|
||||
* 1 2 3
|
||||
4 5 6 7
|
||||
8 9 10 11
|
||||
12 13 14 15
|
||||
16 17 18 *
|
||||
19 20 * *
|
||||
]
|
||||
which is given to the BLAS routine as [∗ 1 2 3 4 ...].
|
||||
|
||||
See http://www.crest.iu.edu/research/mtl/reference/html/banded.html
|
||||
for more information
|
||||
*/
|
||||
package gonum // import "gonum.org/v1/gonum/blas/gonum"
|
35
vendor/gonum.org/v1/gonum/blas/gonum/errors.go
generated
vendored
35
vendor/gonum.org/v1/gonum/blas/gonum/errors.go
generated
vendored
|
@ -1,35 +0,0 @@
|
|||
// 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 gonum
|
||||
|
||||
// Panic strings used during parameter checks.
|
||||
// This list is duplicated in netlib/blas/netlib. Keep in sync.
|
||||
const (
|
||||
zeroIncX = "blas: zero x index increment"
|
||||
zeroIncY = "blas: zero y index increment"
|
||||
|
||||
mLT0 = "blas: m < 0"
|
||||
nLT0 = "blas: n < 0"
|
||||
kLT0 = "blas: k < 0"
|
||||
kLLT0 = "blas: kL < 0"
|
||||
kULT0 = "blas: kU < 0"
|
||||
|
||||
badUplo = "blas: illegal triangle"
|
||||
badTranspose = "blas: illegal transpose"
|
||||
badDiag = "blas: illegal diagonal"
|
||||
badSide = "blas: illegal side"
|
||||
badFlag = "blas: illegal rotm flag"
|
||||
|
||||
badLdA = "blas: bad leading dimension of A"
|
||||
badLdB = "blas: bad leading dimension of B"
|
||||
badLdC = "blas: bad leading dimension of C"
|
||||
|
||||
shortX = "blas: insufficient length of x"
|
||||
shortY = "blas: insufficient length of y"
|
||||
shortAP = "blas: insufficient length of ap"
|
||||
shortA = "blas: insufficient length of a"
|
||||
shortB = "blas: insufficient length of b"
|
||||
shortC = "blas: insufficient length of c"
|
||||
)
|
190
vendor/gonum.org/v1/gonum/blas/gonum/gemv.go
generated
vendored
190
vendor/gonum.org/v1/gonum/blas/gonum/gemv.go
generated
vendored
|
@ -1,190 +0,0 @@
|
|||
// Copyright ©2018 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 gonum
|
||||
|
||||
import (
|
||||
"gonum.org/v1/gonum/blas"
|
||||
"gonum.org/v1/gonum/internal/asm/f32"
|
||||
"gonum.org/v1/gonum/internal/asm/f64"
|
||||
)
|
||||
|
||||
// TODO(Kunde21): Merge these methods back into level2double/level2single when Sgemv assembly kernels are merged into f32.
|
||||
|
||||
// Dgemv computes
|
||||
// y = alpha * A * x + beta * y if tA = blas.NoTrans
|
||||
// y = alpha * A^T * x + beta * y if tA = blas.Trans or blas.ConjTrans
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha and beta are scalars.
|
||||
func (Implementation) Dgemv(tA blas.Transpose, m, n int, alpha float64, a []float64, lda int, x []float64, incX int, beta float64, y []float64, incY int) {
|
||||
if tA != blas.NoTrans && tA != blas.Trans && tA != blas.ConjTrans {
|
||||
panic(badTranspose)
|
||||
}
|
||||
if m < 0 {
|
||||
panic(mLT0)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
if lda < max(1, n) {
|
||||
panic(badLdA)
|
||||
}
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
// Set up indexes
|
||||
lenX := m
|
||||
lenY := n
|
||||
if tA == blas.NoTrans {
|
||||
lenX = n
|
||||
lenY = m
|
||||
}
|
||||
|
||||
// Quick return if possible
|
||||
if m == 0 || n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if (incX > 0 && (lenX-1)*incX >= len(x)) || (incX < 0 && (1-lenX)*incX >= len(x)) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && (lenY-1)*incY >= len(y)) || (incY < 0 && (1-lenY)*incY >= len(y)) {
|
||||
panic(shortY)
|
||||
}
|
||||
if len(a) < lda*(m-1)+n {
|
||||
panic(shortA)
|
||||
}
|
||||
|
||||
// Quick return if possible
|
||||
if alpha == 0 && beta == 1 {
|
||||
return
|
||||
}
|
||||
|
||||
if alpha == 0 {
|
||||
// First form y = beta * y
|
||||
if incY > 0 {
|
||||
Implementation{}.Dscal(lenY, beta, y, incY)
|
||||
} else {
|
||||
Implementation{}.Dscal(lenY, beta, y, -incY)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Form y = alpha * A * x + y
|
||||
if tA == blas.NoTrans {
|
||||
f64.GemvN(uintptr(m), uintptr(n), alpha, a, uintptr(lda), x, uintptr(incX), beta, y, uintptr(incY))
|
||||
return
|
||||
}
|
||||
// Cases where a is transposed.
|
||||
f64.GemvT(uintptr(m), uintptr(n), alpha, a, uintptr(lda), x, uintptr(incX), beta, y, uintptr(incY))
|
||||
}
|
||||
|
||||
// Sgemv computes
|
||||
// y = alpha * A * x + beta * y if tA = blas.NoTrans
|
||||
// y = alpha * A^T * x + beta * y if tA = blas.Trans or blas.ConjTrans
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha and beta are scalars.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Sgemv(tA blas.Transpose, m, n int, alpha float32, a []float32, lda int, x []float32, incX int, beta float32, y []float32, incY int) {
|
||||
if tA != blas.NoTrans && tA != blas.Trans && tA != blas.ConjTrans {
|
||||
panic(badTranspose)
|
||||
}
|
||||
if m < 0 {
|
||||
panic(mLT0)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
if lda < max(1, n) {
|
||||
panic(badLdA)
|
||||
}
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if m == 0 || n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// Set up indexes
|
||||
lenX := m
|
||||
lenY := n
|
||||
if tA == blas.NoTrans {
|
||||
lenX = n
|
||||
lenY = m
|
||||
}
|
||||
if (incX > 0 && (lenX-1)*incX >= len(x)) || (incX < 0 && (1-lenX)*incX >= len(x)) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && (lenY-1)*incY >= len(y)) || (incY < 0 && (1-lenY)*incY >= len(y)) {
|
||||
panic(shortY)
|
||||
}
|
||||
if len(a) < lda*(m-1)+n {
|
||||
panic(shortA)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if alpha == 0 && beta == 1 {
|
||||
return
|
||||
}
|
||||
|
||||
// First form y = beta * y
|
||||
if incY > 0 {
|
||||
Implementation{}.Sscal(lenY, beta, y, incY)
|
||||
} else {
|
||||
Implementation{}.Sscal(lenY, beta, y, -incY)
|
||||
}
|
||||
|
||||
if alpha == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
var kx, ky int
|
||||
if incX < 0 {
|
||||
kx = -(lenX - 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
ky = -(lenY - 1) * incY
|
||||
}
|
||||
|
||||
// Form y = alpha * A * x + y
|
||||
if tA == blas.NoTrans {
|
||||
if incX == 1 && incY == 1 {
|
||||
for i := 0; i < m; i++ {
|
||||
y[i] += alpha * f32.DotUnitary(a[lda*i:lda*i+n], x[:n])
|
||||
}
|
||||
return
|
||||
}
|
||||
iy := ky
|
||||
for i := 0; i < m; i++ {
|
||||
y[iy] += alpha * f32.DotInc(x, a[lda*i:lda*i+n], uintptr(n), uintptr(incX), 1, uintptr(kx), 0)
|
||||
iy += incY
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is transposed.
|
||||
if incX == 1 && incY == 1 {
|
||||
for i := 0; i < m; i++ {
|
||||
tmp := alpha * x[i]
|
||||
if tmp != 0 {
|
||||
f32.AxpyUnitaryTo(y, tmp, a[lda*i:lda*i+n], y[:n])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
ix := kx
|
||||
for i := 0; i < m; i++ {
|
||||
tmp := alpha * x[ix]
|
||||
if tmp != 0 {
|
||||
f32.AxpyInc(tmp, a[lda*i:lda*i+n], y, uintptr(n), 1, uintptr(incY), 0, uintptr(ky))
|
||||
}
|
||||
ix += incX
|
||||
}
|
||||
}
|
58
vendor/gonum.org/v1/gonum/blas/gonum/gonum.go
generated
vendored
58
vendor/gonum.org/v1/gonum/blas/gonum/gonum.go
generated
vendored
|
@ -1,58 +0,0 @@
|
|||
// 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.
|
||||
|
||||
//go:generate ./single_precision.bash
|
||||
|
||||
package gonum
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
"gonum.org/v1/gonum/internal/math32"
|
||||
)
|
||||
|
||||
type Implementation struct{}
|
||||
|
||||
// [SD]gemm behavior constants. These are kept here to keep them out of the
|
||||
// way during single precision code genration.
|
||||
const (
|
||||
blockSize = 64 // b x b matrix
|
||||
minParBlock = 4 // minimum number of blocks needed to go parallel
|
||||
buffMul = 4 // how big is the buffer relative to the number of workers
|
||||
)
|
||||
|
||||
// subMul is a common type shared by [SD]gemm.
|
||||
type subMul struct {
|
||||
i, j int // index of block
|
||||
}
|
||||
|
||||
func max(a, b int) int {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func min(a, b int) int {
|
||||
if a > b {
|
||||
return b
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
// blocks returns the number of divisions of the dimension length with the given
|
||||
// block size.
|
||||
func blocks(dim, bsize int) int {
|
||||
return (dim + bsize - 1) / bsize
|
||||
}
|
||||
|
||||
// dcabs1 returns |real(z)|+|imag(z)|.
|
||||
func dcabs1(z complex128) float64 {
|
||||
return math.Abs(real(z)) + math.Abs(imag(z))
|
||||
}
|
||||
|
||||
// scabs1 returns |real(z)|+|imag(z)|.
|
||||
func scabs1(z complex64) float32 {
|
||||
return math32.Abs(real(z)) + math32.Abs(imag(z))
|
||||
}
|
445
vendor/gonum.org/v1/gonum/blas/gonum/level1cmplx128.go
generated
vendored
445
vendor/gonum.org/v1/gonum/blas/gonum/level1cmplx128.go
generated
vendored
|
@ -1,445 +0,0 @@
|
|||
// Copyright ©2017 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 gonum
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
"gonum.org/v1/gonum/blas"
|
||||
"gonum.org/v1/gonum/internal/asm/c128"
|
||||
)
|
||||
|
||||
var _ blas.Complex128Level1 = Implementation{}
|
||||
|
||||
// Dzasum returns the sum of the absolute values of the elements of x
|
||||
// \sum_i |Re(x[i])| + |Im(x[i])|
|
||||
// Dzasum returns 0 if incX is negative.
|
||||
func (Implementation) Dzasum(n int, x []complex128, incX int) float64 {
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
var sum float64
|
||||
if incX == 1 {
|
||||
if len(x) < n {
|
||||
panic(shortX)
|
||||
}
|
||||
for _, v := range x[:n] {
|
||||
sum += dcabs1(v)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
if (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
v := x[i*incX]
|
||||
sum += dcabs1(v)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
// Dznrm2 computes the Euclidean norm of the complex vector x,
|
||||
// ‖x‖_2 = sqrt(\sum_i x[i] * conj(x[i])).
|
||||
// This function returns 0 if incX is negative.
|
||||
func (Implementation) Dznrm2(n int, x []complex128, incX int) float64 {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return 0
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
var (
|
||||
scale float64
|
||||
ssq float64 = 1
|
||||
)
|
||||
if incX == 1 {
|
||||
for _, v := range x[:n] {
|
||||
re, im := math.Abs(real(v)), math.Abs(imag(v))
|
||||
if re != 0 {
|
||||
if re > scale {
|
||||
ssq = 1 + ssq*(scale/re)*(scale/re)
|
||||
scale = re
|
||||
} else {
|
||||
ssq += (re / scale) * (re / scale)
|
||||
}
|
||||
}
|
||||
if im != 0 {
|
||||
if im > scale {
|
||||
ssq = 1 + ssq*(scale/im)*(scale/im)
|
||||
scale = im
|
||||
} else {
|
||||
ssq += (im / scale) * (im / scale)
|
||||
}
|
||||
}
|
||||
}
|
||||
if math.IsInf(scale, 1) {
|
||||
return math.Inf(1)
|
||||
}
|
||||
return scale * math.Sqrt(ssq)
|
||||
}
|
||||
for ix := 0; ix < n*incX; ix += incX {
|
||||
re, im := math.Abs(real(x[ix])), math.Abs(imag(x[ix]))
|
||||
if re != 0 {
|
||||
if re > scale {
|
||||
ssq = 1 + ssq*(scale/re)*(scale/re)
|
||||
scale = re
|
||||
} else {
|
||||
ssq += (re / scale) * (re / scale)
|
||||
}
|
||||
}
|
||||
if im != 0 {
|
||||
if im > scale {
|
||||
ssq = 1 + ssq*(scale/im)*(scale/im)
|
||||
scale = im
|
||||
} else {
|
||||
ssq += (im / scale) * (im / scale)
|
||||
}
|
||||
}
|
||||
}
|
||||
if math.IsInf(scale, 1) {
|
||||
return math.Inf(1)
|
||||
}
|
||||
return scale * math.Sqrt(ssq)
|
||||
}
|
||||
|
||||
// Izamax returns the index of the first element of x having largest |Re(·)|+|Im(·)|.
|
||||
// Izamax returns -1 if n is 0 or incX is negative.
|
||||
func (Implementation) Izamax(n int, x []complex128, incX int) int {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
// Return invalid index.
|
||||
return -1
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
// Return invalid index.
|
||||
return -1
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if len(x) <= (n-1)*incX {
|
||||
panic(shortX)
|
||||
}
|
||||
idx := 0
|
||||
max := dcabs1(x[0])
|
||||
if incX == 1 {
|
||||
for i, v := range x[1:n] {
|
||||
absV := dcabs1(v)
|
||||
if absV > max {
|
||||
max = absV
|
||||
idx = i + 1
|
||||
}
|
||||
}
|
||||
return idx
|
||||
}
|
||||
ix := incX
|
||||
for i := 1; i < n; i++ {
|
||||
absV := dcabs1(x[ix])
|
||||
if absV > max {
|
||||
max = absV
|
||||
idx = i
|
||||
}
|
||||
ix += incX
|
||||
}
|
||||
return idx
|
||||
}
|
||||
|
||||
// Zaxpy adds alpha times x to y:
|
||||
// y[i] += alpha * x[i] for all i
|
||||
func (Implementation) Zaxpy(n int, alpha complex128, x []complex128, incX int, y []complex128, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && (n-1)*incY >= len(y)) || (incY < 0 && (1-n)*incY >= len(y)) {
|
||||
panic(shortY)
|
||||
}
|
||||
if alpha == 0 {
|
||||
return
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
c128.AxpyUnitary(alpha, x[:n], y[:n])
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (1 - n) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (1 - n) * incY
|
||||
}
|
||||
c128.AxpyInc(alpha, x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
|
||||
}
|
||||
|
||||
// Zcopy copies the vector x to vector y.
|
||||
func (Implementation) Zcopy(n int, x []complex128, incX int, y []complex128, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && (n-1)*incY >= len(y)) || (incY < 0 && (1-n)*incY >= len(y)) {
|
||||
panic(shortY)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
copy(y[:n], x[:n])
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
y[iy] = x[ix]
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
}
|
||||
|
||||
// Zdotc computes the dot product
|
||||
// x^H · y
|
||||
// of two complex vectors x and y.
|
||||
func (Implementation) Zdotc(n int, x []complex128, incX int, y []complex128, incY int) complex128 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n <= 0 {
|
||||
if n == 0 {
|
||||
return 0
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
if len(x) < n {
|
||||
panic(shortX)
|
||||
}
|
||||
if len(y) < n {
|
||||
panic(shortY)
|
||||
}
|
||||
return c128.DotcUnitary(x[:n], y[:n])
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
if ix >= len(x) || (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if iy >= len(y) || (n-1)*incY >= len(y) {
|
||||
panic(shortY)
|
||||
}
|
||||
return c128.DotcInc(x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
|
||||
}
|
||||
|
||||
// Zdotu computes the dot product
|
||||
// x^T · y
|
||||
// of two complex vectors x and y.
|
||||
func (Implementation) Zdotu(n int, x []complex128, incX int, y []complex128, incY int) complex128 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n <= 0 {
|
||||
if n == 0 {
|
||||
return 0
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
if len(x) < n {
|
||||
panic(shortX)
|
||||
}
|
||||
if len(y) < n {
|
||||
panic(shortY)
|
||||
}
|
||||
return c128.DotuUnitary(x[:n], y[:n])
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
if ix >= len(x) || (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if iy >= len(y) || (n-1)*incY >= len(y) {
|
||||
panic(shortY)
|
||||
}
|
||||
return c128.DotuInc(x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
|
||||
}
|
||||
|
||||
// Zdscal scales the vector x by a real scalar alpha.
|
||||
// Zdscal has no effect if incX < 0.
|
||||
func (Implementation) Zdscal(n int, alpha float64, x []complex128, incX int) {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if alpha == 0 {
|
||||
if incX == 1 {
|
||||
x = x[:n]
|
||||
for i := range x {
|
||||
x[i] = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
for ix := 0; ix < n*incX; ix += incX {
|
||||
x[ix] = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
if incX == 1 {
|
||||
x = x[:n]
|
||||
for i, v := range x {
|
||||
x[i] = complex(alpha*real(v), alpha*imag(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
for ix := 0; ix < n*incX; ix += incX {
|
||||
v := x[ix]
|
||||
x[ix] = complex(alpha*real(v), alpha*imag(v))
|
||||
}
|
||||
}
|
||||
|
||||
// Zscal scales the vector x by a complex scalar alpha.
|
||||
// Zscal has no effect if incX < 0.
|
||||
func (Implementation) Zscal(n int, alpha complex128, x []complex128, incX int) {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if alpha == 0 {
|
||||
if incX == 1 {
|
||||
x = x[:n]
|
||||
for i := range x {
|
||||
x[i] = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
for ix := 0; ix < n*incX; ix += incX {
|
||||
x[ix] = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
if incX == 1 {
|
||||
c128.ScalUnitary(alpha, x[:n])
|
||||
return
|
||||
}
|
||||
c128.ScalInc(alpha, x, uintptr(n), uintptr(incX))
|
||||
}
|
||||
|
||||
// Zswap exchanges the elements of two complex vectors x and y.
|
||||
func (Implementation) Zswap(n int, x []complex128, incX int, y []complex128, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && (n-1)*incY >= len(y)) || (incY < 0 && (1-n)*incY >= len(y)) {
|
||||
panic(shortY)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
x = x[:n]
|
||||
for i, v := range x {
|
||||
x[i], y[i] = y[i], v
|
||||
}
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
x[ix], y[iy] = y[iy], x[ix]
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
}
|
467
vendor/gonum.org/v1/gonum/blas/gonum/level1cmplx64.go
generated
vendored
467
vendor/gonum.org/v1/gonum/blas/gonum/level1cmplx64.go
generated
vendored
|
@ -1,467 +0,0 @@
|
|||
// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.
|
||||
|
||||
// Copyright ©2017 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 gonum
|
||||
|
||||
import (
|
||||
math "gonum.org/v1/gonum/internal/math32"
|
||||
|
||||
"gonum.org/v1/gonum/blas"
|
||||
"gonum.org/v1/gonum/internal/asm/c64"
|
||||
)
|
||||
|
||||
var _ blas.Complex64Level1 = Implementation{}
|
||||
|
||||
// Scasum returns the sum of the absolute values of the elements of x
|
||||
// \sum_i |Re(x[i])| + |Im(x[i])|
|
||||
// Scasum returns 0 if incX is negative.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Scasum(n int, x []complex64, incX int) float32 {
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
var sum float32
|
||||
if incX == 1 {
|
||||
if len(x) < n {
|
||||
panic(shortX)
|
||||
}
|
||||
for _, v := range x[:n] {
|
||||
sum += scabs1(v)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
if (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
v := x[i*incX]
|
||||
sum += scabs1(v)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
// Scnrm2 computes the Euclidean norm of the complex vector x,
|
||||
// ‖x‖_2 = sqrt(\sum_i x[i] * conj(x[i])).
|
||||
// This function returns 0 if incX is negative.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Scnrm2(n int, x []complex64, incX int) float32 {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return 0
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
var (
|
||||
scale float32
|
||||
ssq float32 = 1
|
||||
)
|
||||
if incX == 1 {
|
||||
for _, v := range x[:n] {
|
||||
re, im := math.Abs(real(v)), math.Abs(imag(v))
|
||||
if re != 0 {
|
||||
if re > scale {
|
||||
ssq = 1 + ssq*(scale/re)*(scale/re)
|
||||
scale = re
|
||||
} else {
|
||||
ssq += (re / scale) * (re / scale)
|
||||
}
|
||||
}
|
||||
if im != 0 {
|
||||
if im > scale {
|
||||
ssq = 1 + ssq*(scale/im)*(scale/im)
|
||||
scale = im
|
||||
} else {
|
||||
ssq += (im / scale) * (im / scale)
|
||||
}
|
||||
}
|
||||
}
|
||||
if math.IsInf(scale, 1) {
|
||||
return math.Inf(1)
|
||||
}
|
||||
return scale * math.Sqrt(ssq)
|
||||
}
|
||||
for ix := 0; ix < n*incX; ix += incX {
|
||||
re, im := math.Abs(real(x[ix])), math.Abs(imag(x[ix]))
|
||||
if re != 0 {
|
||||
if re > scale {
|
||||
ssq = 1 + ssq*(scale/re)*(scale/re)
|
||||
scale = re
|
||||
} else {
|
||||
ssq += (re / scale) * (re / scale)
|
||||
}
|
||||
}
|
||||
if im != 0 {
|
||||
if im > scale {
|
||||
ssq = 1 + ssq*(scale/im)*(scale/im)
|
||||
scale = im
|
||||
} else {
|
||||
ssq += (im / scale) * (im / scale)
|
||||
}
|
||||
}
|
||||
}
|
||||
if math.IsInf(scale, 1) {
|
||||
return math.Inf(1)
|
||||
}
|
||||
return scale * math.Sqrt(ssq)
|
||||
}
|
||||
|
||||
// Icamax returns the index of the first element of x having largest |Re(·)|+|Im(·)|.
|
||||
// Icamax returns -1 if n is 0 or incX is negative.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Icamax(n int, x []complex64, incX int) int {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
// Return invalid index.
|
||||
return -1
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
// Return invalid index.
|
||||
return -1
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if len(x) <= (n-1)*incX {
|
||||
panic(shortX)
|
||||
}
|
||||
idx := 0
|
||||
max := scabs1(x[0])
|
||||
if incX == 1 {
|
||||
for i, v := range x[1:n] {
|
||||
absV := scabs1(v)
|
||||
if absV > max {
|
||||
max = absV
|
||||
idx = i + 1
|
||||
}
|
||||
}
|
||||
return idx
|
||||
}
|
||||
ix := incX
|
||||
for i := 1; i < n; i++ {
|
||||
absV := scabs1(x[ix])
|
||||
if absV > max {
|
||||
max = absV
|
||||
idx = i
|
||||
}
|
||||
ix += incX
|
||||
}
|
||||
return idx
|
||||
}
|
||||
|
||||
// Caxpy adds alpha times x to y:
|
||||
// y[i] += alpha * x[i] for all i
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Caxpy(n int, alpha complex64, x []complex64, incX int, y []complex64, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && (n-1)*incY >= len(y)) || (incY < 0 && (1-n)*incY >= len(y)) {
|
||||
panic(shortY)
|
||||
}
|
||||
if alpha == 0 {
|
||||
return
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
c64.AxpyUnitary(alpha, x[:n], y[:n])
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (1 - n) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (1 - n) * incY
|
||||
}
|
||||
c64.AxpyInc(alpha, x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
|
||||
}
|
||||
|
||||
// Ccopy copies the vector x to vector y.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Ccopy(n int, x []complex64, incX int, y []complex64, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && (n-1)*incY >= len(y)) || (incY < 0 && (1-n)*incY >= len(y)) {
|
||||
panic(shortY)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
copy(y[:n], x[:n])
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
y[iy] = x[ix]
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
}
|
||||
|
||||
// Cdotc computes the dot product
|
||||
// x^H · y
|
||||
// of two complex vectors x and y.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Cdotc(n int, x []complex64, incX int, y []complex64, incY int) complex64 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n <= 0 {
|
||||
if n == 0 {
|
||||
return 0
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
if len(x) < n {
|
||||
panic(shortX)
|
||||
}
|
||||
if len(y) < n {
|
||||
panic(shortY)
|
||||
}
|
||||
return c64.DotcUnitary(x[:n], y[:n])
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
if ix >= len(x) || (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if iy >= len(y) || (n-1)*incY >= len(y) {
|
||||
panic(shortY)
|
||||
}
|
||||
return c64.DotcInc(x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
|
||||
}
|
||||
|
||||
// Cdotu computes the dot product
|
||||
// x^T · y
|
||||
// of two complex vectors x and y.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Cdotu(n int, x []complex64, incX int, y []complex64, incY int) complex64 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n <= 0 {
|
||||
if n == 0 {
|
||||
return 0
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
if len(x) < n {
|
||||
panic(shortX)
|
||||
}
|
||||
if len(y) < n {
|
||||
panic(shortY)
|
||||
}
|
||||
return c64.DotuUnitary(x[:n], y[:n])
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
if ix >= len(x) || (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if iy >= len(y) || (n-1)*incY >= len(y) {
|
||||
panic(shortY)
|
||||
}
|
||||
return c64.DotuInc(x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
|
||||
}
|
||||
|
||||
// Csscal scales the vector x by a real scalar alpha.
|
||||
// Csscal has no effect if incX < 0.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Csscal(n int, alpha float32, x []complex64, incX int) {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if alpha == 0 {
|
||||
if incX == 1 {
|
||||
x = x[:n]
|
||||
for i := range x {
|
||||
x[i] = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
for ix := 0; ix < n*incX; ix += incX {
|
||||
x[ix] = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
if incX == 1 {
|
||||
x = x[:n]
|
||||
for i, v := range x {
|
||||
x[i] = complex(alpha*real(v), alpha*imag(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
for ix := 0; ix < n*incX; ix += incX {
|
||||
v := x[ix]
|
||||
x[ix] = complex(alpha*real(v), alpha*imag(v))
|
||||
}
|
||||
}
|
||||
|
||||
// Cscal scales the vector x by a complex scalar alpha.
|
||||
// Cscal has no effect if incX < 0.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Cscal(n int, alpha complex64, x []complex64, incX int) {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if alpha == 0 {
|
||||
if incX == 1 {
|
||||
x = x[:n]
|
||||
for i := range x {
|
||||
x[i] = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
for ix := 0; ix < n*incX; ix += incX {
|
||||
x[ix] = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
if incX == 1 {
|
||||
c64.ScalUnitary(alpha, x[:n])
|
||||
return
|
||||
}
|
||||
c64.ScalInc(alpha, x, uintptr(n), uintptr(incX))
|
||||
}
|
||||
|
||||
// Cswap exchanges the elements of two complex vectors x and y.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Cswap(n int, x []complex64, incX int, y []complex64, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && (n-1)*incY >= len(y)) || (incY < 0 && (1-n)*incY >= len(y)) {
|
||||
panic(shortY)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
x = x[:n]
|
||||
for i, v := range x {
|
||||
x[i], y[i] = y[i], v
|
||||
}
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
x[ix], y[iy] = y[iy], x[ix]
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
}
|
644
vendor/gonum.org/v1/gonum/blas/gonum/level1float32.go
generated
vendored
644
vendor/gonum.org/v1/gonum/blas/gonum/level1float32.go
generated
vendored
|
@ -1,644 +0,0 @@
|
|||
// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.
|
||||
|
||||
// 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 gonum
|
||||
|
||||
import (
|
||||
math "gonum.org/v1/gonum/internal/math32"
|
||||
|
||||
"gonum.org/v1/gonum/blas"
|
||||
"gonum.org/v1/gonum/internal/asm/f32"
|
||||
)
|
||||
|
||||
var _ blas.Float32Level1 = Implementation{}
|
||||
|
||||
// Snrm2 computes the Euclidean norm of a vector,
|
||||
// sqrt(\sum_i x[i] * x[i]).
|
||||
// This function returns 0 if incX is negative.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Snrm2(n int, x []float32, incX int) float32 {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
if len(x) <= (n-1)*incX {
|
||||
panic(shortX)
|
||||
}
|
||||
if n < 2 {
|
||||
if n == 1 {
|
||||
return math.Abs(x[0])
|
||||
}
|
||||
if n == 0 {
|
||||
return 0
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
var (
|
||||
scale float32 = 0
|
||||
sumSquares float32 = 1
|
||||
)
|
||||
if incX == 1 {
|
||||
x = x[:n]
|
||||
for _, v := range x {
|
||||
if v == 0 {
|
||||
continue
|
||||
}
|
||||
absxi := math.Abs(v)
|
||||
if math.IsNaN(absxi) {
|
||||
return math.NaN()
|
||||
}
|
||||
if scale < absxi {
|
||||
sumSquares = 1 + sumSquares*(scale/absxi)*(scale/absxi)
|
||||
scale = absxi
|
||||
} else {
|
||||
sumSquares = sumSquares + (absxi/scale)*(absxi/scale)
|
||||
}
|
||||
}
|
||||
if math.IsInf(scale, 1) {
|
||||
return math.Inf(1)
|
||||
}
|
||||
return scale * math.Sqrt(sumSquares)
|
||||
}
|
||||
for ix := 0; ix < n*incX; ix += incX {
|
||||
val := x[ix]
|
||||
if val == 0 {
|
||||
continue
|
||||
}
|
||||
absxi := math.Abs(val)
|
||||
if math.IsNaN(absxi) {
|
||||
return math.NaN()
|
||||
}
|
||||
if scale < absxi {
|
||||
sumSquares = 1 + sumSquares*(scale/absxi)*(scale/absxi)
|
||||
scale = absxi
|
||||
} else {
|
||||
sumSquares = sumSquares + (absxi/scale)*(absxi/scale)
|
||||
}
|
||||
}
|
||||
if math.IsInf(scale, 1) {
|
||||
return math.Inf(1)
|
||||
}
|
||||
return scale * math.Sqrt(sumSquares)
|
||||
}
|
||||
|
||||
// Sasum computes the sum of the absolute values of the elements of x.
|
||||
// \sum_i |x[i]|
|
||||
// Sasum returns 0 if incX is negative.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Sasum(n int, x []float32, incX int) float32 {
|
||||
var sum float32
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
if len(x) <= (n-1)*incX {
|
||||
panic(shortX)
|
||||
}
|
||||
if incX == 1 {
|
||||
x = x[:n]
|
||||
for _, v := range x {
|
||||
sum += math.Abs(v)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
sum += math.Abs(x[i*incX])
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
// Isamax returns the index of an element of x with the largest absolute value.
|
||||
// If there are multiple such indices the earliest is returned.
|
||||
// Isamax returns -1 if n == 0.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Isamax(n int, x []float32, incX int) int {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return -1
|
||||
}
|
||||
if len(x) <= (n-1)*incX {
|
||||
panic(shortX)
|
||||
}
|
||||
if n < 2 {
|
||||
if n == 1 {
|
||||
return 0
|
||||
}
|
||||
if n == 0 {
|
||||
return -1 // Netlib returns invalid index when n == 0.
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
idx := 0
|
||||
max := math.Abs(x[0])
|
||||
if incX == 1 {
|
||||
for i, v := range x[:n] {
|
||||
absV := math.Abs(v)
|
||||
if absV > max {
|
||||
max = absV
|
||||
idx = i
|
||||
}
|
||||
}
|
||||
return idx
|
||||
}
|
||||
ix := incX
|
||||
for i := 1; i < n; i++ {
|
||||
v := x[ix]
|
||||
absV := math.Abs(v)
|
||||
if absV > max {
|
||||
max = absV
|
||||
idx = i
|
||||
}
|
||||
ix += incX
|
||||
}
|
||||
return idx
|
||||
}
|
||||
|
||||
// Sswap exchanges the elements of two vectors.
|
||||
// x[i], y[i] = y[i], x[i] for all i
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Sswap(n int, x []float32, incX int, y []float32, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && len(x) <= (n-1)*incX) || (incX < 0 && len(x) <= (1-n)*incX) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && len(y) <= (n-1)*incY) || (incY < 0 && len(y) <= (1-n)*incY) {
|
||||
panic(shortY)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
x = x[:n]
|
||||
for i, v := range x {
|
||||
x[i], y[i] = y[i], v
|
||||
}
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
x[ix], y[iy] = y[iy], x[ix]
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
}
|
||||
|
||||
// Scopy copies the elements of x into the elements of y.
|
||||
// y[i] = x[i] for all i
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Scopy(n int, x []float32, incX int, y []float32, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && len(x) <= (n-1)*incX) || (incX < 0 && len(x) <= (1-n)*incX) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && len(y) <= (n-1)*incY) || (incY < 0 && len(y) <= (1-n)*incY) {
|
||||
panic(shortY)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
copy(y[:n], x[:n])
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
y[iy] = x[ix]
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
}
|
||||
|
||||
// Saxpy adds alpha times x to y
|
||||
// y[i] += alpha * x[i] for all i
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Saxpy(n int, alpha float32, x []float32, incX int, y []float32, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && len(x) <= (n-1)*incX) || (incX < 0 && len(x) <= (1-n)*incX) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && len(y) <= (n-1)*incY) || (incY < 0 && len(y) <= (1-n)*incY) {
|
||||
panic(shortY)
|
||||
}
|
||||
if alpha == 0 {
|
||||
return
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
f32.AxpyUnitary(alpha, x[:n], y[:n])
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
f32.AxpyInc(alpha, x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
|
||||
}
|
||||
|
||||
// Srotg computes the plane rotation
|
||||
// _ _ _ _ _ _
|
||||
// | c s | | a | | r |
|
||||
// | -s c | * | b | = | 0 |
|
||||
// ‾ ‾ ‾ ‾ ‾ ‾
|
||||
// where
|
||||
// r = ±√(a^2 + b^2)
|
||||
// c = a/r, the cosine of the plane rotation
|
||||
// s = b/r, the sine of the plane rotation
|
||||
//
|
||||
// NOTE: There is a discrepancy between the reference implementation and the BLAS
|
||||
// technical manual regarding the sign for r when a or b are zero.
|
||||
// Srotg agrees with the definition in the manual and other
|
||||
// common BLAS implementations.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Srotg(a, b float32) (c, s, r, z float32) {
|
||||
if b == 0 && a == 0 {
|
||||
return 1, 0, a, 0
|
||||
}
|
||||
absA := math.Abs(a)
|
||||
absB := math.Abs(b)
|
||||
aGTb := absA > absB
|
||||
r = math.Hypot(a, b)
|
||||
if aGTb {
|
||||
r = math.Copysign(r, a)
|
||||
} else {
|
||||
r = math.Copysign(r, b)
|
||||
}
|
||||
c = a / r
|
||||
s = b / r
|
||||
if aGTb {
|
||||
z = s
|
||||
} else if c != 0 { // r == 0 case handled above
|
||||
z = 1 / c
|
||||
} else {
|
||||
z = 1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Srotmg computes the modified Givens rotation. See
|
||||
// http://www.netlib.org/lapack/explore-html/df/deb/drotmg_8f.html
|
||||
// for more details.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Srotmg(d1, d2, x1, y1 float32) (p blas.SrotmParams, rd1, rd2, rx1 float32) {
|
||||
// The implementation of Drotmg used here is taken from Hopkins 1997
|
||||
// Appendix A: https://doi.org/10.1145/289251.289253
|
||||
// with the exception of the gam constants below.
|
||||
|
||||
const (
|
||||
gam = 4096.0
|
||||
gamsq = gam * gam
|
||||
rgamsq = 1.0 / gamsq
|
||||
)
|
||||
|
||||
if d1 < 0 {
|
||||
p.Flag = blas.Rescaling // Error state.
|
||||
return p, 0, 0, 0
|
||||
}
|
||||
|
||||
if d2 == 0 || y1 == 0 {
|
||||
p.Flag = blas.Identity
|
||||
return p, d1, d2, x1
|
||||
}
|
||||
|
||||
var h11, h12, h21, h22 float32
|
||||
if (d1 == 0 || x1 == 0) && d2 > 0 {
|
||||
p.Flag = blas.Diagonal
|
||||
h12 = 1
|
||||
h21 = -1
|
||||
x1 = y1
|
||||
d1, d2 = d2, d1
|
||||
} else {
|
||||
p2 := d2 * y1
|
||||
p1 := d1 * x1
|
||||
q2 := p2 * y1
|
||||
q1 := p1 * x1
|
||||
if math.Abs(q1) > math.Abs(q2) {
|
||||
p.Flag = blas.OffDiagonal
|
||||
h11 = 1
|
||||
h22 = 1
|
||||
h21 = -y1 / x1
|
||||
h12 = p2 / p1
|
||||
u := 1 - h12*h21
|
||||
if u <= 0 {
|
||||
p.Flag = blas.Rescaling // Error state.
|
||||
return p, 0, 0, 0
|
||||
}
|
||||
|
||||
d1 /= u
|
||||
d2 /= u
|
||||
x1 *= u
|
||||
} else {
|
||||
if q2 < 0 {
|
||||
p.Flag = blas.Rescaling // Error state.
|
||||
return p, 0, 0, 0
|
||||
}
|
||||
|
||||
p.Flag = blas.Diagonal
|
||||
h21 = -1
|
||||
h12 = 1
|
||||
h11 = p1 / p2
|
||||
h22 = x1 / y1
|
||||
u := 1 + h11*h22
|
||||
d1, d2 = d2/u, d1/u
|
||||
x1 = y1 * u
|
||||
}
|
||||
}
|
||||
|
||||
for d1 <= rgamsq && d1 != 0 {
|
||||
p.Flag = blas.Rescaling
|
||||
d1 = (d1 * gam) * gam
|
||||
x1 /= gam
|
||||
h11 /= gam
|
||||
h12 /= gam
|
||||
}
|
||||
for d1 > gamsq {
|
||||
p.Flag = blas.Rescaling
|
||||
d1 = (d1 / gam) / gam
|
||||
x1 *= gam
|
||||
h11 *= gam
|
||||
h12 *= gam
|
||||
}
|
||||
|
||||
for math.Abs(d2) <= rgamsq && d2 != 0 {
|
||||
p.Flag = blas.Rescaling
|
||||
d2 = (d2 * gam) * gam
|
||||
h21 /= gam
|
||||
h22 /= gam
|
||||
}
|
||||
for math.Abs(d2) > gamsq {
|
||||
p.Flag = blas.Rescaling
|
||||
d2 = (d2 / gam) / gam
|
||||
h21 *= gam
|
||||
h22 *= gam
|
||||
}
|
||||
|
||||
switch p.Flag {
|
||||
case blas.Diagonal:
|
||||
p.H = [4]float32{0: h11, 3: h22}
|
||||
case blas.OffDiagonal:
|
||||
p.H = [4]float32{1: h21, 2: h12}
|
||||
case blas.Rescaling:
|
||||
p.H = [4]float32{h11, h21, h12, h22}
|
||||
default:
|
||||
panic(badFlag)
|
||||
}
|
||||
|
||||
return p, d1, d2, x1
|
||||
}
|
||||
|
||||
// Srot applies a plane transformation.
|
||||
// x[i] = c * x[i] + s * y[i]
|
||||
// y[i] = c * y[i] - s * x[i]
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Srot(n int, x []float32, incX int, y []float32, incY int, c float32, s float32) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && len(x) <= (n-1)*incX) || (incX < 0 && len(x) <= (1-n)*incX) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && len(y) <= (n-1)*incY) || (incY < 0 && len(y) <= (1-n)*incY) {
|
||||
panic(shortY)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
x = x[:n]
|
||||
for i, vx := range x {
|
||||
vy := y[i]
|
||||
x[i], y[i] = c*vx+s*vy, c*vy-s*vx
|
||||
}
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
vx := x[ix]
|
||||
vy := y[iy]
|
||||
x[ix], y[iy] = c*vx+s*vy, c*vy-s*vx
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
}
|
||||
|
||||
// Srotm applies the modified Givens rotation to the 2×n matrix.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Srotm(n int, x []float32, incX int, y []float32, incY int, p blas.SrotmParams) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n <= 0 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && len(x) <= (n-1)*incX) || (incX < 0 && len(x) <= (1-n)*incX) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && len(y) <= (n-1)*incY) || (incY < 0 && len(y) <= (1-n)*incY) {
|
||||
panic(shortY)
|
||||
}
|
||||
|
||||
if p.Flag == blas.Identity {
|
||||
return
|
||||
}
|
||||
|
||||
switch p.Flag {
|
||||
case blas.Rescaling:
|
||||
h11 := p.H[0]
|
||||
h12 := p.H[2]
|
||||
h21 := p.H[1]
|
||||
h22 := p.H[3]
|
||||
if incX == 1 && incY == 1 {
|
||||
x = x[:n]
|
||||
for i, vx := range x {
|
||||
vy := y[i]
|
||||
x[i], y[i] = vx*h11+vy*h12, vx*h21+vy*h22
|
||||
}
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
vx := x[ix]
|
||||
vy := y[iy]
|
||||
x[ix], y[iy] = vx*h11+vy*h12, vx*h21+vy*h22
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
case blas.OffDiagonal:
|
||||
h12 := p.H[2]
|
||||
h21 := p.H[1]
|
||||
if incX == 1 && incY == 1 {
|
||||
x = x[:n]
|
||||
for i, vx := range x {
|
||||
vy := y[i]
|
||||
x[i], y[i] = vx+vy*h12, vx*h21+vy
|
||||
}
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
vx := x[ix]
|
||||
vy := y[iy]
|
||||
x[ix], y[iy] = vx+vy*h12, vx*h21+vy
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
case blas.Diagonal:
|
||||
h11 := p.H[0]
|
||||
h22 := p.H[3]
|
||||
if incX == 1 && incY == 1 {
|
||||
x = x[:n]
|
||||
for i, vx := range x {
|
||||
vy := y[i]
|
||||
x[i], y[i] = vx*h11+vy, -vx+vy*h22
|
||||
}
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
vx := x[ix]
|
||||
vy := y[iy]
|
||||
x[ix], y[iy] = vx*h11+vy, -vx+vy*h22
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sscal scales x by alpha.
|
||||
// x[i] *= alpha
|
||||
// Sscal has no effect if incX < 0.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Sscal(n int, alpha float32, x []float32, incX int) {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if alpha == 0 {
|
||||
if incX == 1 {
|
||||
x = x[:n]
|
||||
for i := range x {
|
||||
x[i] = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
for ix := 0; ix < n*incX; ix += incX {
|
||||
x[ix] = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
if incX == 1 {
|
||||
f32.ScalUnitary(alpha, x[:n])
|
||||
return
|
||||
}
|
||||
f32.ScalInc(alpha, x, uintptr(n), uintptr(incX))
|
||||
}
|
53
vendor/gonum.org/v1/gonum/blas/gonum/level1float32_dsdot.go
generated
vendored
53
vendor/gonum.org/v1/gonum/blas/gonum/level1float32_dsdot.go
generated
vendored
|
@ -1,53 +0,0 @@
|
|||
// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.
|
||||
|
||||
// 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 gonum
|
||||
|
||||
import (
|
||||
"gonum.org/v1/gonum/internal/asm/f32"
|
||||
)
|
||||
|
||||
// Dsdot computes the dot product of the two vectors
|
||||
// \sum_i x[i]*y[i]
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Dsdot(n int, x []float32, incX int, y []float32, incY int) float64 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n <= 0 {
|
||||
if n == 0 {
|
||||
return 0
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
if len(x) < n {
|
||||
panic(shortX)
|
||||
}
|
||||
if len(y) < n {
|
||||
panic(shortY)
|
||||
}
|
||||
return f32.DdotUnitary(x[:n], y[:n])
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
if ix >= len(x) || ix+(n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if iy >= len(y) || iy+(n-1)*incY >= len(y) {
|
||||
panic(shortY)
|
||||
}
|
||||
return f32.DdotInc(x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
|
||||
}
|
53
vendor/gonum.org/v1/gonum/blas/gonum/level1float32_sdot.go
generated
vendored
53
vendor/gonum.org/v1/gonum/blas/gonum/level1float32_sdot.go
generated
vendored
|
@ -1,53 +0,0 @@
|
|||
// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.
|
||||
|
||||
// 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 gonum
|
||||
|
||||
import (
|
||||
"gonum.org/v1/gonum/internal/asm/f32"
|
||||
)
|
||||
|
||||
// Sdot computes the dot product of the two vectors
|
||||
// \sum_i x[i]*y[i]
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Sdot(n int, x []float32, incX int, y []float32, incY int) float32 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n <= 0 {
|
||||
if n == 0 {
|
||||
return 0
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
if len(x) < n {
|
||||
panic(shortX)
|
||||
}
|
||||
if len(y) < n {
|
||||
panic(shortY)
|
||||
}
|
||||
return f32.DotUnitary(x[:n], y[:n])
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
if ix >= len(x) || ix+(n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if iy >= len(y) || iy+(n-1)*incY >= len(y) {
|
||||
panic(shortY)
|
||||
}
|
||||
return f32.DotInc(x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
|
||||
}
|
53
vendor/gonum.org/v1/gonum/blas/gonum/level1float32_sdsdot.go
generated
vendored
53
vendor/gonum.org/v1/gonum/blas/gonum/level1float32_sdsdot.go
generated
vendored
|
@ -1,53 +0,0 @@
|
|||
// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.
|
||||
|
||||
// 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 gonum
|
||||
|
||||
import (
|
||||
"gonum.org/v1/gonum/internal/asm/f32"
|
||||
)
|
||||
|
||||
// Sdsdot computes the dot product of the two vectors plus a constant
|
||||
// alpha + \sum_i x[i]*y[i]
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Sdsdot(n int, alpha float32, x []float32, incX int, y []float32, incY int) float32 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n <= 0 {
|
||||
if n == 0 {
|
||||
return 0
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
if len(x) < n {
|
||||
panic(shortX)
|
||||
}
|
||||
if len(y) < n {
|
||||
panic(shortY)
|
||||
}
|
||||
return alpha + float32(f32.DdotUnitary(x[:n], y[:n]))
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
if ix >= len(x) || ix+(n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if iy >= len(y) || iy+(n-1)*incY >= len(y) {
|
||||
panic(shortY)
|
||||
}
|
||||
return alpha + float32(f32.DdotInc(x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy)))
|
||||
}
|
620
vendor/gonum.org/v1/gonum/blas/gonum/level1float64.go
generated
vendored
620
vendor/gonum.org/v1/gonum/blas/gonum/level1float64.go
generated
vendored
|
@ -1,620 +0,0 @@
|
|||
// 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 gonum
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
"gonum.org/v1/gonum/blas"
|
||||
"gonum.org/v1/gonum/internal/asm/f64"
|
||||
)
|
||||
|
||||
var _ blas.Float64Level1 = Implementation{}
|
||||
|
||||
// Dnrm2 computes the Euclidean norm of a vector,
|
||||
// sqrt(\sum_i x[i] * x[i]).
|
||||
// This function returns 0 if incX is negative.
|
||||
func (Implementation) Dnrm2(n int, x []float64, incX int) float64 {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
if len(x) <= (n-1)*incX {
|
||||
panic(shortX)
|
||||
}
|
||||
if n < 2 {
|
||||
if n == 1 {
|
||||
return math.Abs(x[0])
|
||||
}
|
||||
if n == 0 {
|
||||
return 0
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
var (
|
||||
scale float64 = 0
|
||||
sumSquares float64 = 1
|
||||
)
|
||||
if incX == 1 {
|
||||
x = x[:n]
|
||||
for _, v := range x {
|
||||
if v == 0 {
|
||||
continue
|
||||
}
|
||||
absxi := math.Abs(v)
|
||||
if math.IsNaN(absxi) {
|
||||
return math.NaN()
|
||||
}
|
||||
if scale < absxi {
|
||||
sumSquares = 1 + sumSquares*(scale/absxi)*(scale/absxi)
|
||||
scale = absxi
|
||||
} else {
|
||||
sumSquares = sumSquares + (absxi/scale)*(absxi/scale)
|
||||
}
|
||||
}
|
||||
if math.IsInf(scale, 1) {
|
||||
return math.Inf(1)
|
||||
}
|
||||
return scale * math.Sqrt(sumSquares)
|
||||
}
|
||||
for ix := 0; ix < n*incX; ix += incX {
|
||||
val := x[ix]
|
||||
if val == 0 {
|
||||
continue
|
||||
}
|
||||
absxi := math.Abs(val)
|
||||
if math.IsNaN(absxi) {
|
||||
return math.NaN()
|
||||
}
|
||||
if scale < absxi {
|
||||
sumSquares = 1 + sumSquares*(scale/absxi)*(scale/absxi)
|
||||
scale = absxi
|
||||
} else {
|
||||
sumSquares = sumSquares + (absxi/scale)*(absxi/scale)
|
||||
}
|
||||
}
|
||||
if math.IsInf(scale, 1) {
|
||||
return math.Inf(1)
|
||||
}
|
||||
return scale * math.Sqrt(sumSquares)
|
||||
}
|
||||
|
||||
// Dasum computes the sum of the absolute values of the elements of x.
|
||||
// \sum_i |x[i]|
|
||||
// Dasum returns 0 if incX is negative.
|
||||
func (Implementation) Dasum(n int, x []float64, incX int) float64 {
|
||||
var sum float64
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
if len(x) <= (n-1)*incX {
|
||||
panic(shortX)
|
||||
}
|
||||
if incX == 1 {
|
||||
x = x[:n]
|
||||
for _, v := range x {
|
||||
sum += math.Abs(v)
|
||||
}
|
||||
return sum
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
sum += math.Abs(x[i*incX])
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
// Idamax returns the index of an element of x with the largest absolute value.
|
||||
// If there are multiple such indices the earliest is returned.
|
||||
// Idamax returns -1 if n == 0.
|
||||
func (Implementation) Idamax(n int, x []float64, incX int) int {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return -1
|
||||
}
|
||||
if len(x) <= (n-1)*incX {
|
||||
panic(shortX)
|
||||
}
|
||||
if n < 2 {
|
||||
if n == 1 {
|
||||
return 0
|
||||
}
|
||||
if n == 0 {
|
||||
return -1 // Netlib returns invalid index when n == 0.
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
idx := 0
|
||||
max := math.Abs(x[0])
|
||||
if incX == 1 {
|
||||
for i, v := range x[:n] {
|
||||
absV := math.Abs(v)
|
||||
if absV > max {
|
||||
max = absV
|
||||
idx = i
|
||||
}
|
||||
}
|
||||
return idx
|
||||
}
|
||||
ix := incX
|
||||
for i := 1; i < n; i++ {
|
||||
v := x[ix]
|
||||
absV := math.Abs(v)
|
||||
if absV > max {
|
||||
max = absV
|
||||
idx = i
|
||||
}
|
||||
ix += incX
|
||||
}
|
||||
return idx
|
||||
}
|
||||
|
||||
// Dswap exchanges the elements of two vectors.
|
||||
// x[i], y[i] = y[i], x[i] for all i
|
||||
func (Implementation) Dswap(n int, x []float64, incX int, y []float64, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && len(x) <= (n-1)*incX) || (incX < 0 && len(x) <= (1-n)*incX) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && len(y) <= (n-1)*incY) || (incY < 0 && len(y) <= (1-n)*incY) {
|
||||
panic(shortY)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
x = x[:n]
|
||||
for i, v := range x {
|
||||
x[i], y[i] = y[i], v
|
||||
}
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
x[ix], y[iy] = y[iy], x[ix]
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
}
|
||||
|
||||
// Dcopy copies the elements of x into the elements of y.
|
||||
// y[i] = x[i] for all i
|
||||
func (Implementation) Dcopy(n int, x []float64, incX int, y []float64, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && len(x) <= (n-1)*incX) || (incX < 0 && len(x) <= (1-n)*incX) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && len(y) <= (n-1)*incY) || (incY < 0 && len(y) <= (1-n)*incY) {
|
||||
panic(shortY)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
copy(y[:n], x[:n])
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
y[iy] = x[ix]
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
}
|
||||
|
||||
// Daxpy adds alpha times x to y
|
||||
// y[i] += alpha * x[i] for all i
|
||||
func (Implementation) Daxpy(n int, alpha float64, x []float64, incX int, y []float64, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && len(x) <= (n-1)*incX) || (incX < 0 && len(x) <= (1-n)*incX) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && len(y) <= (n-1)*incY) || (incY < 0 && len(y) <= (1-n)*incY) {
|
||||
panic(shortY)
|
||||
}
|
||||
if alpha == 0 {
|
||||
return
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
f64.AxpyUnitary(alpha, x[:n], y[:n])
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
f64.AxpyInc(alpha, x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
|
||||
}
|
||||
|
||||
// Drotg computes the plane rotation
|
||||
// _ _ _ _ _ _
|
||||
// | c s | | a | | r |
|
||||
// | -s c | * | b | = | 0 |
|
||||
// ‾ ‾ ‾ ‾ ‾ ‾
|
||||
// where
|
||||
// r = ±√(a^2 + b^2)
|
||||
// c = a/r, the cosine of the plane rotation
|
||||
// s = b/r, the sine of the plane rotation
|
||||
//
|
||||
// NOTE: There is a discrepancy between the reference implementation and the BLAS
|
||||
// technical manual regarding the sign for r when a or b are zero.
|
||||
// Drotg agrees with the definition in the manual and other
|
||||
// common BLAS implementations.
|
||||
func (Implementation) Drotg(a, b float64) (c, s, r, z float64) {
|
||||
if b == 0 && a == 0 {
|
||||
return 1, 0, a, 0
|
||||
}
|
||||
absA := math.Abs(a)
|
||||
absB := math.Abs(b)
|
||||
aGTb := absA > absB
|
||||
r = math.Hypot(a, b)
|
||||
if aGTb {
|
||||
r = math.Copysign(r, a)
|
||||
} else {
|
||||
r = math.Copysign(r, b)
|
||||
}
|
||||
c = a / r
|
||||
s = b / r
|
||||
if aGTb {
|
||||
z = s
|
||||
} else if c != 0 { // r == 0 case handled above
|
||||
z = 1 / c
|
||||
} else {
|
||||
z = 1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Drotmg computes the modified Givens rotation. See
|
||||
// http://www.netlib.org/lapack/explore-html/df/deb/drotmg_8f.html
|
||||
// for more details.
|
||||
func (Implementation) Drotmg(d1, d2, x1, y1 float64) (p blas.DrotmParams, rd1, rd2, rx1 float64) {
|
||||
// The implementation of Drotmg used here is taken from Hopkins 1997
|
||||
// Appendix A: https://doi.org/10.1145/289251.289253
|
||||
// with the exception of the gam constants below.
|
||||
|
||||
const (
|
||||
gam = 4096.0
|
||||
gamsq = gam * gam
|
||||
rgamsq = 1.0 / gamsq
|
||||
)
|
||||
|
||||
if d1 < 0 {
|
||||
p.Flag = blas.Rescaling // Error state.
|
||||
return p, 0, 0, 0
|
||||
}
|
||||
|
||||
if d2 == 0 || y1 == 0 {
|
||||
p.Flag = blas.Identity
|
||||
return p, d1, d2, x1
|
||||
}
|
||||
|
||||
var h11, h12, h21, h22 float64
|
||||
if (d1 == 0 || x1 == 0) && d2 > 0 {
|
||||
p.Flag = blas.Diagonal
|
||||
h12 = 1
|
||||
h21 = -1
|
||||
x1 = y1
|
||||
d1, d2 = d2, d1
|
||||
} else {
|
||||
p2 := d2 * y1
|
||||
p1 := d1 * x1
|
||||
q2 := p2 * y1
|
||||
q1 := p1 * x1
|
||||
if math.Abs(q1) > math.Abs(q2) {
|
||||
p.Flag = blas.OffDiagonal
|
||||
h11 = 1
|
||||
h22 = 1
|
||||
h21 = -y1 / x1
|
||||
h12 = p2 / p1
|
||||
u := 1 - h12*h21
|
||||
if u <= 0 {
|
||||
p.Flag = blas.Rescaling // Error state.
|
||||
return p, 0, 0, 0
|
||||
}
|
||||
|
||||
d1 /= u
|
||||
d2 /= u
|
||||
x1 *= u
|
||||
} else {
|
||||
if q2 < 0 {
|
||||
p.Flag = blas.Rescaling // Error state.
|
||||
return p, 0, 0, 0
|
||||
}
|
||||
|
||||
p.Flag = blas.Diagonal
|
||||
h21 = -1
|
||||
h12 = 1
|
||||
h11 = p1 / p2
|
||||
h22 = x1 / y1
|
||||
u := 1 + h11*h22
|
||||
d1, d2 = d2/u, d1/u
|
||||
x1 = y1 * u
|
||||
}
|
||||
}
|
||||
|
||||
for d1 <= rgamsq && d1 != 0 {
|
||||
p.Flag = blas.Rescaling
|
||||
d1 = (d1 * gam) * gam
|
||||
x1 /= gam
|
||||
h11 /= gam
|
||||
h12 /= gam
|
||||
}
|
||||
for d1 > gamsq {
|
||||
p.Flag = blas.Rescaling
|
||||
d1 = (d1 / gam) / gam
|
||||
x1 *= gam
|
||||
h11 *= gam
|
||||
h12 *= gam
|
||||
}
|
||||
|
||||
for math.Abs(d2) <= rgamsq && d2 != 0 {
|
||||
p.Flag = blas.Rescaling
|
||||
d2 = (d2 * gam) * gam
|
||||
h21 /= gam
|
||||
h22 /= gam
|
||||
}
|
||||
for math.Abs(d2) > gamsq {
|
||||
p.Flag = blas.Rescaling
|
||||
d2 = (d2 / gam) / gam
|
||||
h21 *= gam
|
||||
h22 *= gam
|
||||
}
|
||||
|
||||
switch p.Flag {
|
||||
case blas.Diagonal:
|
||||
p.H = [4]float64{0: h11, 3: h22}
|
||||
case blas.OffDiagonal:
|
||||
p.H = [4]float64{1: h21, 2: h12}
|
||||
case blas.Rescaling:
|
||||
p.H = [4]float64{h11, h21, h12, h22}
|
||||
default:
|
||||
panic(badFlag)
|
||||
}
|
||||
|
||||
return p, d1, d2, x1
|
||||
}
|
||||
|
||||
// Drot applies a plane transformation.
|
||||
// x[i] = c * x[i] + s * y[i]
|
||||
// y[i] = c * y[i] - s * x[i]
|
||||
func (Implementation) Drot(n int, x []float64, incX int, y []float64, incY int, c float64, s float64) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && len(x) <= (n-1)*incX) || (incX < 0 && len(x) <= (1-n)*incX) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && len(y) <= (n-1)*incY) || (incY < 0 && len(y) <= (1-n)*incY) {
|
||||
panic(shortY)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
x = x[:n]
|
||||
for i, vx := range x {
|
||||
vy := y[i]
|
||||
x[i], y[i] = c*vx+s*vy, c*vy-s*vx
|
||||
}
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
vx := x[ix]
|
||||
vy := y[iy]
|
||||
x[ix], y[iy] = c*vx+s*vy, c*vy-s*vx
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
}
|
||||
|
||||
// Drotm applies the modified Givens rotation to the 2×n matrix.
|
||||
func (Implementation) Drotm(n int, x []float64, incX int, y []float64, incY int, p blas.DrotmParams) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n <= 0 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (incX > 0 && len(x) <= (n-1)*incX) || (incX < 0 && len(x) <= (1-n)*incX) {
|
||||
panic(shortX)
|
||||
}
|
||||
if (incY > 0 && len(y) <= (n-1)*incY) || (incY < 0 && len(y) <= (1-n)*incY) {
|
||||
panic(shortY)
|
||||
}
|
||||
|
||||
if p.Flag == blas.Identity {
|
||||
return
|
||||
}
|
||||
|
||||
switch p.Flag {
|
||||
case blas.Rescaling:
|
||||
h11 := p.H[0]
|
||||
h12 := p.H[2]
|
||||
h21 := p.H[1]
|
||||
h22 := p.H[3]
|
||||
if incX == 1 && incY == 1 {
|
||||
x = x[:n]
|
||||
for i, vx := range x {
|
||||
vy := y[i]
|
||||
x[i], y[i] = vx*h11+vy*h12, vx*h21+vy*h22
|
||||
}
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
vx := x[ix]
|
||||
vy := y[iy]
|
||||
x[ix], y[iy] = vx*h11+vy*h12, vx*h21+vy*h22
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
case blas.OffDiagonal:
|
||||
h12 := p.H[2]
|
||||
h21 := p.H[1]
|
||||
if incX == 1 && incY == 1 {
|
||||
x = x[:n]
|
||||
for i, vx := range x {
|
||||
vy := y[i]
|
||||
x[i], y[i] = vx+vy*h12, vx*h21+vy
|
||||
}
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
vx := x[ix]
|
||||
vy := y[iy]
|
||||
x[ix], y[iy] = vx+vy*h12, vx*h21+vy
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
case blas.Diagonal:
|
||||
h11 := p.H[0]
|
||||
h22 := p.H[3]
|
||||
if incX == 1 && incY == 1 {
|
||||
x = x[:n]
|
||||
for i, vx := range x {
|
||||
vy := y[i]
|
||||
x[i], y[i] = vx*h11+vy, -vx+vy*h22
|
||||
}
|
||||
return
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
vx := x[ix]
|
||||
vy := y[iy]
|
||||
x[ix], y[iy] = vx*h11+vy, -vx+vy*h22
|
||||
ix += incX
|
||||
iy += incY
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dscal scales x by alpha.
|
||||
// x[i] *= alpha
|
||||
// Dscal has no effect if incX < 0.
|
||||
func (Implementation) Dscal(n int, alpha float64, x []float64, incX int) {
|
||||
if incX < 1 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
return
|
||||
}
|
||||
if n < 1 {
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if (n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if alpha == 0 {
|
||||
if incX == 1 {
|
||||
x = x[:n]
|
||||
for i := range x {
|
||||
x[i] = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
for ix := 0; ix < n*incX; ix += incX {
|
||||
x[ix] = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
if incX == 1 {
|
||||
f64.ScalUnitary(alpha, x[:n])
|
||||
return
|
||||
}
|
||||
f64.ScalInc(alpha, x, uintptr(n), uintptr(incX))
|
||||
}
|
49
vendor/gonum.org/v1/gonum/blas/gonum/level1float64_ddot.go
generated
vendored
49
vendor/gonum.org/v1/gonum/blas/gonum/level1float64_ddot.go
generated
vendored
|
@ -1,49 +0,0 @@
|
|||
// 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 gonum
|
||||
|
||||
import (
|
||||
"gonum.org/v1/gonum/internal/asm/f64"
|
||||
)
|
||||
|
||||
// Ddot computes the dot product of the two vectors
|
||||
// \sum_i x[i]*y[i]
|
||||
func (Implementation) Ddot(n int, x []float64, incX int, y []float64, incY int) float64 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
}
|
||||
if incY == 0 {
|
||||
panic(zeroIncY)
|
||||
}
|
||||
if n <= 0 {
|
||||
if n == 0 {
|
||||
return 0
|
||||
}
|
||||
panic(nLT0)
|
||||
}
|
||||
if incX == 1 && incY == 1 {
|
||||
if len(x) < n {
|
||||
panic(shortX)
|
||||
}
|
||||
if len(y) < n {
|
||||
panic(shortY)
|
||||
}
|
||||
return f64.DotUnitary(x[:n], y[:n])
|
||||
}
|
||||
var ix, iy int
|
||||
if incX < 0 {
|
||||
ix = (-n + 1) * incX
|
||||
}
|
||||
if incY < 0 {
|
||||
iy = (-n + 1) * incY
|
||||
}
|
||||
if ix >= len(x) || ix+(n-1)*incX >= len(x) {
|
||||
panic(shortX)
|
||||
}
|
||||
if iy >= len(y) || iy+(n-1)*incY >= len(y) {
|
||||
panic(shortY)
|
||||
}
|
||||
return f64.DotInc(x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
|
||||
}
|
2906
vendor/gonum.org/v1/gonum/blas/gonum/level2cmplx128.go
generated
vendored
2906
vendor/gonum.org/v1/gonum/blas/gonum/level2cmplx128.go
generated
vendored
File diff suppressed because it is too large
Load diff
2942
vendor/gonum.org/v1/gonum/blas/gonum/level2cmplx64.go
generated
vendored
2942
vendor/gonum.org/v1/gonum/blas/gonum/level2cmplx64.go
generated
vendored
File diff suppressed because it is too large
Load diff
2296
vendor/gonum.org/v1/gonum/blas/gonum/level2float32.go
generated
vendored
2296
vendor/gonum.org/v1/gonum/blas/gonum/level2float32.go
generated
vendored
File diff suppressed because it is too large
Load diff
2264
vendor/gonum.org/v1/gonum/blas/gonum/level2float64.go
generated
vendored
2264
vendor/gonum.org/v1/gonum/blas/gonum/level2float64.go
generated
vendored
File diff suppressed because it is too large
Load diff
1715
vendor/gonum.org/v1/gonum/blas/gonum/level3cmplx128.go
generated
vendored
1715
vendor/gonum.org/v1/gonum/blas/gonum/level3cmplx128.go
generated
vendored
File diff suppressed because it is too large
Load diff
1735
vendor/gonum.org/v1/gonum/blas/gonum/level3cmplx64.go
generated
vendored
1735
vendor/gonum.org/v1/gonum/blas/gonum/level3cmplx64.go
generated
vendored
File diff suppressed because it is too large
Load diff
876
vendor/gonum.org/v1/gonum/blas/gonum/level3float32.go
generated
vendored
876
vendor/gonum.org/v1/gonum/blas/gonum/level3float32.go
generated
vendored
|
@ -1,876 +0,0 @@
|
|||
// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.
|
||||
|
||||
// Copyright ©2014 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 gonum
|
||||
|
||||
import (
|
||||
"gonum.org/v1/gonum/blas"
|
||||
"gonum.org/v1/gonum/internal/asm/f32"
|
||||
)
|
||||
|
||||
var _ blas.Float32Level3 = Implementation{}
|
||||
|
||||
// Strsm solves one of the matrix equations
|
||||
// A * X = alpha * B if tA == blas.NoTrans and side == blas.Left
|
||||
// A^T * X = alpha * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Left
|
||||
// X * A = alpha * B if tA == blas.NoTrans and side == blas.Right
|
||||
// X * A^T = alpha * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Right
|
||||
// where A is an n×n or m×m triangular matrix, X and B are m×n matrices, and alpha is a
|
||||
// scalar.
|
||||
//
|
||||
// At entry to the function, X contains the values of B, and the result is
|
||||
// stored in-place into X.
|
||||
//
|
||||
// No check is made that A is invertible.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Strsm(s blas.Side, ul blas.Uplo, tA blas.Transpose, d blas.Diag, m, n int, alpha float32, a []float32, lda int, b []float32, ldb int) {
|
||||
if s != blas.Left && s != blas.Right {
|
||||
panic(badSide)
|
||||
}
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
panic(badUplo)
|
||||
}
|
||||
if tA != blas.NoTrans && tA != blas.Trans && tA != blas.ConjTrans {
|
||||
panic(badTranspose)
|
||||
}
|
||||
if d != blas.NonUnit && d != blas.Unit {
|
||||
panic(badDiag)
|
||||
}
|
||||
if m < 0 {
|
||||
panic(mLT0)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
k := n
|
||||
if s == blas.Left {
|
||||
k = m
|
||||
}
|
||||
if lda < max(1, k) {
|
||||
panic(badLdA)
|
||||
}
|
||||
if ldb < max(1, n) {
|
||||
panic(badLdB)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if m == 0 || n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// For zero matrix size the following slice length checks are trivially satisfied.
|
||||
if len(a) < lda*(k-1)+k {
|
||||
panic(shortA)
|
||||
}
|
||||
if len(b) < ldb*(m-1)+n {
|
||||
panic(shortB)
|
||||
}
|
||||
|
||||
if alpha == 0 {
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for j := range btmp {
|
||||
btmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
nonUnit := d == blas.NonUnit
|
||||
if s == blas.Left {
|
||||
if tA == blas.NoTrans {
|
||||
if ul == blas.Upper {
|
||||
for i := m - 1; i >= 0; i-- {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
if alpha != 1 {
|
||||
f32.ScalUnitary(alpha, btmp)
|
||||
}
|
||||
for ka, va := range a[i*lda+i+1 : i*lda+m] {
|
||||
if va != 0 {
|
||||
k := ka + i + 1
|
||||
f32.AxpyUnitary(-va, b[k*ldb:k*ldb+n], btmp)
|
||||
}
|
||||
}
|
||||
if nonUnit {
|
||||
tmp := 1 / a[i*lda+i]
|
||||
f32.ScalUnitary(tmp, btmp)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
if alpha != 1 {
|
||||
f32.ScalUnitary(alpha, btmp)
|
||||
}
|
||||
for k, va := range a[i*lda : i*lda+i] {
|
||||
if va != 0 {
|
||||
f32.AxpyUnitary(-va, b[k*ldb:k*ldb+n], btmp)
|
||||
}
|
||||
}
|
||||
if nonUnit {
|
||||
tmp := 1 / a[i*lda+i]
|
||||
f32.ScalUnitary(tmp, btmp)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is transposed
|
||||
if ul == blas.Upper {
|
||||
for k := 0; k < m; k++ {
|
||||
btmpk := b[k*ldb : k*ldb+n]
|
||||
if nonUnit {
|
||||
tmp := 1 / a[k*lda+k]
|
||||
f32.ScalUnitary(tmp, btmpk)
|
||||
}
|
||||
for ia, va := range a[k*lda+k+1 : k*lda+m] {
|
||||
if va != 0 {
|
||||
i := ia + k + 1
|
||||
f32.AxpyUnitary(-va, btmpk, b[i*ldb:i*ldb+n])
|
||||
}
|
||||
}
|
||||
if alpha != 1 {
|
||||
f32.ScalUnitary(alpha, btmpk)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for k := m - 1; k >= 0; k-- {
|
||||
btmpk := b[k*ldb : k*ldb+n]
|
||||
if nonUnit {
|
||||
tmp := 1 / a[k*lda+k]
|
||||
f32.ScalUnitary(tmp, btmpk)
|
||||
}
|
||||
for i, va := range a[k*lda : k*lda+k] {
|
||||
if va != 0 {
|
||||
f32.AxpyUnitary(-va, btmpk, b[i*ldb:i*ldb+n])
|
||||
}
|
||||
}
|
||||
if alpha != 1 {
|
||||
f32.ScalUnitary(alpha, btmpk)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is to the right of X.
|
||||
if tA == blas.NoTrans {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
if alpha != 1 {
|
||||
f32.ScalUnitary(alpha, btmp)
|
||||
}
|
||||
for k, vb := range btmp {
|
||||
if vb == 0 {
|
||||
continue
|
||||
}
|
||||
if nonUnit {
|
||||
btmp[k] /= a[k*lda+k]
|
||||
}
|
||||
f32.AxpyUnitary(-btmp[k], a[k*lda+k+1:k*lda+n], btmp[k+1:n])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
if alpha != 1 {
|
||||
f32.ScalUnitary(alpha, btmp)
|
||||
}
|
||||
for k := n - 1; k >= 0; k-- {
|
||||
if btmp[k] == 0 {
|
||||
continue
|
||||
}
|
||||
if nonUnit {
|
||||
btmp[k] /= a[k*lda+k]
|
||||
}
|
||||
f32.AxpyUnitary(-btmp[k], a[k*lda:k*lda+k], btmp[:k])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is transposed.
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for j := n - 1; j >= 0; j-- {
|
||||
tmp := alpha*btmp[j] - f32.DotUnitary(a[j*lda+j+1:j*lda+n], btmp[j+1:])
|
||||
if nonUnit {
|
||||
tmp /= a[j*lda+j]
|
||||
}
|
||||
btmp[j] = tmp
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for j := 0; j < n; j++ {
|
||||
tmp := alpha*btmp[j] - f32.DotUnitary(a[j*lda:j*lda+j], btmp[:j])
|
||||
if nonUnit {
|
||||
tmp /= a[j*lda+j]
|
||||
}
|
||||
btmp[j] = tmp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ssymm performs one of the matrix-matrix operations
|
||||
// C = alpha * A * B + beta * C if side == blas.Left
|
||||
// C = alpha * B * A + beta * C if side == blas.Right
|
||||
// where A is an n×n or m×m symmetric matrix, B and C are m×n matrices, and alpha
|
||||
// is a scalar.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Ssymm(s blas.Side, ul blas.Uplo, m, n int, alpha float32, a []float32, lda int, b []float32, ldb int, beta float32, c []float32, ldc int) {
|
||||
if s != blas.Right && s != blas.Left {
|
||||
panic(badSide)
|
||||
}
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
panic(badUplo)
|
||||
}
|
||||
if m < 0 {
|
||||
panic(mLT0)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
k := n
|
||||
if s == blas.Left {
|
||||
k = m
|
||||
}
|
||||
if lda < max(1, k) {
|
||||
panic(badLdA)
|
||||
}
|
||||
if ldb < max(1, n) {
|
||||
panic(badLdB)
|
||||
}
|
||||
if ldc < max(1, n) {
|
||||
panic(badLdC)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if m == 0 || n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// For zero matrix size the following slice length checks are trivially satisfied.
|
||||
if len(a) < lda*(k-1)+k {
|
||||
panic(shortA)
|
||||
}
|
||||
if len(b) < ldb*(m-1)+n {
|
||||
panic(shortB)
|
||||
}
|
||||
if len(c) < ldc*(m-1)+n {
|
||||
panic(shortC)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if alpha == 0 && beta == 1 {
|
||||
return
|
||||
}
|
||||
|
||||
if alpha == 0 {
|
||||
if beta == 0 {
|
||||
for i := 0; i < m; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for j := 0; j < n; j++ {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
isUpper := ul == blas.Upper
|
||||
if s == blas.Left {
|
||||
for i := 0; i < m; i++ {
|
||||
atmp := alpha * a[i*lda+i]
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for j, v := range btmp {
|
||||
ctmp[j] *= beta
|
||||
ctmp[j] += atmp * v
|
||||
}
|
||||
|
||||
for k := 0; k < i; k++ {
|
||||
var atmp float32
|
||||
if isUpper {
|
||||
atmp = a[k*lda+i]
|
||||
} else {
|
||||
atmp = a[i*lda+k]
|
||||
}
|
||||
atmp *= alpha
|
||||
f32.AxpyUnitary(atmp, b[k*ldb:k*ldb+n], ctmp)
|
||||
}
|
||||
for k := i + 1; k < m; k++ {
|
||||
var atmp float32
|
||||
if isUpper {
|
||||
atmp = a[i*lda+k]
|
||||
} else {
|
||||
atmp = a[k*lda+i]
|
||||
}
|
||||
atmp *= alpha
|
||||
f32.AxpyUnitary(atmp, b[k*ldb:k*ldb+n], ctmp)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if isUpper {
|
||||
for i := 0; i < m; i++ {
|
||||
for j := n - 1; j >= 0; j-- {
|
||||
tmp := alpha * b[i*ldb+j]
|
||||
var tmp2 float32
|
||||
atmp := a[j*lda+j+1 : j*lda+n]
|
||||
btmp := b[i*ldb+j+1 : i*ldb+n]
|
||||
ctmp := c[i*ldc+j+1 : i*ldc+n]
|
||||
for k, v := range atmp {
|
||||
ctmp[k] += tmp * v
|
||||
tmp2 += btmp[k] * v
|
||||
}
|
||||
c[i*ldc+j] *= beta
|
||||
c[i*ldc+j] += tmp*a[j*lda+j] + alpha*tmp2
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
for j := 0; j < n; j++ {
|
||||
tmp := alpha * b[i*ldb+j]
|
||||
var tmp2 float32
|
||||
atmp := a[j*lda : j*lda+j]
|
||||
btmp := b[i*ldb : i*ldb+j]
|
||||
ctmp := c[i*ldc : i*ldc+j]
|
||||
for k, v := range atmp {
|
||||
ctmp[k] += tmp * v
|
||||
tmp2 += btmp[k] * v
|
||||
}
|
||||
c[i*ldc+j] *= beta
|
||||
c[i*ldc+j] += tmp*a[j*lda+j] + alpha*tmp2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ssyrk performs one of the symmetric rank-k operations
|
||||
// C = alpha * A * A^T + beta * C if tA == blas.NoTrans
|
||||
// C = alpha * A^T * A + beta * C if tA == blas.Trans or tA == blas.ConjTrans
|
||||
// where A is an n×k or k×n matrix, C is an n×n symmetric matrix, and alpha and
|
||||
// beta are scalars.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Ssyrk(ul blas.Uplo, tA blas.Transpose, n, k int, alpha float32, a []float32, lda int, beta float32, c []float32, ldc int) {
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
panic(badUplo)
|
||||
}
|
||||
if tA != blas.Trans && tA != blas.NoTrans && tA != blas.ConjTrans {
|
||||
panic(badTranspose)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
if k < 0 {
|
||||
panic(kLT0)
|
||||
}
|
||||
row, col := k, n
|
||||
if tA == blas.NoTrans {
|
||||
row, col = n, k
|
||||
}
|
||||
if lda < max(1, col) {
|
||||
panic(badLdA)
|
||||
}
|
||||
if ldc < max(1, n) {
|
||||
panic(badLdC)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// For zero matrix size the following slice length checks are trivially satisfied.
|
||||
if len(a) < lda*(row-1)+col {
|
||||
panic(shortA)
|
||||
}
|
||||
if len(c) < ldc*(n-1)+n {
|
||||
panic(shortC)
|
||||
}
|
||||
|
||||
if alpha == 0 {
|
||||
if beta == 0 {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if tA == blas.NoTrans {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
atmp := a[i*lda : i*lda+k]
|
||||
if beta == 0 {
|
||||
for jc := range ctmp {
|
||||
j := jc + i
|
||||
ctmp[jc] = alpha * f32.DotUnitary(atmp, a[j*lda:j*lda+k])
|
||||
}
|
||||
} else {
|
||||
for jc, vc := range ctmp {
|
||||
j := jc + i
|
||||
ctmp[jc] = vc*beta + alpha*f32.DotUnitary(atmp, a[j*lda:j*lda+k])
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
atmp := a[i*lda : i*lda+k]
|
||||
if beta == 0 {
|
||||
for j := range ctmp {
|
||||
ctmp[j] = alpha * f32.DotUnitary(a[j*lda:j*lda+k], atmp)
|
||||
}
|
||||
} else {
|
||||
for j, vc := range ctmp {
|
||||
ctmp[j] = vc*beta + alpha*f32.DotUnitary(a[j*lda:j*lda+k], atmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is transposed.
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
if beta == 0 {
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
} else if beta != 1 {
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
for l := 0; l < k; l++ {
|
||||
tmp := alpha * a[l*lda+i]
|
||||
if tmp != 0 {
|
||||
f32.AxpyUnitary(tmp, a[l*lda+i:l*lda+n], ctmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
if beta != 1 {
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
for l := 0; l < k; l++ {
|
||||
tmp := alpha * a[l*lda+i]
|
||||
if tmp != 0 {
|
||||
f32.AxpyUnitary(tmp, a[l*lda:l*lda+i+1], ctmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ssyr2k performs one of the symmetric rank 2k operations
|
||||
// C = alpha * A * B^T + alpha * B * A^T + beta * C if tA == blas.NoTrans
|
||||
// C = alpha * A^T * B + alpha * B^T * A + beta * C if tA == blas.Trans or tA == blas.ConjTrans
|
||||
// where A and B are n×k or k×n matrices, C is an n×n symmetric matrix, and
|
||||
// alpha and beta are scalars.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Ssyr2k(ul blas.Uplo, tA blas.Transpose, n, k int, alpha float32, a []float32, lda int, b []float32, ldb int, beta float32, c []float32, ldc int) {
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
panic(badUplo)
|
||||
}
|
||||
if tA != blas.Trans && tA != blas.NoTrans && tA != blas.ConjTrans {
|
||||
panic(badTranspose)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
if k < 0 {
|
||||
panic(kLT0)
|
||||
}
|
||||
row, col := k, n
|
||||
if tA == blas.NoTrans {
|
||||
row, col = n, k
|
||||
}
|
||||
if lda < max(1, col) {
|
||||
panic(badLdA)
|
||||
}
|
||||
if ldb < max(1, col) {
|
||||
panic(badLdB)
|
||||
}
|
||||
if ldc < max(1, n) {
|
||||
panic(badLdC)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// For zero matrix size the following slice length checks are trivially satisfied.
|
||||
if len(a) < lda*(row-1)+col {
|
||||
panic(shortA)
|
||||
}
|
||||
if len(b) < ldb*(row-1)+col {
|
||||
panic(shortB)
|
||||
}
|
||||
if len(c) < ldc*(n-1)+n {
|
||||
panic(shortC)
|
||||
}
|
||||
|
||||
if alpha == 0 {
|
||||
if beta == 0 {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if tA == blas.NoTrans {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
atmp := a[i*lda : i*lda+k]
|
||||
btmp := b[i*ldb : i*ldb+k]
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
for jc := range ctmp {
|
||||
j := i + jc
|
||||
var tmp1, tmp2 float32
|
||||
binner := b[j*ldb : j*ldb+k]
|
||||
for l, v := range a[j*lda : j*lda+k] {
|
||||
tmp1 += v * btmp[l]
|
||||
tmp2 += atmp[l] * binner[l]
|
||||
}
|
||||
ctmp[jc] *= beta
|
||||
ctmp[jc] += alpha * (tmp1 + tmp2)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
atmp := a[i*lda : i*lda+k]
|
||||
btmp := b[i*ldb : i*ldb+k]
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
for j := 0; j <= i; j++ {
|
||||
var tmp1, tmp2 float32
|
||||
binner := b[j*ldb : j*ldb+k]
|
||||
for l, v := range a[j*lda : j*lda+k] {
|
||||
tmp1 += v * btmp[l]
|
||||
tmp2 += atmp[l] * binner[l]
|
||||
}
|
||||
ctmp[j] *= beta
|
||||
ctmp[j] += alpha * (tmp1 + tmp2)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
if beta != 1 {
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
for l := 0; l < k; l++ {
|
||||
tmp1 := alpha * b[l*ldb+i]
|
||||
tmp2 := alpha * a[l*lda+i]
|
||||
btmp := b[l*ldb+i : l*ldb+n]
|
||||
if tmp1 != 0 || tmp2 != 0 {
|
||||
for j, v := range a[l*lda+i : l*lda+n] {
|
||||
ctmp[j] += v*tmp1 + btmp[j]*tmp2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
if beta != 1 {
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
for l := 0; l < k; l++ {
|
||||
tmp1 := alpha * b[l*ldb+i]
|
||||
tmp2 := alpha * a[l*lda+i]
|
||||
btmp := b[l*ldb : l*ldb+i+1]
|
||||
if tmp1 != 0 || tmp2 != 0 {
|
||||
for j, v := range a[l*lda : l*lda+i+1] {
|
||||
ctmp[j] += v*tmp1 + btmp[j]*tmp2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Strmm performs one of the matrix-matrix operations
|
||||
// B = alpha * A * B if tA == blas.NoTrans and side == blas.Left
|
||||
// B = alpha * A^T * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Left
|
||||
// B = alpha * B * A if tA == blas.NoTrans and side == blas.Right
|
||||
// B = alpha * B * A^T if tA == blas.Trans or blas.ConjTrans, and side == blas.Right
|
||||
// where A is an n×n or m×m triangular matrix, B is an m×n matrix, and alpha is a scalar.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Strmm(s blas.Side, ul blas.Uplo, tA blas.Transpose, d blas.Diag, m, n int, alpha float32, a []float32, lda int, b []float32, ldb int) {
|
||||
if s != blas.Left && s != blas.Right {
|
||||
panic(badSide)
|
||||
}
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
panic(badUplo)
|
||||
}
|
||||
if tA != blas.NoTrans && tA != blas.Trans && tA != blas.ConjTrans {
|
||||
panic(badTranspose)
|
||||
}
|
||||
if d != blas.NonUnit && d != blas.Unit {
|
||||
panic(badDiag)
|
||||
}
|
||||
if m < 0 {
|
||||
panic(mLT0)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
k := n
|
||||
if s == blas.Left {
|
||||
k = m
|
||||
}
|
||||
if lda < max(1, k) {
|
||||
panic(badLdA)
|
||||
}
|
||||
if ldb < max(1, n) {
|
||||
panic(badLdB)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if m == 0 || n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// For zero matrix size the following slice length checks are trivially satisfied.
|
||||
if len(a) < lda*(k-1)+k {
|
||||
panic(shortA)
|
||||
}
|
||||
if len(b) < ldb*(m-1)+n {
|
||||
panic(shortB)
|
||||
}
|
||||
|
||||
if alpha == 0 {
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for j := range btmp {
|
||||
btmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
nonUnit := d == blas.NonUnit
|
||||
if s == blas.Left {
|
||||
if tA == blas.NoTrans {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < m; i++ {
|
||||
tmp := alpha
|
||||
if nonUnit {
|
||||
tmp *= a[i*lda+i]
|
||||
}
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
f32.ScalUnitary(tmp, btmp)
|
||||
for ka, va := range a[i*lda+i+1 : i*lda+m] {
|
||||
k := ka + i + 1
|
||||
if va != 0 {
|
||||
f32.AxpyUnitary(alpha*va, b[k*ldb:k*ldb+n], btmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := m - 1; i >= 0; i-- {
|
||||
tmp := alpha
|
||||
if nonUnit {
|
||||
tmp *= a[i*lda+i]
|
||||
}
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
f32.ScalUnitary(tmp, btmp)
|
||||
for k, va := range a[i*lda : i*lda+i] {
|
||||
if va != 0 {
|
||||
f32.AxpyUnitary(alpha*va, b[k*ldb:k*ldb+n], btmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is transposed.
|
||||
if ul == blas.Upper {
|
||||
for k := m - 1; k >= 0; k-- {
|
||||
btmpk := b[k*ldb : k*ldb+n]
|
||||
for ia, va := range a[k*lda+k+1 : k*lda+m] {
|
||||
i := ia + k + 1
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
if va != 0 {
|
||||
f32.AxpyUnitary(alpha*va, btmpk, btmp)
|
||||
}
|
||||
}
|
||||
tmp := alpha
|
||||
if nonUnit {
|
||||
tmp *= a[k*lda+k]
|
||||
}
|
||||
if tmp != 1 {
|
||||
f32.ScalUnitary(tmp, btmpk)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for k := 0; k < m; k++ {
|
||||
btmpk := b[k*ldb : k*ldb+n]
|
||||
for i, va := range a[k*lda : k*lda+k] {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
if va != 0 {
|
||||
f32.AxpyUnitary(alpha*va, btmpk, btmp)
|
||||
}
|
||||
}
|
||||
tmp := alpha
|
||||
if nonUnit {
|
||||
tmp *= a[k*lda+k]
|
||||
}
|
||||
if tmp != 1 {
|
||||
f32.ScalUnitary(tmp, btmpk)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is on the right
|
||||
if tA == blas.NoTrans {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for k := n - 1; k >= 0; k-- {
|
||||
tmp := alpha * btmp[k]
|
||||
if tmp == 0 {
|
||||
continue
|
||||
}
|
||||
btmp[k] = tmp
|
||||
if nonUnit {
|
||||
btmp[k] *= a[k*lda+k]
|
||||
}
|
||||
f32.AxpyUnitary(tmp, a[k*lda+k+1:k*lda+n], btmp[k+1:n])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for k := 0; k < n; k++ {
|
||||
tmp := alpha * btmp[k]
|
||||
if tmp == 0 {
|
||||
continue
|
||||
}
|
||||
btmp[k] = tmp
|
||||
if nonUnit {
|
||||
btmp[k] *= a[k*lda+k]
|
||||
}
|
||||
f32.AxpyUnitary(tmp, a[k*lda:k*lda+k], btmp[:k])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is transposed.
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for j, vb := range btmp {
|
||||
tmp := vb
|
||||
if nonUnit {
|
||||
tmp *= a[j*lda+j]
|
||||
}
|
||||
tmp += f32.DotUnitary(a[j*lda+j+1:j*lda+n], btmp[j+1:n])
|
||||
btmp[j] = alpha * tmp
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for j := n - 1; j >= 0; j-- {
|
||||
tmp := btmp[j]
|
||||
if nonUnit {
|
||||
tmp *= a[j*lda+j]
|
||||
}
|
||||
tmp += f32.DotUnitary(a[j*lda:j*lda+j], btmp[:j])
|
||||
btmp[j] = alpha * tmp
|
||||
}
|
||||
}
|
||||
}
|
864
vendor/gonum.org/v1/gonum/blas/gonum/level3float64.go
generated
vendored
864
vendor/gonum.org/v1/gonum/blas/gonum/level3float64.go
generated
vendored
|
@ -1,864 +0,0 @@
|
|||
// Copyright ©2014 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 gonum
|
||||
|
||||
import (
|
||||
"gonum.org/v1/gonum/blas"
|
||||
"gonum.org/v1/gonum/internal/asm/f64"
|
||||
)
|
||||
|
||||
var _ blas.Float64Level3 = Implementation{}
|
||||
|
||||
// Dtrsm solves one of the matrix equations
|
||||
// A * X = alpha * B if tA == blas.NoTrans and side == blas.Left
|
||||
// A^T * X = alpha * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Left
|
||||
// X * A = alpha * B if tA == blas.NoTrans and side == blas.Right
|
||||
// X * A^T = alpha * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Right
|
||||
// where A is an n×n or m×m triangular matrix, X and B are m×n matrices, and alpha is a
|
||||
// scalar.
|
||||
//
|
||||
// At entry to the function, X contains the values of B, and the result is
|
||||
// stored in-place into X.
|
||||
//
|
||||
// No check is made that A is invertible.
|
||||
func (Implementation) Dtrsm(s blas.Side, ul blas.Uplo, tA blas.Transpose, d blas.Diag, m, n int, alpha float64, a []float64, lda int, b []float64, ldb int) {
|
||||
if s != blas.Left && s != blas.Right {
|
||||
panic(badSide)
|
||||
}
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
panic(badUplo)
|
||||
}
|
||||
if tA != blas.NoTrans && tA != blas.Trans && tA != blas.ConjTrans {
|
||||
panic(badTranspose)
|
||||
}
|
||||
if d != blas.NonUnit && d != blas.Unit {
|
||||
panic(badDiag)
|
||||
}
|
||||
if m < 0 {
|
||||
panic(mLT0)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
k := n
|
||||
if s == blas.Left {
|
||||
k = m
|
||||
}
|
||||
if lda < max(1, k) {
|
||||
panic(badLdA)
|
||||
}
|
||||
if ldb < max(1, n) {
|
||||
panic(badLdB)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if m == 0 || n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// For zero matrix size the following slice length checks are trivially satisfied.
|
||||
if len(a) < lda*(k-1)+k {
|
||||
panic(shortA)
|
||||
}
|
||||
if len(b) < ldb*(m-1)+n {
|
||||
panic(shortB)
|
||||
}
|
||||
|
||||
if alpha == 0 {
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for j := range btmp {
|
||||
btmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
nonUnit := d == blas.NonUnit
|
||||
if s == blas.Left {
|
||||
if tA == blas.NoTrans {
|
||||
if ul == blas.Upper {
|
||||
for i := m - 1; i >= 0; i-- {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
if alpha != 1 {
|
||||
f64.ScalUnitary(alpha, btmp)
|
||||
}
|
||||
for ka, va := range a[i*lda+i+1 : i*lda+m] {
|
||||
if va != 0 {
|
||||
k := ka + i + 1
|
||||
f64.AxpyUnitary(-va, b[k*ldb:k*ldb+n], btmp)
|
||||
}
|
||||
}
|
||||
if nonUnit {
|
||||
tmp := 1 / a[i*lda+i]
|
||||
f64.ScalUnitary(tmp, btmp)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
if alpha != 1 {
|
||||
f64.ScalUnitary(alpha, btmp)
|
||||
}
|
||||
for k, va := range a[i*lda : i*lda+i] {
|
||||
if va != 0 {
|
||||
f64.AxpyUnitary(-va, b[k*ldb:k*ldb+n], btmp)
|
||||
}
|
||||
}
|
||||
if nonUnit {
|
||||
tmp := 1 / a[i*lda+i]
|
||||
f64.ScalUnitary(tmp, btmp)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is transposed
|
||||
if ul == blas.Upper {
|
||||
for k := 0; k < m; k++ {
|
||||
btmpk := b[k*ldb : k*ldb+n]
|
||||
if nonUnit {
|
||||
tmp := 1 / a[k*lda+k]
|
||||
f64.ScalUnitary(tmp, btmpk)
|
||||
}
|
||||
for ia, va := range a[k*lda+k+1 : k*lda+m] {
|
||||
if va != 0 {
|
||||
i := ia + k + 1
|
||||
f64.AxpyUnitary(-va, btmpk, b[i*ldb:i*ldb+n])
|
||||
}
|
||||
}
|
||||
if alpha != 1 {
|
||||
f64.ScalUnitary(alpha, btmpk)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for k := m - 1; k >= 0; k-- {
|
||||
btmpk := b[k*ldb : k*ldb+n]
|
||||
if nonUnit {
|
||||
tmp := 1 / a[k*lda+k]
|
||||
f64.ScalUnitary(tmp, btmpk)
|
||||
}
|
||||
for i, va := range a[k*lda : k*lda+k] {
|
||||
if va != 0 {
|
||||
f64.AxpyUnitary(-va, btmpk, b[i*ldb:i*ldb+n])
|
||||
}
|
||||
}
|
||||
if alpha != 1 {
|
||||
f64.ScalUnitary(alpha, btmpk)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is to the right of X.
|
||||
if tA == blas.NoTrans {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
if alpha != 1 {
|
||||
f64.ScalUnitary(alpha, btmp)
|
||||
}
|
||||
for k, vb := range btmp {
|
||||
if vb == 0 {
|
||||
continue
|
||||
}
|
||||
if nonUnit {
|
||||
btmp[k] /= a[k*lda+k]
|
||||
}
|
||||
f64.AxpyUnitary(-btmp[k], a[k*lda+k+1:k*lda+n], btmp[k+1:n])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
if alpha != 1 {
|
||||
f64.ScalUnitary(alpha, btmp)
|
||||
}
|
||||
for k := n - 1; k >= 0; k-- {
|
||||
if btmp[k] == 0 {
|
||||
continue
|
||||
}
|
||||
if nonUnit {
|
||||
btmp[k] /= a[k*lda+k]
|
||||
}
|
||||
f64.AxpyUnitary(-btmp[k], a[k*lda:k*lda+k], btmp[:k])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is transposed.
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for j := n - 1; j >= 0; j-- {
|
||||
tmp := alpha*btmp[j] - f64.DotUnitary(a[j*lda+j+1:j*lda+n], btmp[j+1:])
|
||||
if nonUnit {
|
||||
tmp /= a[j*lda+j]
|
||||
}
|
||||
btmp[j] = tmp
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for j := 0; j < n; j++ {
|
||||
tmp := alpha*btmp[j] - f64.DotUnitary(a[j*lda:j*lda+j], btmp[:j])
|
||||
if nonUnit {
|
||||
tmp /= a[j*lda+j]
|
||||
}
|
||||
btmp[j] = tmp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dsymm performs one of the matrix-matrix operations
|
||||
// C = alpha * A * B + beta * C if side == blas.Left
|
||||
// C = alpha * B * A + beta * C if side == blas.Right
|
||||
// where A is an n×n or m×m symmetric matrix, B and C are m×n matrices, and alpha
|
||||
// is a scalar.
|
||||
func (Implementation) Dsymm(s blas.Side, ul blas.Uplo, m, n int, alpha float64, a []float64, lda int, b []float64, ldb int, beta float64, c []float64, ldc int) {
|
||||
if s != blas.Right && s != blas.Left {
|
||||
panic(badSide)
|
||||
}
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
panic(badUplo)
|
||||
}
|
||||
if m < 0 {
|
||||
panic(mLT0)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
k := n
|
||||
if s == blas.Left {
|
||||
k = m
|
||||
}
|
||||
if lda < max(1, k) {
|
||||
panic(badLdA)
|
||||
}
|
||||
if ldb < max(1, n) {
|
||||
panic(badLdB)
|
||||
}
|
||||
if ldc < max(1, n) {
|
||||
panic(badLdC)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if m == 0 || n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// For zero matrix size the following slice length checks are trivially satisfied.
|
||||
if len(a) < lda*(k-1)+k {
|
||||
panic(shortA)
|
||||
}
|
||||
if len(b) < ldb*(m-1)+n {
|
||||
panic(shortB)
|
||||
}
|
||||
if len(c) < ldc*(m-1)+n {
|
||||
panic(shortC)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if alpha == 0 && beta == 1 {
|
||||
return
|
||||
}
|
||||
|
||||
if alpha == 0 {
|
||||
if beta == 0 {
|
||||
for i := 0; i < m; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for j := 0; j < n; j++ {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
isUpper := ul == blas.Upper
|
||||
if s == blas.Left {
|
||||
for i := 0; i < m; i++ {
|
||||
atmp := alpha * a[i*lda+i]
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for j, v := range btmp {
|
||||
ctmp[j] *= beta
|
||||
ctmp[j] += atmp * v
|
||||
}
|
||||
|
||||
for k := 0; k < i; k++ {
|
||||
var atmp float64
|
||||
if isUpper {
|
||||
atmp = a[k*lda+i]
|
||||
} else {
|
||||
atmp = a[i*lda+k]
|
||||
}
|
||||
atmp *= alpha
|
||||
f64.AxpyUnitary(atmp, b[k*ldb:k*ldb+n], ctmp)
|
||||
}
|
||||
for k := i + 1; k < m; k++ {
|
||||
var atmp float64
|
||||
if isUpper {
|
||||
atmp = a[i*lda+k]
|
||||
} else {
|
||||
atmp = a[k*lda+i]
|
||||
}
|
||||
atmp *= alpha
|
||||
f64.AxpyUnitary(atmp, b[k*ldb:k*ldb+n], ctmp)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if isUpper {
|
||||
for i := 0; i < m; i++ {
|
||||
for j := n - 1; j >= 0; j-- {
|
||||
tmp := alpha * b[i*ldb+j]
|
||||
var tmp2 float64
|
||||
atmp := a[j*lda+j+1 : j*lda+n]
|
||||
btmp := b[i*ldb+j+1 : i*ldb+n]
|
||||
ctmp := c[i*ldc+j+1 : i*ldc+n]
|
||||
for k, v := range atmp {
|
||||
ctmp[k] += tmp * v
|
||||
tmp2 += btmp[k] * v
|
||||
}
|
||||
c[i*ldc+j] *= beta
|
||||
c[i*ldc+j] += tmp*a[j*lda+j] + alpha*tmp2
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
for j := 0; j < n; j++ {
|
||||
tmp := alpha * b[i*ldb+j]
|
||||
var tmp2 float64
|
||||
atmp := a[j*lda : j*lda+j]
|
||||
btmp := b[i*ldb : i*ldb+j]
|
||||
ctmp := c[i*ldc : i*ldc+j]
|
||||
for k, v := range atmp {
|
||||
ctmp[k] += tmp * v
|
||||
tmp2 += btmp[k] * v
|
||||
}
|
||||
c[i*ldc+j] *= beta
|
||||
c[i*ldc+j] += tmp*a[j*lda+j] + alpha*tmp2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dsyrk performs one of the symmetric rank-k operations
|
||||
// C = alpha * A * A^T + beta * C if tA == blas.NoTrans
|
||||
// C = alpha * A^T * A + beta * C if tA == blas.Trans or tA == blas.ConjTrans
|
||||
// where A is an n×k or k×n matrix, C is an n×n symmetric matrix, and alpha and
|
||||
// beta are scalars.
|
||||
func (Implementation) Dsyrk(ul blas.Uplo, tA blas.Transpose, n, k int, alpha float64, a []float64, lda int, beta float64, c []float64, ldc int) {
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
panic(badUplo)
|
||||
}
|
||||
if tA != blas.Trans && tA != blas.NoTrans && tA != blas.ConjTrans {
|
||||
panic(badTranspose)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
if k < 0 {
|
||||
panic(kLT0)
|
||||
}
|
||||
row, col := k, n
|
||||
if tA == blas.NoTrans {
|
||||
row, col = n, k
|
||||
}
|
||||
if lda < max(1, col) {
|
||||
panic(badLdA)
|
||||
}
|
||||
if ldc < max(1, n) {
|
||||
panic(badLdC)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// For zero matrix size the following slice length checks are trivially satisfied.
|
||||
if len(a) < lda*(row-1)+col {
|
||||
panic(shortA)
|
||||
}
|
||||
if len(c) < ldc*(n-1)+n {
|
||||
panic(shortC)
|
||||
}
|
||||
|
||||
if alpha == 0 {
|
||||
if beta == 0 {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if tA == blas.NoTrans {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
atmp := a[i*lda : i*lda+k]
|
||||
if beta == 0 {
|
||||
for jc := range ctmp {
|
||||
j := jc + i
|
||||
ctmp[jc] = alpha * f64.DotUnitary(atmp, a[j*lda:j*lda+k])
|
||||
}
|
||||
} else {
|
||||
for jc, vc := range ctmp {
|
||||
j := jc + i
|
||||
ctmp[jc] = vc*beta + alpha*f64.DotUnitary(atmp, a[j*lda:j*lda+k])
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
atmp := a[i*lda : i*lda+k]
|
||||
if beta == 0 {
|
||||
for j := range ctmp {
|
||||
ctmp[j] = alpha * f64.DotUnitary(a[j*lda:j*lda+k], atmp)
|
||||
}
|
||||
} else {
|
||||
for j, vc := range ctmp {
|
||||
ctmp[j] = vc*beta + alpha*f64.DotUnitary(a[j*lda:j*lda+k], atmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is transposed.
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
if beta == 0 {
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
} else if beta != 1 {
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
for l := 0; l < k; l++ {
|
||||
tmp := alpha * a[l*lda+i]
|
||||
if tmp != 0 {
|
||||
f64.AxpyUnitary(tmp, a[l*lda+i:l*lda+n], ctmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
if beta != 1 {
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
for l := 0; l < k; l++ {
|
||||
tmp := alpha * a[l*lda+i]
|
||||
if tmp != 0 {
|
||||
f64.AxpyUnitary(tmp, a[l*lda:l*lda+i+1], ctmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dsyr2k performs one of the symmetric rank 2k operations
|
||||
// C = alpha * A * B^T + alpha * B * A^T + beta * C if tA == blas.NoTrans
|
||||
// C = alpha * A^T * B + alpha * B^T * A + beta * C if tA == blas.Trans or tA == blas.ConjTrans
|
||||
// where A and B are n×k or k×n matrices, C is an n×n symmetric matrix, and
|
||||
// alpha and beta are scalars.
|
||||
func (Implementation) Dsyr2k(ul blas.Uplo, tA blas.Transpose, n, k int, alpha float64, a []float64, lda int, b []float64, ldb int, beta float64, c []float64, ldc int) {
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
panic(badUplo)
|
||||
}
|
||||
if tA != blas.Trans && tA != blas.NoTrans && tA != blas.ConjTrans {
|
||||
panic(badTranspose)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
if k < 0 {
|
||||
panic(kLT0)
|
||||
}
|
||||
row, col := k, n
|
||||
if tA == blas.NoTrans {
|
||||
row, col = n, k
|
||||
}
|
||||
if lda < max(1, col) {
|
||||
panic(badLdA)
|
||||
}
|
||||
if ldb < max(1, col) {
|
||||
panic(badLdB)
|
||||
}
|
||||
if ldc < max(1, n) {
|
||||
panic(badLdC)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// For zero matrix size the following slice length checks are trivially satisfied.
|
||||
if len(a) < lda*(row-1)+col {
|
||||
panic(shortA)
|
||||
}
|
||||
if len(b) < ldb*(row-1)+col {
|
||||
panic(shortB)
|
||||
}
|
||||
if len(c) < ldc*(n-1)+n {
|
||||
panic(shortC)
|
||||
}
|
||||
|
||||
if alpha == 0 {
|
||||
if beta == 0 {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if tA == blas.NoTrans {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
atmp := a[i*lda : i*lda+k]
|
||||
btmp := b[i*ldb : i*ldb+k]
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
for jc := range ctmp {
|
||||
j := i + jc
|
||||
var tmp1, tmp2 float64
|
||||
binner := b[j*ldb : j*ldb+k]
|
||||
for l, v := range a[j*lda : j*lda+k] {
|
||||
tmp1 += v * btmp[l]
|
||||
tmp2 += atmp[l] * binner[l]
|
||||
}
|
||||
ctmp[jc] *= beta
|
||||
ctmp[jc] += alpha * (tmp1 + tmp2)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
atmp := a[i*lda : i*lda+k]
|
||||
btmp := b[i*ldb : i*ldb+k]
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
for j := 0; j <= i; j++ {
|
||||
var tmp1, tmp2 float64
|
||||
binner := b[j*ldb : j*ldb+k]
|
||||
for l, v := range a[j*lda : j*lda+k] {
|
||||
tmp1 += v * btmp[l]
|
||||
tmp2 += atmp[l] * binner[l]
|
||||
}
|
||||
ctmp[j] *= beta
|
||||
ctmp[j] += alpha * (tmp1 + tmp2)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc+i : i*ldc+n]
|
||||
if beta != 1 {
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
for l := 0; l < k; l++ {
|
||||
tmp1 := alpha * b[l*ldb+i]
|
||||
tmp2 := alpha * a[l*lda+i]
|
||||
btmp := b[l*ldb+i : l*ldb+n]
|
||||
if tmp1 != 0 || tmp2 != 0 {
|
||||
for j, v := range a[l*lda+i : l*lda+n] {
|
||||
ctmp[j] += v*tmp1 + btmp[j]*tmp2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+i+1]
|
||||
if beta != 1 {
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
for l := 0; l < k; l++ {
|
||||
tmp1 := alpha * b[l*ldb+i]
|
||||
tmp2 := alpha * a[l*lda+i]
|
||||
btmp := b[l*ldb : l*ldb+i+1]
|
||||
if tmp1 != 0 || tmp2 != 0 {
|
||||
for j, v := range a[l*lda : l*lda+i+1] {
|
||||
ctmp[j] += v*tmp1 + btmp[j]*tmp2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dtrmm performs one of the matrix-matrix operations
|
||||
// B = alpha * A * B if tA == blas.NoTrans and side == blas.Left
|
||||
// B = alpha * A^T * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Left
|
||||
// B = alpha * B * A if tA == blas.NoTrans and side == blas.Right
|
||||
// B = alpha * B * A^T if tA == blas.Trans or blas.ConjTrans, and side == blas.Right
|
||||
// where A is an n×n or m×m triangular matrix, B is an m×n matrix, and alpha is a scalar.
|
||||
func (Implementation) Dtrmm(s blas.Side, ul blas.Uplo, tA blas.Transpose, d blas.Diag, m, n int, alpha float64, a []float64, lda int, b []float64, ldb int) {
|
||||
if s != blas.Left && s != blas.Right {
|
||||
panic(badSide)
|
||||
}
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
panic(badUplo)
|
||||
}
|
||||
if tA != blas.NoTrans && tA != blas.Trans && tA != blas.ConjTrans {
|
||||
panic(badTranspose)
|
||||
}
|
||||
if d != blas.NonUnit && d != blas.Unit {
|
||||
panic(badDiag)
|
||||
}
|
||||
if m < 0 {
|
||||
panic(mLT0)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
k := n
|
||||
if s == blas.Left {
|
||||
k = m
|
||||
}
|
||||
if lda < max(1, k) {
|
||||
panic(badLdA)
|
||||
}
|
||||
if ldb < max(1, n) {
|
||||
panic(badLdB)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if m == 0 || n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// For zero matrix size the following slice length checks are trivially satisfied.
|
||||
if len(a) < lda*(k-1)+k {
|
||||
panic(shortA)
|
||||
}
|
||||
if len(b) < ldb*(m-1)+n {
|
||||
panic(shortB)
|
||||
}
|
||||
|
||||
if alpha == 0 {
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for j := range btmp {
|
||||
btmp[j] = 0
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
nonUnit := d == blas.NonUnit
|
||||
if s == blas.Left {
|
||||
if tA == blas.NoTrans {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < m; i++ {
|
||||
tmp := alpha
|
||||
if nonUnit {
|
||||
tmp *= a[i*lda+i]
|
||||
}
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
f64.ScalUnitary(tmp, btmp)
|
||||
for ka, va := range a[i*lda+i+1 : i*lda+m] {
|
||||
k := ka + i + 1
|
||||
if va != 0 {
|
||||
f64.AxpyUnitary(alpha*va, b[k*ldb:k*ldb+n], btmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := m - 1; i >= 0; i-- {
|
||||
tmp := alpha
|
||||
if nonUnit {
|
||||
tmp *= a[i*lda+i]
|
||||
}
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
f64.ScalUnitary(tmp, btmp)
|
||||
for k, va := range a[i*lda : i*lda+i] {
|
||||
if va != 0 {
|
||||
f64.AxpyUnitary(alpha*va, b[k*ldb:k*ldb+n], btmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is transposed.
|
||||
if ul == blas.Upper {
|
||||
for k := m - 1; k >= 0; k-- {
|
||||
btmpk := b[k*ldb : k*ldb+n]
|
||||
for ia, va := range a[k*lda+k+1 : k*lda+m] {
|
||||
i := ia + k + 1
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
if va != 0 {
|
||||
f64.AxpyUnitary(alpha*va, btmpk, btmp)
|
||||
}
|
||||
}
|
||||
tmp := alpha
|
||||
if nonUnit {
|
||||
tmp *= a[k*lda+k]
|
||||
}
|
||||
if tmp != 1 {
|
||||
f64.ScalUnitary(tmp, btmpk)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for k := 0; k < m; k++ {
|
||||
btmpk := b[k*ldb : k*ldb+n]
|
||||
for i, va := range a[k*lda : k*lda+k] {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
if va != 0 {
|
||||
f64.AxpyUnitary(alpha*va, btmpk, btmp)
|
||||
}
|
||||
}
|
||||
tmp := alpha
|
||||
if nonUnit {
|
||||
tmp *= a[k*lda+k]
|
||||
}
|
||||
if tmp != 1 {
|
||||
f64.ScalUnitary(tmp, btmpk)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is on the right
|
||||
if tA == blas.NoTrans {
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for k := n - 1; k >= 0; k-- {
|
||||
tmp := alpha * btmp[k]
|
||||
if tmp == 0 {
|
||||
continue
|
||||
}
|
||||
btmp[k] = tmp
|
||||
if nonUnit {
|
||||
btmp[k] *= a[k*lda+k]
|
||||
}
|
||||
f64.AxpyUnitary(tmp, a[k*lda+k+1:k*lda+n], btmp[k+1:n])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for k := 0; k < n; k++ {
|
||||
tmp := alpha * btmp[k]
|
||||
if tmp == 0 {
|
||||
continue
|
||||
}
|
||||
btmp[k] = tmp
|
||||
if nonUnit {
|
||||
btmp[k] *= a[k*lda+k]
|
||||
}
|
||||
f64.AxpyUnitary(tmp, a[k*lda:k*lda+k], btmp[:k])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// Cases where a is transposed.
|
||||
if ul == blas.Upper {
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for j, vb := range btmp {
|
||||
tmp := vb
|
||||
if nonUnit {
|
||||
tmp *= a[j*lda+j]
|
||||
}
|
||||
tmp += f64.DotUnitary(a[j*lda+j+1:j*lda+n], btmp[j+1:n])
|
||||
btmp[j] = alpha * tmp
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for i := 0; i < m; i++ {
|
||||
btmp := b[i*ldb : i*ldb+n]
|
||||
for j := n - 1; j >= 0; j-- {
|
||||
tmp := btmp[j]
|
||||
if nonUnit {
|
||||
tmp *= a[j*lda+j]
|
||||
}
|
||||
tmp += f64.DotUnitary(a[j*lda:j*lda+j], btmp[:j])
|
||||
btmp[j] = alpha * tmp
|
||||
}
|
||||
}
|
||||
}
|
318
vendor/gonum.org/v1/gonum/blas/gonum/sgemm.go
generated
vendored
318
vendor/gonum.org/v1/gonum/blas/gonum/sgemm.go
generated
vendored
|
@ -1,318 +0,0 @@
|
|||
// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.
|
||||
|
||||
// Copyright ©2014 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 gonum
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"sync"
|
||||
|
||||
"gonum.org/v1/gonum/blas"
|
||||
"gonum.org/v1/gonum/internal/asm/f32"
|
||||
)
|
||||
|
||||
// Sgemm performs one of the matrix-matrix operations
|
||||
// C = alpha * A * B + beta * C
|
||||
// C = alpha * A^T * B + beta * C
|
||||
// C = alpha * A * B^T + beta * C
|
||||
// C = alpha * A^T * B^T + beta * C
|
||||
// where A is an m×k or k×m dense matrix, B is an n×k or k×n dense matrix, C is
|
||||
// an m×n matrix, and alpha and beta are scalars. tA and tB specify whether A or
|
||||
// B are transposed.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Sgemm(tA, tB blas.Transpose, m, n, k int, alpha float32, a []float32, lda int, b []float32, ldb int, beta float32, c []float32, ldc int) {
|
||||
switch tA {
|
||||
default:
|
||||
panic(badTranspose)
|
||||
case blas.NoTrans, blas.Trans, blas.ConjTrans:
|
||||
}
|
||||
switch tB {
|
||||
default:
|
||||
panic(badTranspose)
|
||||
case blas.NoTrans, blas.Trans, blas.ConjTrans:
|
||||
}
|
||||
if m < 0 {
|
||||
panic(mLT0)
|
||||
}
|
||||
if n < 0 {
|
||||
panic(nLT0)
|
||||
}
|
||||
if k < 0 {
|
||||
panic(kLT0)
|
||||
}
|
||||
aTrans := tA == blas.Trans || tA == blas.ConjTrans
|
||||
if aTrans {
|
||||
if lda < max(1, m) {
|
||||
panic(badLdA)
|
||||
}
|
||||
} else {
|
||||
if lda < max(1, k) {
|
||||
panic(badLdA)
|
||||
}
|
||||
}
|
||||
bTrans := tB == blas.Trans || tB == blas.ConjTrans
|
||||
if bTrans {
|
||||
if ldb < max(1, k) {
|
||||
panic(badLdB)
|
||||
}
|
||||
} else {
|
||||
if ldb < max(1, n) {
|
||||
panic(badLdB)
|
||||
}
|
||||
}
|
||||
if ldc < max(1, n) {
|
||||
panic(badLdC)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if m == 0 || n == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// For zero matrix size the following slice length checks are trivially satisfied.
|
||||
if aTrans {
|
||||
if len(a) < (k-1)*lda+m {
|
||||
panic(shortA)
|
||||
}
|
||||
} else {
|
||||
if len(a) < (m-1)*lda+k {
|
||||
panic(shortA)
|
||||
}
|
||||
}
|
||||
if bTrans {
|
||||
if len(b) < (n-1)*ldb+k {
|
||||
panic(shortB)
|
||||
}
|
||||
} else {
|
||||
if len(b) < (k-1)*ldb+n {
|
||||
panic(shortB)
|
||||
}
|
||||
}
|
||||
if len(c) < (m-1)*ldc+n {
|
||||
panic(shortC)
|
||||
}
|
||||
|
||||
// Quick return if possible.
|
||||
if (alpha == 0 || k == 0) && beta == 1 {
|
||||
return
|
||||
}
|
||||
|
||||
// scale c
|
||||
if beta != 1 {
|
||||
if beta == 0 {
|
||||
for i := 0; i < m; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] = 0
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for i := 0; i < m; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for j := range ctmp {
|
||||
ctmp[j] *= beta
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sgemmParallel(aTrans, bTrans, m, n, k, a, lda, b, ldb, c, ldc, alpha)
|
||||
}
|
||||
|
||||
func sgemmParallel(aTrans, bTrans bool, m, n, k int, a []float32, lda int, b []float32, ldb int, c []float32, ldc int, alpha float32) {
|
||||
// dgemmParallel computes a parallel matrix multiplication by partitioning
|
||||
// a and b into sub-blocks, and updating c with the multiplication of the sub-block
|
||||
// In all cases,
|
||||
// A = [ A_11 A_12 ... A_1j
|
||||
// A_21 A_22 ... A_2j
|
||||
// ...
|
||||
// A_i1 A_i2 ... A_ij]
|
||||
//
|
||||
// and same for B. All of the submatrix sizes are blockSize×blockSize except
|
||||
// at the edges.
|
||||
//
|
||||
// In all cases, there is one dimension for each matrix along which
|
||||
// C must be updated sequentially.
|
||||
// Cij = \sum_k Aik Bki, (A * B)
|
||||
// Cij = \sum_k Aki Bkj, (A^T * B)
|
||||
// Cij = \sum_k Aik Bjk, (A * B^T)
|
||||
// Cij = \sum_k Aki Bjk, (A^T * B^T)
|
||||
//
|
||||
// This code computes one {i, j} block sequentially along the k dimension,
|
||||
// and computes all of the {i, j} blocks concurrently. This
|
||||
// partitioning allows Cij to be updated in-place without race-conditions.
|
||||
// Instead of launching a goroutine for each possible concurrent computation,
|
||||
// a number of worker goroutines are created and channels are used to pass
|
||||
// available and completed cases.
|
||||
//
|
||||
// http://alexkr.com/docs/matrixmult.pdf is a good reference on matrix-matrix
|
||||
// multiplies, though this code does not copy matrices to attempt to eliminate
|
||||
// cache misses.
|
||||
|
||||
maxKLen := k
|
||||
parBlocks := blocks(m, blockSize) * blocks(n, blockSize)
|
||||
if parBlocks < minParBlock {
|
||||
// The matrix multiplication is small in the dimensions where it can be
|
||||
// computed concurrently. Just do it in serial.
|
||||
sgemmSerial(aTrans, bTrans, m, n, k, a, lda, b, ldb, c, ldc, alpha)
|
||||
return
|
||||
}
|
||||
|
||||
nWorkers := runtime.GOMAXPROCS(0)
|
||||
if parBlocks < nWorkers {
|
||||
nWorkers = parBlocks
|
||||
}
|
||||
// There is a tradeoff between the workers having to wait for work
|
||||
// and a large buffer making operations slow.
|
||||
buf := buffMul * nWorkers
|
||||
if buf > parBlocks {
|
||||
buf = parBlocks
|
||||
}
|
||||
|
||||
sendChan := make(chan subMul, buf)
|
||||
|
||||
// Launch workers. A worker receives an {i, j} submatrix of c, and computes
|
||||
// A_ik B_ki (or the transposed version) storing the result in c_ij. When the
|
||||
// channel is finally closed, it signals to the waitgroup that it has finished
|
||||
// computing.
|
||||
var wg sync.WaitGroup
|
||||
for i := 0; i < nWorkers; i++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for sub := range sendChan {
|
||||
i := sub.i
|
||||
j := sub.j
|
||||
leni := blockSize
|
||||
if i+leni > m {
|
||||
leni = m - i
|
||||
}
|
||||
lenj := blockSize
|
||||
if j+lenj > n {
|
||||
lenj = n - j
|
||||
}
|
||||
|
||||
cSub := sliceView32(c, ldc, i, j, leni, lenj)
|
||||
|
||||
// Compute A_ik B_kj for all k
|
||||
for k := 0; k < maxKLen; k += blockSize {
|
||||
lenk := blockSize
|
||||
if k+lenk > maxKLen {
|
||||
lenk = maxKLen - k
|
||||
}
|
||||
var aSub, bSub []float32
|
||||
if aTrans {
|
||||
aSub = sliceView32(a, lda, k, i, lenk, leni)
|
||||
} else {
|
||||
aSub = sliceView32(a, lda, i, k, leni, lenk)
|
||||
}
|
||||
if bTrans {
|
||||
bSub = sliceView32(b, ldb, j, k, lenj, lenk)
|
||||
} else {
|
||||
bSub = sliceView32(b, ldb, k, j, lenk, lenj)
|
||||
}
|
||||
sgemmSerial(aTrans, bTrans, leni, lenj, lenk, aSub, lda, bSub, ldb, cSub, ldc, alpha)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// Send out all of the {i, j} subblocks for computation.
|
||||
for i := 0; i < m; i += blockSize {
|
||||
for j := 0; j < n; j += blockSize {
|
||||
sendChan <- subMul{
|
||||
i: i,
|
||||
j: j,
|
||||
}
|
||||
}
|
||||
}
|
||||
close(sendChan)
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
// sgemmSerial is serial matrix multiply
|
||||
func sgemmSerial(aTrans, bTrans bool, m, n, k int, a []float32, lda int, b []float32, ldb int, c []float32, ldc int, alpha float32) {
|
||||
switch {
|
||||
case !aTrans && !bTrans:
|
||||
sgemmSerialNotNot(m, n, k, a, lda, b, ldb, c, ldc, alpha)
|
||||
return
|
||||
case aTrans && !bTrans:
|
||||
sgemmSerialTransNot(m, n, k, a, lda, b, ldb, c, ldc, alpha)
|
||||
return
|
||||
case !aTrans && bTrans:
|
||||
sgemmSerialNotTrans(m, n, k, a, lda, b, ldb, c, ldc, alpha)
|
||||
return
|
||||
case aTrans && bTrans:
|
||||
sgemmSerialTransTrans(m, n, k, a, lda, b, ldb, c, ldc, alpha)
|
||||
return
|
||||
default:
|
||||
panic("unreachable")
|
||||
}
|
||||
}
|
||||
|
||||
// sgemmSerial where neither a nor b are transposed
|
||||
func sgemmSerialNotNot(m, n, k int, a []float32, lda int, b []float32, ldb int, c []float32, ldc int, alpha float32) {
|
||||
// This style is used instead of the literal [i*stride +j]) is used because
|
||||
// approximately 5 times faster as of go 1.3.
|
||||
for i := 0; i < m; i++ {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for l, v := range a[i*lda : i*lda+k] {
|
||||
tmp := alpha * v
|
||||
if tmp != 0 {
|
||||
f32.AxpyUnitary(tmp, b[l*ldb:l*ldb+n], ctmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sgemmSerial where neither a is transposed and b is not
|
||||
func sgemmSerialTransNot(m, n, k int, a []float32, lda int, b []float32, ldb int, c []float32, ldc int, alpha float32) {
|
||||
// This style is used instead of the literal [i*stride +j]) is used because
|
||||
// approximately 5 times faster as of go 1.3.
|
||||
for l := 0; l < k; l++ {
|
||||
btmp := b[l*ldb : l*ldb+n]
|
||||
for i, v := range a[l*lda : l*lda+m] {
|
||||
tmp := alpha * v
|
||||
if tmp != 0 {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
f32.AxpyUnitary(tmp, btmp, ctmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sgemmSerial where neither a is not transposed and b is
|
||||
func sgemmSerialNotTrans(m, n, k int, a []float32, lda int, b []float32, ldb int, c []float32, ldc int, alpha float32) {
|
||||
// This style is used instead of the literal [i*stride +j]) is used because
|
||||
// approximately 5 times faster as of go 1.3.
|
||||
for i := 0; i < m; i++ {
|
||||
atmp := a[i*lda : i*lda+k]
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
for j := 0; j < n; j++ {
|
||||
ctmp[j] += alpha * f32.DotUnitary(atmp, b[j*ldb:j*ldb+k])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sgemmSerial where both are transposed
|
||||
func sgemmSerialTransTrans(m, n, k int, a []float32, lda int, b []float32, ldb int, c []float32, ldc int, alpha float32) {
|
||||
// This style is used instead of the literal [i*stride +j]) is used because
|
||||
// approximately 5 times faster as of go 1.3.
|
||||
for l := 0; l < k; l++ {
|
||||
for i, v := range a[l*lda : l*lda+m] {
|
||||
tmp := alpha * v
|
||||
if tmp != 0 {
|
||||
ctmp := c[i*ldc : i*ldc+n]
|
||||
f32.AxpyInc(tmp, b[l:], ctmp, uintptr(n), uintptr(ldb), 1, 0, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func sliceView32(a []float32, lda, i, j, r, c int) []float32 {
|
||||
return a[i*lda+j : (i+r-1)*lda+j+c]
|
||||
}
|
218
vendor/gonum.org/v1/gonum/blas/gonum/single_precision.bash
generated
vendored
218
vendor/gonum.org/v1/gonum/blas/gonum/single_precision.bash
generated
vendored
|
@ -1,218 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# 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.
|
||||
|
||||
WARNINGF32='//\
|
||||
// Float32 implementations are autogenerated and not directly tested.\
|
||||
'
|
||||
WARNINGC64='//\
|
||||
// Complex64 implementations are autogenerated and not directly tested.\
|
||||
'
|
||||
|
||||
# Level1 routines.
|
||||
|
||||
echo Generating level1float32.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level1float32.go
|
||||
cat level1float64.go \
|
||||
| gofmt -r 'blas.Float64Level1 -> blas.Float32Level1' \
|
||||
\
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
| gofmt -r 'blas.DrotmParams -> blas.SrotmParams' \
|
||||
\
|
||||
| gofmt -r 'f64.AxpyInc -> f32.AxpyInc' \
|
||||
| gofmt -r 'f64.AxpyUnitary -> f32.AxpyUnitary' \
|
||||
| gofmt -r 'f64.DotUnitary -> f32.DotUnitary' \
|
||||
| gofmt -r 'f64.ScalInc -> f32.ScalInc' \
|
||||
| gofmt -r 'f64.ScalUnitary -> f32.ScalUnitary' \
|
||||
\
|
||||
| sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1S\2_" \
|
||||
-e 's_^// D_// S_' \
|
||||
-e "s_^\(func (Implementation) \)Id\(.*\)\$_$WARNINGF32\1Is\2_" \
|
||||
-e 's_^// Id_// Is_' \
|
||||
-e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \
|
||||
-e 's_"math"_math "gonum.org/v1/gonum/internal/math32"_' \
|
||||
>> level1float32.go
|
||||
|
||||
echo Generating level1cmplx64.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level1cmplx64.go
|
||||
cat level1cmplx128.go \
|
||||
| gofmt -r 'blas.Complex128Level1 -> blas.Complex64Level1' \
|
||||
\
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
| gofmt -r 'complex128 -> complex64' \
|
||||
\
|
||||
| gofmt -r 'c128.AxpyInc -> c64.AxpyInc' \
|
||||
| gofmt -r 'c128.AxpyUnitary -> c64.AxpyUnitary' \
|
||||
| gofmt -r 'c128.DotcInc -> c64.DotcInc' \
|
||||
| gofmt -r 'c128.DotcUnitary -> c64.DotcUnitary' \
|
||||
| gofmt -r 'c128.DotuInc -> c64.DotuInc' \
|
||||
| gofmt -r 'c128.DotuUnitary -> c64.DotuUnitary' \
|
||||
| gofmt -r 'c128.ScalInc -> c64.ScalInc' \
|
||||
| gofmt -r 'c128.ScalUnitary -> c64.ScalUnitary' \
|
||||
| gofmt -r 'dcabs1 -> scabs1' \
|
||||
\
|
||||
| sed -e "s_^\(func (Implementation) \)Zdot\(.*\)\$_$WARNINGC64\1Cdot\2_" \
|
||||
-e 's_^// Zdot_// Cdot_' \
|
||||
-e "s_^\(func (Implementation) \)Zdscal\(.*\)\$_$WARNINGC64\1Csscal\2_" \
|
||||
-e 's_^// Zdscal_// Csscal_' \
|
||||
-e "s_^\(func (Implementation) \)Z\(.*\)\$_$WARNINGC64\1C\2_" \
|
||||
-e 's_^// Z_// C_' \
|
||||
-e "s_^\(func (Implementation) \)Iz\(.*\)\$_$WARNINGC64\1Ic\2_" \
|
||||
-e 's_^// Iz_// Ic_' \
|
||||
-e "s_^\(func (Implementation) \)Dz\(.*\)\$_$WARNINGC64\1Sc\2_" \
|
||||
-e 's_^// Dz_// Sc_' \
|
||||
-e 's_"gonum.org/v1/gonum/internal/asm/c128"_"gonum.org/v1/gonum/internal/asm/c64"_' \
|
||||
-e 's_"math"_math "gonum.org/v1/gonum/internal/math32"_' \
|
||||
>> level1cmplx64.go
|
||||
|
||||
echo Generating level1float32_sdot.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level1float32_sdot.go
|
||||
cat level1float64_ddot.go \
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
\
|
||||
| gofmt -r 'f64.DotInc -> f32.DotInc' \
|
||||
| gofmt -r 'f64.DotUnitary -> f32.DotUnitary' \
|
||||
\
|
||||
| sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1S\2_" \
|
||||
-e 's_^// D_// S_' \
|
||||
-e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \
|
||||
>> level1float32_sdot.go
|
||||
|
||||
echo Generating level1float32_dsdot.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level1float32_dsdot.go
|
||||
cat level1float64_ddot.go \
|
||||
| gofmt -r '[]float64 -> []float32' \
|
||||
\
|
||||
| gofmt -r 'f64.DotInc -> f32.DdotInc' \
|
||||
| gofmt -r 'f64.DotUnitary -> f32.DdotUnitary' \
|
||||
\
|
||||
| sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1Ds\2_" \
|
||||
-e 's_^// D_// Ds_' \
|
||||
-e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \
|
||||
>> level1float32_dsdot.go
|
||||
|
||||
echo Generating level1float32_sdsdot.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level1float32_sdsdot.go
|
||||
cat level1float64_ddot.go \
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
\
|
||||
| gofmt -r 'f64.DotInc(x, y, f(n), f(incX), f(incY), f(ix), f(iy)) -> alpha + float32(f32.DdotInc(x, y, f(n), f(incX), f(incY), f(ix), f(iy)))' \
|
||||
| gofmt -r 'f64.DotUnitary(a, b) -> alpha + float32(f32.DdotUnitary(a, b))' \
|
||||
\
|
||||
| sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1Sds\2_" \
|
||||
-e 's_^// D\(.*\)$_// Sds\1 plus a constant_' \
|
||||
-e 's_\\sum_alpha + \\sum_' \
|
||||
-e 's/n int/n int, alpha float32/' \
|
||||
-e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \
|
||||
>> level1float32_sdsdot.go
|
||||
|
||||
|
||||
# Level2 routines.
|
||||
|
||||
echo Generating level2float32.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level2float32.go
|
||||
cat level2float64.go \
|
||||
| gofmt -r 'blas.Float64Level2 -> blas.Float32Level2' \
|
||||
\
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
\
|
||||
| gofmt -r 'f64.AxpyInc -> f32.AxpyInc' \
|
||||
| gofmt -r 'f64.AxpyIncTo -> f32.AxpyIncTo' \
|
||||
| gofmt -r 'f64.AxpyUnitary -> f32.AxpyUnitary' \
|
||||
| gofmt -r 'f64.AxpyUnitaryTo -> f32.AxpyUnitaryTo' \
|
||||
| gofmt -r 'f64.DotInc -> f32.DotInc' \
|
||||
| gofmt -r 'f64.DotUnitary -> f32.DotUnitary' \
|
||||
| gofmt -r 'f64.ScalInc -> f32.ScalInc' \
|
||||
| gofmt -r 'f64.ScalUnitary -> f32.ScalUnitary' \
|
||||
| gofmt -r 'f64.Ger -> f32.Ger' \
|
||||
\
|
||||
| sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1S\2_" \
|
||||
-e 's_^// D_// S_' \
|
||||
-e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \
|
||||
>> level2float32.go
|
||||
|
||||
echo Generating level2cmplx64.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level2cmplx64.go
|
||||
cat level2cmplx128.go \
|
||||
| gofmt -r 'blas.Complex128Level2 -> blas.Complex64Level2' \
|
||||
\
|
||||
| gofmt -r 'complex128 -> complex64' \
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
\
|
||||
| gofmt -r 'c128.AxpyInc -> c64.AxpyInc' \
|
||||
| gofmt -r 'c128.AxpyUnitary -> c64.AxpyUnitary' \
|
||||
| gofmt -r 'c128.DotuInc -> c64.DotuInc' \
|
||||
| gofmt -r 'c128.DotuUnitary -> c64.DotuUnitary' \
|
||||
| gofmt -r 'c128.ScalInc -> c64.ScalInc' \
|
||||
| gofmt -r 'c128.ScalUnitary -> c64.ScalUnitary' \
|
||||
\
|
||||
| sed -e "s_^\(func (Implementation) \)Z\(.*\)\$_$WARNINGC64\1C\2_" \
|
||||
-e 's_^// Z_// C_' \
|
||||
-e 's_"gonum.org/v1/gonum/internal/asm/c128"_"gonum.org/v1/gonum/internal/asm/c64"_' \
|
||||
-e 's_"math/cmplx"_cmplx "gonum.org/v1/gonum/internal/cmplx64"_' \
|
||||
>> level2cmplx64.go
|
||||
|
||||
# Level3 routines.
|
||||
|
||||
echo Generating level3float32.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level3float32.go
|
||||
cat level3float64.go \
|
||||
| gofmt -r 'blas.Float64Level3 -> blas.Float32Level3' \
|
||||
\
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
\
|
||||
| gofmt -r 'f64.AxpyUnitaryTo -> f32.AxpyUnitaryTo' \
|
||||
| gofmt -r 'f64.AxpyUnitary -> f32.AxpyUnitary' \
|
||||
| gofmt -r 'f64.DotUnitary -> f32.DotUnitary' \
|
||||
| gofmt -r 'f64.ScalUnitary -> f32.ScalUnitary' \
|
||||
\
|
||||
| sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1S\2_" \
|
||||
-e 's_^// D_// S_' \
|
||||
-e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \
|
||||
>> level3float32.go
|
||||
|
||||
echo Generating sgemm.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > sgemm.go
|
||||
cat dgemm.go \
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
| gofmt -r 'sliceView64 -> sliceView32' \
|
||||
\
|
||||
| gofmt -r 'dgemmParallel -> sgemmParallel' \
|
||||
| gofmt -r 'computeNumBlocks64 -> computeNumBlocks32' \
|
||||
| gofmt -r 'dgemmSerial -> sgemmSerial' \
|
||||
| gofmt -r 'dgemmSerialNotNot -> sgemmSerialNotNot' \
|
||||
| gofmt -r 'dgemmSerialTransNot -> sgemmSerialTransNot' \
|
||||
| gofmt -r 'dgemmSerialNotTrans -> sgemmSerialNotTrans' \
|
||||
| gofmt -r 'dgemmSerialTransTrans -> sgemmSerialTransTrans' \
|
||||
\
|
||||
| gofmt -r 'f64.AxpyInc -> f32.AxpyInc' \
|
||||
| gofmt -r 'f64.AxpyUnitary -> f32.AxpyUnitary' \
|
||||
| gofmt -r 'f64.DotUnitary -> f32.DotUnitary' \
|
||||
\
|
||||
| sed -e "s_^\(func (Implementation) \)D\(.*\)\$_$WARNINGF32\1S\2_" \
|
||||
-e 's_^// D_// S_' \
|
||||
-e 's_^// d_// s_' \
|
||||
-e 's_"gonum.org/v1/gonum/internal/asm/f64"_"gonum.org/v1/gonum/internal/asm/f32"_' \
|
||||
>> sgemm.go
|
||||
|
||||
echo Generating level3cmplx64.go
|
||||
echo -e '// Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.\n' > level3cmplx64.go
|
||||
cat level3cmplx128.go \
|
||||
| gofmt -r 'blas.Complex128Level3 -> blas.Complex64Level3' \
|
||||
\
|
||||
| gofmt -r 'float64 -> float32' \
|
||||
| gofmt -r 'complex128 -> complex64' \
|
||||
\
|
||||
| gofmt -r 'c128.ScalUnitary -> c64.ScalUnitary' \
|
||||
| gofmt -r 'c128.DscalUnitary -> c64.SscalUnitary' \
|
||||
| gofmt -r 'c128.DotcUnitary -> c64.DotcUnitary' \
|
||||
| gofmt -r 'c128.AxpyUnitary -> c64.AxpyUnitary' \
|
||||
| gofmt -r 'c128.DotuUnitary -> c64.DotuUnitary' \
|
||||
\
|
||||
| sed -e "s_^\(func (Implementation) \)Z\(.*\)\$_$WARNINGC64\1C\2_" \
|
||||
-e 's_^// Z_// C_' \
|
||||
-e 's_"gonum.org/v1/gonum/internal/asm/c128"_"gonum.org/v1/gonum/internal/asm/c64"_' \
|
||||
-e 's_"math/cmplx"_cmplx "gonum.org/v1/gonum/internal/cmplx64"_' \
|
||||
>> level3cmplx64.go
|
4
vendor/gonum.org/v1/gonum/floats/README.md
generated
vendored
4
vendor/gonum.org/v1/gonum/floats/README.md
generated
vendored
|
@ -1,4 +0,0 @@
|
|||
# Gonum floats [](https://godoc.org/gonum.org/v1/gonum/floats)
|
||||
|
||||
Package floats provides a set of helper routines for dealing with slices of float64.
|
||||
The functions avoid allocations to allow for use within tight loops without garbage collection overhead.
|
11
vendor/gonum.org/v1/gonum/floats/doc.go
generated
vendored
11
vendor/gonum.org/v1/gonum/floats/doc.go
generated
vendored
|
@ -1,11 +0,0 @@
|
|||
// Copyright ©2017 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 floats provides a set of helper routines for dealing with slices
|
||||
// of float64. The functions avoid allocations to allow for use within tight
|
||||
// loops without garbage collection overhead.
|
||||
//
|
||||
// The convention used is that when a slice is being modified in place, it has
|
||||
// the name dst.
|
||||
package floats // import "gonum.org/v1/gonum/floats"
|
933
vendor/gonum.org/v1/gonum/floats/floats.go
generated
vendored
933
vendor/gonum.org/v1/gonum/floats/floats.go
generated
vendored
|
@ -1,933 +0,0 @@
|
|||
// Copyright ©2013 The Gonum Authors. All rights reserved.
|
||||
// Use of this code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file
|
||||
|
||||
package floats
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"math"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
"gonum.org/v1/gonum/internal/asm/f64"
|
||||
)
|
||||
|
||||
// Add adds, element-wise, the elements of s and dst, and stores in dst.
|
||||
// Panics if the lengths of dst and s do not match.
|
||||
func Add(dst, s []float64) {
|
||||
if len(dst) != len(s) {
|
||||
panic("floats: length of the slices do not match")
|
||||
}
|
||||
f64.AxpyUnitaryTo(dst, 1, s, dst)
|
||||
}
|
||||
|
||||
// AddTo adds, element-wise, the elements of s and t and
|
||||
// stores the result in dst. Panics if the lengths of s, t and dst do not match.
|
||||
func AddTo(dst, s, t []float64) []float64 {
|
||||
if len(s) != len(t) {
|
||||
panic("floats: length of adders do not match")
|
||||
}
|
||||
if len(dst) != len(s) {
|
||||
panic("floats: length of destination does not match length of adder")
|
||||
}
|
||||
f64.AxpyUnitaryTo(dst, 1, s, t)
|
||||
return dst
|
||||
}
|
||||
|
||||
// AddConst adds the scalar c to all of the values in dst.
|
||||
func AddConst(c float64, dst []float64) {
|
||||
f64.AddConst(c, dst)
|
||||
}
|
||||
|
||||
// AddScaled performs dst = dst + alpha * s.
|
||||
// It panics if the lengths of dst and s are not equal.
|
||||
func AddScaled(dst []float64, alpha float64, s []float64) {
|
||||
if len(dst) != len(s) {
|
||||
panic("floats: length of destination and source to not match")
|
||||
}
|
||||
f64.AxpyUnitaryTo(dst, alpha, s, dst)
|
||||
}
|
||||
|
||||
// AddScaledTo performs dst = y + alpha * s, where alpha is a scalar,
|
||||
// and dst, y and s are all slices.
|
||||
// It panics if the lengths of dst, y, and s are not equal.
|
||||
//
|
||||
// At the return of the function, dst[i] = y[i] + alpha * s[i]
|
||||
func AddScaledTo(dst, y []float64, alpha float64, s []float64) []float64 {
|
||||
if len(dst) != len(s) || len(dst) != len(y) {
|
||||
panic("floats: lengths of slices do not match")
|
||||
}
|
||||
f64.AxpyUnitaryTo(dst, alpha, s, y)
|
||||
return dst
|
||||
}
|
||||
|
||||
// argsort is a helper that implements sort.Interface, as used by
|
||||
// Argsort.
|
||||
type argsort struct {
|
||||
s []float64
|
||||
inds []int
|
||||
}
|
||||
|
||||
func (a argsort) Len() int {
|
||||
return len(a.s)
|
||||
}
|
||||
|
||||
func (a argsort) Less(i, j int) bool {
|
||||
return a.s[i] < a.s[j]
|
||||
}
|
||||
|
||||
func (a argsort) Swap(i, j int) {
|
||||
a.s[i], a.s[j] = a.s[j], a.s[i]
|
||||
a.inds[i], a.inds[j] = a.inds[j], a.inds[i]
|
||||
}
|
||||
|
||||
// Argsort sorts the elements of dst while tracking their original order.
|
||||
// At the conclusion of Argsort, dst will contain the original elements of dst
|
||||
// but sorted in increasing order, and inds will contain the original position
|
||||
// of the elements in the slice such that dst[i] = origDst[inds[i]].
|
||||
// It panics if the lengths of dst and inds do not match.
|
||||
func Argsort(dst []float64, inds []int) {
|
||||
if len(dst) != len(inds) {
|
||||
panic("floats: length of inds does not match length of slice")
|
||||
}
|
||||
for i := range dst {
|
||||
inds[i] = i
|
||||
}
|
||||
|
||||
a := argsort{s: dst, inds: inds}
|
||||
sort.Sort(a)
|
||||
}
|
||||
|
||||
// Count applies the function f to every element of s and returns the number
|
||||
// of times the function returned true.
|
||||
func Count(f func(float64) bool, s []float64) int {
|
||||
var n int
|
||||
for _, val := range s {
|
||||
if f(val) {
|
||||
n++
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// CumProd finds the cumulative product of the first i elements in
|
||||
// s and puts them in place into the ith element of the
|
||||
// destination dst. A panic will occur if the lengths of arguments
|
||||
// do not match.
|
||||
//
|
||||
// At the return of the function, dst[i] = s[i] * s[i-1] * s[i-2] * ...
|
||||
func CumProd(dst, s []float64) []float64 {
|
||||
if len(dst) != len(s) {
|
||||
panic("floats: length of destination does not match length of the source")
|
||||
}
|
||||
if len(dst) == 0 {
|
||||
return dst
|
||||
}
|
||||
return f64.CumProd(dst, s)
|
||||
}
|
||||
|
||||
// CumSum finds the cumulative sum of the first i elements in
|
||||
// s and puts them in place into the ith element of the
|
||||
// destination dst. A panic will occur if the lengths of arguments
|
||||
// do not match.
|
||||
//
|
||||
// At the return of the function, dst[i] = s[i] + s[i-1] + s[i-2] + ...
|
||||
func CumSum(dst, s []float64) []float64 {
|
||||
if len(dst) != len(s) {
|
||||
panic("floats: length of destination does not match length of the source")
|
||||
}
|
||||
if len(dst) == 0 {
|
||||
return dst
|
||||
}
|
||||
return f64.CumSum(dst, s)
|
||||
}
|
||||
|
||||
// Distance computes the L-norm of s - t. See Norm for special cases.
|
||||
// A panic will occur if the lengths of s and t do not match.
|
||||
func Distance(s, t []float64, L float64) float64 {
|
||||
if len(s) != len(t) {
|
||||
panic("floats: slice lengths do not match")
|
||||
}
|
||||
if len(s) == 0 {
|
||||
return 0
|
||||
}
|
||||
var norm float64
|
||||
if L == 2 {
|
||||
for i, v := range s {
|
||||
diff := t[i] - v
|
||||
norm = math.Hypot(norm, diff)
|
||||
}
|
||||
return norm
|
||||
}
|
||||
if L == 1 {
|
||||
for i, v := range s {
|
||||
norm += math.Abs(t[i] - v)
|
||||
}
|
||||
return norm
|
||||
}
|
||||
if math.IsInf(L, 1) {
|
||||
for i, v := range s {
|
||||
absDiff := math.Abs(t[i] - v)
|
||||
if absDiff > norm {
|
||||
norm = absDiff
|
||||
}
|
||||
}
|
||||
return norm
|
||||
}
|
||||
for i, v := range s {
|
||||
norm += math.Pow(math.Abs(t[i]-v), L)
|
||||
}
|
||||
return math.Pow(norm, 1/L)
|
||||
}
|
||||
|
||||
// Div performs element-wise division dst / s
|
||||
// and stores the value in dst. It panics if the
|
||||
// lengths of s and t are not equal.
|
||||
func Div(dst, s []float64) {
|
||||
if len(dst) != len(s) {
|
||||
panic("floats: slice lengths do not match")
|
||||
}
|
||||
f64.Div(dst, s)
|
||||
}
|
||||
|
||||
// DivTo performs element-wise division s / t
|
||||
// and stores the value in dst. It panics if the
|
||||
// lengths of s, t, and dst are not equal.
|
||||
func DivTo(dst, s, t []float64) []float64 {
|
||||
if len(s) != len(t) || len(dst) != len(t) {
|
||||
panic("floats: slice lengths do not match")
|
||||
}
|
||||
return f64.DivTo(dst, s, t)
|
||||
}
|
||||
|
||||
// Dot computes the dot product of s1 and s2, i.e.
|
||||
// sum_{i = 1}^N s1[i]*s2[i].
|
||||
// A panic will occur if lengths of arguments do not match.
|
||||
func Dot(s1, s2 []float64) float64 {
|
||||
if len(s1) != len(s2) {
|
||||
panic("floats: lengths of the slices do not match")
|
||||
}
|
||||
return f64.DotUnitary(s1, s2)
|
||||
}
|
||||
|
||||
// Equal returns true if the slices have equal lengths and
|
||||
// all elements are numerically identical.
|
||||
func Equal(s1, s2 []float64) bool {
|
||||
if len(s1) != len(s2) {
|
||||
return false
|
||||
}
|
||||
for i, val := range s1 {
|
||||
if s2[i] != val {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// EqualApprox returns true if the slices have equal lengths and
|
||||
// all element pairs have an absolute tolerance less than tol or a
|
||||
// relative tolerance less than tol.
|
||||
func EqualApprox(s1, s2 []float64, tol float64) bool {
|
||||
if len(s1) != len(s2) {
|
||||
return false
|
||||
}
|
||||
for i, a := range s1 {
|
||||
if !EqualWithinAbsOrRel(a, s2[i], tol, tol) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// EqualFunc returns true if the slices have the same lengths
|
||||
// and the function returns true for all element pairs.
|
||||
func EqualFunc(s1, s2 []float64, f func(float64, float64) bool) bool {
|
||||
if len(s1) != len(s2) {
|
||||
return false
|
||||
}
|
||||
for i, val := range s1 {
|
||||
if !f(val, s2[i]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// EqualWithinAbs returns true if a and b have an absolute
|
||||
// difference of less than tol.
|
||||
func EqualWithinAbs(a, b, tol float64) bool {
|
||||
return a == b || math.Abs(a-b) <= tol
|
||||
}
|
||||
|
||||
const minNormalFloat64 = 2.2250738585072014e-308
|
||||
|
||||
// EqualWithinRel returns true if the difference between a and b
|
||||
// is not greater than tol times the greater value.
|
||||
func EqualWithinRel(a, b, tol float64) bool {
|
||||
if a == b {
|
||||
return true
|
||||
}
|
||||
delta := math.Abs(a - b)
|
||||
if delta <= minNormalFloat64 {
|
||||
return delta <= tol*minNormalFloat64
|
||||
}
|
||||
// We depend on the division in this relationship to identify
|
||||
// infinities (we rely on the NaN to fail the test) otherwise
|
||||
// we compare Infs of the same sign and evaluate Infs as equal
|
||||
// independent of sign.
|
||||
return delta/math.Max(math.Abs(a), math.Abs(b)) <= tol
|
||||
}
|
||||
|
||||
// EqualWithinAbsOrRel returns true if a and b are equal to within
|
||||
// the absolute tolerance.
|
||||
func EqualWithinAbsOrRel(a, b, absTol, relTol float64) bool {
|
||||
if EqualWithinAbs(a, b, absTol) {
|
||||
return true
|
||||
}
|
||||
return EqualWithinRel(a, b, relTol)
|
||||
}
|
||||
|
||||
// EqualWithinULP returns true if a and b are equal to within
|
||||
// the specified number of floating point units in the last place.
|
||||
func EqualWithinULP(a, b float64, ulp uint) bool {
|
||||
if a == b {
|
||||
return true
|
||||
}
|
||||
if math.IsNaN(a) || math.IsNaN(b) {
|
||||
return false
|
||||
}
|
||||
if math.Signbit(a) != math.Signbit(b) {
|
||||
return math.Float64bits(math.Abs(a))+math.Float64bits(math.Abs(b)) <= uint64(ulp)
|
||||
}
|
||||
return ulpDiff(math.Float64bits(a), math.Float64bits(b)) <= uint64(ulp)
|
||||
}
|
||||
|
||||
func ulpDiff(a, b uint64) uint64 {
|
||||
if a > b {
|
||||
return a - b
|
||||
}
|
||||
return b - a
|
||||
}
|
||||
|
||||
// EqualLengths returns true if all of the slices have equal length,
|
||||
// and false otherwise. Returns true if there are no input slices.
|
||||
func EqualLengths(slices ...[]float64) bool {
|
||||
// This length check is needed: http://play.golang.org/p/sdty6YiLhM
|
||||
if len(slices) == 0 {
|
||||
return true
|
||||
}
|
||||
l := len(slices[0])
|
||||
for i := 1; i < len(slices); i++ {
|
||||
if len(slices[i]) != l {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Find applies f to every element of s and returns the indices of the first
|
||||
// k elements for which the f returns true, or all such elements
|
||||
// if k < 0.
|
||||
// Find will reslice inds to have 0 length, and will append
|
||||
// found indices to inds.
|
||||
// If k > 0 and there are fewer than k elements in s satisfying f,
|
||||
// all of the found elements will be returned along with an error.
|
||||
// At the return of the function, the input inds will be in an undetermined state.
|
||||
func Find(inds []int, f func(float64) bool, s []float64, k int) ([]int, error) {
|
||||
// inds is also returned to allow for calling with nil
|
||||
|
||||
// Reslice inds to have zero length
|
||||
inds = inds[:0]
|
||||
|
||||
// If zero elements requested, can just return
|
||||
if k == 0 {
|
||||
return inds, nil
|
||||
}
|
||||
|
||||
// If k < 0, return all of the found indices
|
||||
if k < 0 {
|
||||
for i, val := range s {
|
||||
if f(val) {
|
||||
inds = append(inds, i)
|
||||
}
|
||||
}
|
||||
return inds, nil
|
||||
}
|
||||
|
||||
// Otherwise, find the first k elements
|
||||
nFound := 0
|
||||
for i, val := range s {
|
||||
if f(val) {
|
||||
inds = append(inds, i)
|
||||
nFound++
|
||||
if nFound == k {
|
||||
return inds, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
// Finished iterating over the loop, which means k elements were not found
|
||||
return inds, errors.New("floats: insufficient elements found")
|
||||
}
|
||||
|
||||
// HasNaN returns true if the slice s has any values that are NaN and false
|
||||
// otherwise.
|
||||
func HasNaN(s []float64) bool {
|
||||
for _, v := range s {
|
||||
if math.IsNaN(v) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// LogSpan returns a set of n equally spaced points in log space between,
|
||||
// l and u where N is equal to len(dst). The first element of the
|
||||
// resulting dst will be l and the final element of dst will be u.
|
||||
// Panics if len(dst) < 2
|
||||
// Note that this call will return NaNs if either l or u are negative, and
|
||||
// will return all zeros if l or u is zero.
|
||||
// Also returns the mutated slice dst, so that it can be used in range, like:
|
||||
//
|
||||
// for i, x := range LogSpan(dst, l, u) { ... }
|
||||
func LogSpan(dst []float64, l, u float64) []float64 {
|
||||
Span(dst, math.Log(l), math.Log(u))
|
||||
for i := range dst {
|
||||
dst[i] = math.Exp(dst[i])
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// LogSumExp returns the log of the sum of the exponentials of the values in s.
|
||||
// Panics if s is an empty slice.
|
||||
func LogSumExp(s []float64) float64 {
|
||||
// Want to do this in a numerically stable way which avoids
|
||||
// overflow and underflow
|
||||
// First, find the maximum value in the slice.
|
||||
maxval := Max(s)
|
||||
if math.IsInf(maxval, 0) {
|
||||
// If it's infinity either way, the logsumexp will be infinity as well
|
||||
// returning now avoids NaNs
|
||||
return maxval
|
||||
}
|
||||
var lse float64
|
||||
// Compute the sumexp part
|
||||
for _, val := range s {
|
||||
lse += math.Exp(val - maxval)
|
||||
}
|
||||
// Take the log and add back on the constant taken out
|
||||
return math.Log(lse) + maxval
|
||||
}
|
||||
|
||||
// Max returns the maximum value in the input slice. If the slice is empty, Max will panic.
|
||||
func Max(s []float64) float64 {
|
||||
return s[MaxIdx(s)]
|
||||
}
|
||||
|
||||
// MaxIdx returns the index of the maximum value in the input slice. If several
|
||||
// entries have the maximum value, the first such index is returned. If the slice
|
||||
// is empty, MaxIdx will panic.
|
||||
func MaxIdx(s []float64) int {
|
||||
if len(s) == 0 {
|
||||
panic("floats: zero slice length")
|
||||
}
|
||||
max := math.NaN()
|
||||
var ind int
|
||||
for i, v := range s {
|
||||
if math.IsNaN(v) {
|
||||
continue
|
||||
}
|
||||
if v > max || math.IsNaN(max) {
|
||||
max = v
|
||||
ind = i
|
||||
}
|
||||
}
|
||||
return ind
|
||||
}
|
||||
|
||||
// Min returns the maximum value in the input slice. If the slice is empty, Min will panic.
|
||||
func Min(s []float64) float64 {
|
||||
return s[MinIdx(s)]
|
||||
}
|
||||
|
||||
// MinIdx returns the index of the minimum value in the input slice. If several
|
||||
// entries have the maximum value, the first such index is returned. If the slice
|
||||
// is empty, MinIdx will panic.
|
||||
func MinIdx(s []float64) int {
|
||||
if len(s) == 0 {
|
||||
panic("floats: zero slice length")
|
||||
}
|
||||
min := math.NaN()
|
||||
var ind int
|
||||
for i, v := range s {
|
||||
if math.IsNaN(v) {
|
||||
continue
|
||||
}
|
||||
if v < min || math.IsNaN(min) {
|
||||
min = v
|
||||
ind = i
|
||||
}
|
||||
}
|
||||
return ind
|
||||
}
|
||||
|
||||
// Mul performs element-wise multiplication between dst
|
||||
// and s and stores the value in dst. Panics if the
|
||||
// lengths of s and t are not equal.
|
||||
func Mul(dst, s []float64) {
|
||||
if len(dst) != len(s) {
|
||||
panic("floats: slice lengths do not match")
|
||||
}
|
||||
for i, val := range s {
|
||||
dst[i] *= val
|
||||
}
|
||||
}
|
||||
|
||||
// MulTo performs element-wise multiplication between s
|
||||
// and t and stores the value in dst. Panics if the
|
||||
// lengths of s, t, and dst are not equal.
|
||||
func MulTo(dst, s, t []float64) []float64 {
|
||||
if len(s) != len(t) || len(dst) != len(t) {
|
||||
panic("floats: slice lengths do not match")
|
||||
}
|
||||
for i, val := range t {
|
||||
dst[i] = val * s[i]
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
const (
|
||||
nanBits = 0x7ff8000000000000
|
||||
nanMask = 0xfff8000000000000
|
||||
)
|
||||
|
||||
// NaNWith returns an IEEE 754 "quiet not-a-number" value with the
|
||||
// payload specified in the low 51 bits of payload.
|
||||
// The NaN returned by math.NaN has a bit pattern equal to NaNWith(1).
|
||||
func NaNWith(payload uint64) float64 {
|
||||
return math.Float64frombits(nanBits | (payload &^ nanMask))
|
||||
}
|
||||
|
||||
// NaNPayload returns the lowest 51 bits payload of an IEEE 754 "quiet
|
||||
// not-a-number". For values of f other than quiet-NaN, NaNPayload
|
||||
// returns zero and false.
|
||||
func NaNPayload(f float64) (payload uint64, ok bool) {
|
||||
b := math.Float64bits(f)
|
||||
if b&nanBits != nanBits {
|
||||
return 0, false
|
||||
}
|
||||
return b &^ nanMask, true
|
||||
}
|
||||
|
||||
// NearestIdx returns the index of the element in s
|
||||
// whose value is nearest to v. If several such
|
||||
// elements exist, the lowest index is returned.
|
||||
// NearestIdx panics if len(s) == 0.
|
||||
func NearestIdx(s []float64, v float64) int {
|
||||
if len(s) == 0 {
|
||||
panic("floats: zero length slice")
|
||||
}
|
||||
switch {
|
||||
case math.IsNaN(v):
|
||||
return 0
|
||||
case math.IsInf(v, 1):
|
||||
return MaxIdx(s)
|
||||
case math.IsInf(v, -1):
|
||||
return MinIdx(s)
|
||||
}
|
||||
var ind int
|
||||
dist := math.NaN()
|
||||
for i, val := range s {
|
||||
newDist := math.Abs(v - val)
|
||||
// A NaN distance will not be closer.
|
||||
if math.IsNaN(newDist) {
|
||||
continue
|
||||
}
|
||||
if newDist < dist || math.IsNaN(dist) {
|
||||
dist = newDist
|
||||
ind = i
|
||||
}
|
||||
}
|
||||
return ind
|
||||
}
|
||||
|
||||
// NearestIdxForSpan return the index of a hypothetical vector created
|
||||
// by Span with length n and bounds l and u whose value is closest
|
||||
// to v. That is, NearestIdxForSpan(n, l, u, v) is equivalent to
|
||||
// Nearest(Span(make([]float64, n),l,u),v) without an allocation.
|
||||
// NearestIdxForSpan panics if n is less than two.
|
||||
func NearestIdxForSpan(n int, l, u float64, v float64) int {
|
||||
if n <= 1 {
|
||||
panic("floats: span must have length >1")
|
||||
}
|
||||
if math.IsNaN(v) {
|
||||
return 0
|
||||
}
|
||||
|
||||
// Special cases for Inf and NaN.
|
||||
switch {
|
||||
case math.IsNaN(l) && !math.IsNaN(u):
|
||||
return n - 1
|
||||
case math.IsNaN(u):
|
||||
return 0
|
||||
case math.IsInf(l, 0) && math.IsInf(u, 0):
|
||||
if l == u {
|
||||
return 0
|
||||
}
|
||||
if n%2 == 1 {
|
||||
if !math.IsInf(v, 0) {
|
||||
return n / 2
|
||||
}
|
||||
if math.Copysign(1, v) == math.Copysign(1, l) {
|
||||
return 0
|
||||
}
|
||||
return n/2 + 1
|
||||
}
|
||||
if math.Copysign(1, v) == math.Copysign(1, l) {
|
||||
return 0
|
||||
}
|
||||
return n / 2
|
||||
case math.IsInf(l, 0):
|
||||
if v == l {
|
||||
return 0
|
||||
}
|
||||
return n - 1
|
||||
case math.IsInf(u, 0):
|
||||
if v == u {
|
||||
return n - 1
|
||||
}
|
||||
return 0
|
||||
case math.IsInf(v, -1):
|
||||
if l <= u {
|
||||
return 0
|
||||
}
|
||||
return n - 1
|
||||
case math.IsInf(v, 1):
|
||||
if u <= l {
|
||||
return 0
|
||||
}
|
||||
return n - 1
|
||||
}
|
||||
|
||||
// Special cases for v outside (l, u) and (u, l).
|
||||
switch {
|
||||
case l < u:
|
||||
if v <= l {
|
||||
return 0
|
||||
}
|
||||
if v >= u {
|
||||
return n - 1
|
||||
}
|
||||
case l > u:
|
||||
if v >= l {
|
||||
return 0
|
||||
}
|
||||
if v <= u {
|
||||
return n - 1
|
||||
}
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
|
||||
// Can't guarantee anything about exactly halfway between
|
||||
// because of floating point weirdness.
|
||||
return int((float64(n)-1)/(u-l)*(v-l) + 0.5)
|
||||
}
|
||||
|
||||
// Norm returns the L norm of the slice S, defined as
|
||||
// (sum_{i=1}^N s[i]^L)^{1/L}
|
||||
// Special cases:
|
||||
// L = math.Inf(1) gives the maximum absolute value.
|
||||
// Does not correctly compute the zero norm (use Count).
|
||||
func Norm(s []float64, L float64) float64 {
|
||||
// Should this complain if L is not positive?
|
||||
// Should this be done in log space for better numerical stability?
|
||||
// would be more cost
|
||||
// maybe only if L is high?
|
||||
if len(s) == 0 {
|
||||
return 0
|
||||
}
|
||||
if L == 2 {
|
||||
twoNorm := math.Abs(s[0])
|
||||
for i := 1; i < len(s); i++ {
|
||||
twoNorm = math.Hypot(twoNorm, s[i])
|
||||
}
|
||||
return twoNorm
|
||||
}
|
||||
var norm float64
|
||||
if L == 1 {
|
||||
for _, val := range s {
|
||||
norm += math.Abs(val)
|
||||
}
|
||||
return norm
|
||||
}
|
||||
if math.IsInf(L, 1) {
|
||||
for _, val := range s {
|
||||
norm = math.Max(norm, math.Abs(val))
|
||||
}
|
||||
return norm
|
||||
}
|
||||
for _, val := range s {
|
||||
norm += math.Pow(math.Abs(val), L)
|
||||
}
|
||||
return math.Pow(norm, 1/L)
|
||||
}
|
||||
|
||||
// ParseWithNA converts the string s to a float64 in v.
|
||||
// If s equals missing, w is returned as 0, otherwise 1.
|
||||
func ParseWithNA(s, missing string) (v, w float64, err error) {
|
||||
if s == missing {
|
||||
return 0, 0, nil
|
||||
}
|
||||
v, err = strconv.ParseFloat(s, 64)
|
||||
if err == nil {
|
||||
w = 1
|
||||
}
|
||||
return v, w, err
|
||||
}
|
||||
|
||||
// Prod returns the product of the elements of the slice.
|
||||
// Returns 1 if len(s) = 0.
|
||||
func Prod(s []float64) float64 {
|
||||
prod := 1.0
|
||||
for _, val := range s {
|
||||
prod *= val
|
||||
}
|
||||
return prod
|
||||
}
|
||||
|
||||
// Reverse reverses the order of elements in the slice.
|
||||
func Reverse(s []float64) {
|
||||
for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
|
||||
s[i], s[j] = s[j], s[i]
|
||||
}
|
||||
}
|
||||
|
||||
// Round returns the half away from zero rounded value of x with prec precision.
|
||||
//
|
||||
// Special cases are:
|
||||
// Round(±0) = +0
|
||||
// Round(±Inf) = ±Inf
|
||||
// Round(NaN) = NaN
|
||||
func Round(x float64, prec int) float64 {
|
||||
if x == 0 {
|
||||
// Make sure zero is returned
|
||||
// without the negative bit set.
|
||||
return 0
|
||||
}
|
||||
// Fast path for positive precision on integers.
|
||||
if prec >= 0 && x == math.Trunc(x) {
|
||||
return x
|
||||
}
|
||||
pow := math.Pow10(prec)
|
||||
intermed := x * pow
|
||||
if math.IsInf(intermed, 0) {
|
||||
return x
|
||||
}
|
||||
if x < 0 {
|
||||
x = math.Ceil(intermed - 0.5)
|
||||
} else {
|
||||
x = math.Floor(intermed + 0.5)
|
||||
}
|
||||
|
||||
if x == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
return x / pow
|
||||
}
|
||||
|
||||
// RoundEven returns the half even rounded value of x with prec precision.
|
||||
//
|
||||
// Special cases are:
|
||||
// RoundEven(±0) = +0
|
||||
// RoundEven(±Inf) = ±Inf
|
||||
// RoundEven(NaN) = NaN
|
||||
func RoundEven(x float64, prec int) float64 {
|
||||
if x == 0 {
|
||||
// Make sure zero is returned
|
||||
// without the negative bit set.
|
||||
return 0
|
||||
}
|
||||
// Fast path for positive precision on integers.
|
||||
if prec >= 0 && x == math.Trunc(x) {
|
||||
return x
|
||||
}
|
||||
pow := math.Pow10(prec)
|
||||
intermed := x * pow
|
||||
if math.IsInf(intermed, 0) {
|
||||
return x
|
||||
}
|
||||
if isHalfway(intermed) {
|
||||
correction, _ := math.Modf(math.Mod(intermed, 2))
|
||||
intermed += correction
|
||||
if intermed > 0 {
|
||||
x = math.Floor(intermed)
|
||||
} else {
|
||||
x = math.Ceil(intermed)
|
||||
}
|
||||
} else {
|
||||
if x < 0 {
|
||||
x = math.Ceil(intermed - 0.5)
|
||||
} else {
|
||||
x = math.Floor(intermed + 0.5)
|
||||
}
|
||||
}
|
||||
|
||||
if x == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
return x / pow
|
||||
}
|
||||
|
||||
func isHalfway(x float64) bool {
|
||||
_, frac := math.Modf(x)
|
||||
frac = math.Abs(frac)
|
||||
return frac == 0.5 || (math.Nextafter(frac, math.Inf(-1)) < 0.5 && math.Nextafter(frac, math.Inf(1)) > 0.5)
|
||||
}
|
||||
|
||||
// Same returns true if the input slices have the same length and the all elements
|
||||
// have the same value with NaN treated as the same.
|
||||
func Same(s, t []float64) bool {
|
||||
if len(s) != len(t) {
|
||||
return false
|
||||
}
|
||||
for i, v := range s {
|
||||
w := t[i]
|
||||
if v != w && !(math.IsNaN(v) && math.IsNaN(w)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Scale multiplies every element in dst by the scalar c.
|
||||
func Scale(c float64, dst []float64) {
|
||||
if len(dst) > 0 {
|
||||
f64.ScalUnitary(c, dst)
|
||||
}
|
||||
}
|
||||
|
||||
// ScaleTo multiplies the elements in s by c and stores the result in dst.
|
||||
func ScaleTo(dst []float64, c float64, s []float64) []float64 {
|
||||
if len(dst) != len(s) {
|
||||
panic("floats: lengths of slices do not match")
|
||||
}
|
||||
if len(dst) > 0 {
|
||||
f64.ScalUnitaryTo(dst, c, s)
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Span returns a set of N equally spaced points between l and u, where N
|
||||
// is equal to the length of the destination. The first element of the destination
|
||||
// is l, the final element of the destination is u.
|
||||
//
|
||||
// Panics if len(dst) < 2.
|
||||
//
|
||||
// Span also returns the mutated slice dst, so that it can be used in range expressions,
|
||||
// like:
|
||||
//
|
||||
// for i, x := range Span(dst, l, u) { ... }
|
||||
func Span(dst []float64, l, u float64) []float64 {
|
||||
n := len(dst)
|
||||
if n < 2 {
|
||||
panic("floats: destination must have length >1")
|
||||
}
|
||||
|
||||
// Special cases for Inf and NaN.
|
||||
switch {
|
||||
case math.IsNaN(l):
|
||||
for i := range dst[:len(dst)-1] {
|
||||
dst[i] = math.NaN()
|
||||
}
|
||||
dst[len(dst)-1] = u
|
||||
return dst
|
||||
case math.IsNaN(u):
|
||||
for i := range dst[1:] {
|
||||
dst[i+1] = math.NaN()
|
||||
}
|
||||
dst[0] = l
|
||||
return dst
|
||||
case math.IsInf(l, 0) && math.IsInf(u, 0):
|
||||
for i := range dst[:len(dst)/2] {
|
||||
dst[i] = l
|
||||
dst[len(dst)-i-1] = u
|
||||
}
|
||||
if len(dst)%2 == 1 {
|
||||
if l != u {
|
||||
dst[len(dst)/2] = 0
|
||||
} else {
|
||||
dst[len(dst)/2] = l
|
||||
}
|
||||
}
|
||||
return dst
|
||||
case math.IsInf(l, 0):
|
||||
for i := range dst[:len(dst)-1] {
|
||||
dst[i] = l
|
||||
}
|
||||
dst[len(dst)-1] = u
|
||||
return dst
|
||||
case math.IsInf(u, 0):
|
||||
for i := range dst[1:] {
|
||||
dst[i+1] = u
|
||||
}
|
||||
dst[0] = l
|
||||
return dst
|
||||
}
|
||||
|
||||
step := (u - l) / float64(n-1)
|
||||
for i := range dst {
|
||||
dst[i] = l + step*float64(i)
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Sub subtracts, element-wise, the elements of s from dst. Panics if
|
||||
// the lengths of dst and s do not match.
|
||||
func Sub(dst, s []float64) {
|
||||
if len(dst) != len(s) {
|
||||
panic("floats: length of the slices do not match")
|
||||
}
|
||||
f64.AxpyUnitaryTo(dst, -1, s, dst)
|
||||
}
|
||||
|
||||
// SubTo subtracts, element-wise, the elements of t from s and
|
||||
// stores the result in dst. Panics if the lengths of s, t and dst do not match.
|
||||
func SubTo(dst, s, t []float64) []float64 {
|
||||
if len(s) != len(t) {
|
||||
panic("floats: length of subtractor and subtractee do not match")
|
||||
}
|
||||
if len(dst) != len(s) {
|
||||
panic("floats: length of destination does not match length of subtractor")
|
||||
}
|
||||
f64.AxpyUnitaryTo(dst, -1, t, s)
|
||||
return dst
|
||||
}
|
||||
|
||||
// Sum returns the sum of the elements of the slice.
|
||||
func Sum(s []float64) float64 {
|
||||
return f64.Sum(s)
|
||||
}
|
||||
|
||||
// Within returns the first index i where s[i] <= v < s[i+1]. Within panics if:
|
||||
// - len(s) < 2
|
||||
// - s is not sorted
|
||||
func Within(s []float64, v float64) int {
|
||||
if len(s) < 2 {
|
||||
panic("floats: slice length less than 2")
|
||||
}
|
||||
if !sort.Float64sAreSorted(s) {
|
||||
panic("floats: input slice not sorted")
|
||||
}
|
||||
if v < s[0] || v >= s[len(s)-1] || math.IsNaN(v) {
|
||||
return -1
|
||||
}
|
||||
for i, f := range s[1:] {
|
||||
if v < f {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
1
vendor/gonum.org/v1/gonum/graph/.gitignore
generated
vendored
1
vendor/gonum.org/v1/gonum/graph/.gitignore
generated
vendored
|
@ -1 +0,0 @@
|
|||
test.out
|
3
vendor/gonum.org/v1/gonum/graph/README.md
generated
vendored
3
vendor/gonum.org/v1/gonum/graph/README.md
generated
vendored
|
@ -1,3 +0,0 @@
|
|||
# Gonum graph [](https://godoc.org/gonum.org/v1/gonum/graph)
|
||||
|
||||
This is a generalized graph package for the Go language.
|
9
vendor/gonum.org/v1/gonum/graph/doc.go
generated
vendored
9
vendor/gonum.org/v1/gonum/graph/doc.go
generated
vendored
|
@ -1,9 +0,0 @@
|
|||
// Copyright ©2014 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 graph defines graph interfaces.
|
||||
//
|
||||
// Routines to test contract compliance by user implemented graph types
|
||||
// are available in gonum.org/v1/gonum/graph/testgraph.
|
||||
package graph // import "gonum.org/v1/gonum/graph"
|
282
vendor/gonum.org/v1/gonum/graph/graph.go
generated
vendored
282
vendor/gonum.org/v1/gonum/graph/graph.go
generated
vendored
|
@ -1,282 +0,0 @@
|
|||
// Copyright ©2014 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 graph
|
||||
|
||||
// Node is a graph node. It returns a graph-unique integer ID.
|
||||
type Node interface {
|
||||
ID() int64
|
||||
}
|
||||
|
||||
// Edge is a graph edge. In directed graphs, the direction of the
|
||||
// edge is given from -> to, otherwise the edge is semantically
|
||||
// unordered.
|
||||
type Edge interface {
|
||||
// From returns the from node of the edge.
|
||||
From() Node
|
||||
|
||||
// To returns the to node of the edge.
|
||||
To() Node
|
||||
|
||||
// ReversedEdge returns an edge that has
|
||||
// the end points of the receiver swapped.
|
||||
ReversedEdge() Edge
|
||||
}
|
||||
|
||||
// WeightedEdge is a weighted graph edge. In directed graphs, the direction
|
||||
// of the edge is given from -> to, otherwise the edge is semantically
|
||||
// unordered.
|
||||
type WeightedEdge interface {
|
||||
Edge
|
||||
Weight() float64
|
||||
}
|
||||
|
||||
// Graph is a generalized graph.
|
||||
type Graph interface {
|
||||
// Node returns the node with the given ID if it exists
|
||||
// in the graph, and nil otherwise.
|
||||
Node(id int64) Node
|
||||
|
||||
// Nodes returns all the nodes in the graph.
|
||||
//
|
||||
// Nodes must not return nil.
|
||||
Nodes() Nodes
|
||||
|
||||
// From returns all nodes that can be reached directly
|
||||
// from the node with the given ID.
|
||||
//
|
||||
// From must not return nil.
|
||||
From(id int64) Nodes
|
||||
|
||||
// HasEdgeBetween returns whether an edge exists between
|
||||
// nodes with IDs xid and yid without considering direction.
|
||||
HasEdgeBetween(xid, yid int64) bool
|
||||
|
||||
// Edge returns the edge from u to v, with IDs uid and vid,
|
||||
// if such an edge exists and nil otherwise. The node v
|
||||
// must be directly reachable from u as defined by the
|
||||
// From method.
|
||||
Edge(uid, vid int64) Edge
|
||||
}
|
||||
|
||||
// Weighted is a weighted graph.
|
||||
type Weighted interface {
|
||||
Graph
|
||||
|
||||
// WeightedEdge returns the weighted edge from u to v
|
||||
// with IDs uid and vid if such an edge exists and
|
||||
// nil otherwise. The node v must be directly
|
||||
// reachable from u as defined by the From method.
|
||||
WeightedEdge(uid, vid int64) WeightedEdge
|
||||
|
||||
// Weight returns the weight for the edge between
|
||||
// x and y with IDs xid and yid if Edge(xid, yid)
|
||||
// returns a non-nil Edge.
|
||||
// If x and y are the same node or there is no
|
||||
// joining edge between the two nodes the weight
|
||||
// value returned is implementation dependent.
|
||||
// Weight returns true if an edge exists between
|
||||
// x and y or if x and y have the same ID, false
|
||||
// otherwise.
|
||||
Weight(xid, yid int64) (w float64, ok bool)
|
||||
}
|
||||
|
||||
// Undirected is an undirected graph.
|
||||
type Undirected interface {
|
||||
Graph
|
||||
|
||||
// EdgeBetween returns the edge between nodes x and y
|
||||
// with IDs xid and yid.
|
||||
EdgeBetween(xid, yid int64) Edge
|
||||
}
|
||||
|
||||
// WeightedUndirected is a weighted undirected graph.
|
||||
type WeightedUndirected interface {
|
||||
Weighted
|
||||
|
||||
// WeightedEdgeBetween returns the edge between nodes
|
||||
// x and y with IDs xid and yid.
|
||||
WeightedEdgeBetween(xid, yid int64) WeightedEdge
|
||||
}
|
||||
|
||||
// Directed is a directed graph.
|
||||
type Directed interface {
|
||||
Graph
|
||||
|
||||
// HasEdgeFromTo returns whether an edge exists
|
||||
// in the graph from u to v with IDs uid and vid.
|
||||
HasEdgeFromTo(uid, vid int64) bool
|
||||
|
||||
// To returns all nodes that can reach directly
|
||||
// to the node with the given ID.
|
||||
//
|
||||
// To must not return nil.
|
||||
To(id int64) Nodes
|
||||
}
|
||||
|
||||
// WeightedDirected is a weighted directed graph.
|
||||
type WeightedDirected interface {
|
||||
Weighted
|
||||
|
||||
// HasEdgeFromTo returns whether an edge exists
|
||||
// in the graph from u to v with the IDs uid and
|
||||
// vid.
|
||||
HasEdgeFromTo(uid, vid int64) bool
|
||||
|
||||
// To returns all nodes that can reach directly
|
||||
// to the node with the given ID.
|
||||
//
|
||||
// To must not return nil.
|
||||
To(id int64) Nodes
|
||||
}
|
||||
|
||||
// NodeAdder is an interface for adding arbitrary nodes to a graph.
|
||||
type NodeAdder interface {
|
||||
// NewNode returns a new Node with a unique
|
||||
// arbitrary ID.
|
||||
NewNode() Node
|
||||
|
||||
// AddNode adds a node to the graph. AddNode panics if
|
||||
// the added node ID matches an existing node ID.
|
||||
AddNode(Node)
|
||||
}
|
||||
|
||||
// NodeRemover is an interface for removing nodes from a graph.
|
||||
type NodeRemover interface {
|
||||
// RemoveNode removes the node with the given ID
|
||||
// from the graph, as well as any edges attached
|
||||
// to it. If the node is not in the graph it is
|
||||
// a no-op.
|
||||
RemoveNode(id int64)
|
||||
}
|
||||
|
||||
// EdgeAdder is an interface for adding edges to a graph.
|
||||
type EdgeAdder interface {
|
||||
// NewEdge returns a new Edge from the source to the destination node.
|
||||
NewEdge(from, to Node) Edge
|
||||
|
||||
// SetEdge adds an edge from one node to another.
|
||||
// If the graph supports node addition the nodes
|
||||
// will be added if they do not exist, otherwise
|
||||
// SetEdge will panic.
|
||||
// The behavior of an EdgeAdder when the IDs
|
||||
// returned by e.From() and e.To() are equal is
|
||||
// implementation-dependent.
|
||||
// Whether e, e.From() and e.To() are stored
|
||||
// within the graph is implementation dependent.
|
||||
SetEdge(e Edge)
|
||||
}
|
||||
|
||||
// WeightedEdgeAdder is an interface for adding edges to a graph.
|
||||
type WeightedEdgeAdder interface {
|
||||
// NewWeightedEdge returns a new WeightedEdge from
|
||||
// the source to the destination node.
|
||||
NewWeightedEdge(from, to Node, weight float64) WeightedEdge
|
||||
|
||||
// SetWeightedEdge adds an edge from one node to
|
||||
// another. If the graph supports node addition
|
||||
// the nodes will be added if they do not exist,
|
||||
// otherwise SetWeightedEdge will panic.
|
||||
// The behavior of a WeightedEdgeAdder when the IDs
|
||||
// returned by e.From() and e.To() are equal is
|
||||
// implementation-dependent.
|
||||
// Whether e, e.From() and e.To() are stored
|
||||
// within the graph is implementation dependent.
|
||||
SetWeightedEdge(e WeightedEdge)
|
||||
}
|
||||
|
||||
// EdgeRemover is an interface for removing nodes from a graph.
|
||||
type EdgeRemover interface {
|
||||
// RemoveEdge removes the edge with the given end
|
||||
// IDs, leaving the terminal nodes. If the edge
|
||||
// does not exist it is a no-op.
|
||||
RemoveEdge(fid, tid int64)
|
||||
}
|
||||
|
||||
// Builder is a graph that can have nodes and edges added.
|
||||
type Builder interface {
|
||||
NodeAdder
|
||||
EdgeAdder
|
||||
}
|
||||
|
||||
// WeightedBuilder is a graph that can have nodes and weighted edges added.
|
||||
type WeightedBuilder interface {
|
||||
NodeAdder
|
||||
WeightedEdgeAdder
|
||||
}
|
||||
|
||||
// UndirectedBuilder is an undirected graph builder.
|
||||
type UndirectedBuilder interface {
|
||||
Undirected
|
||||
Builder
|
||||
}
|
||||
|
||||
// UndirectedWeightedBuilder is an undirected weighted graph builder.
|
||||
type UndirectedWeightedBuilder interface {
|
||||
Undirected
|
||||
WeightedBuilder
|
||||
}
|
||||
|
||||
// DirectedBuilder is a directed graph builder.
|
||||
type DirectedBuilder interface {
|
||||
Directed
|
||||
Builder
|
||||
}
|
||||
|
||||
// DirectedWeightedBuilder is a directed weighted graph builder.
|
||||
type DirectedWeightedBuilder interface {
|
||||
Directed
|
||||
WeightedBuilder
|
||||
}
|
||||
|
||||
// Copy copies nodes and edges as undirected edges from the source to the destination
|
||||
// without first clearing the destination. Copy will panic if a node ID in the source
|
||||
// graph matches a node ID in the destination.
|
||||
//
|
||||
// If the source is undirected and the destination is directed both directions will
|
||||
// be present in the destination after the copy is complete.
|
||||
func Copy(dst Builder, src Graph) {
|
||||
nodes := src.Nodes()
|
||||
for nodes.Next() {
|
||||
dst.AddNode(nodes.Node())
|
||||
}
|
||||
nodes.Reset()
|
||||
for nodes.Next() {
|
||||
u := nodes.Node()
|
||||
uid := u.ID()
|
||||
to := src.From(uid)
|
||||
for to.Next() {
|
||||
v := to.Node()
|
||||
dst.SetEdge(src.Edge(uid, v.ID()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CopyWeighted copies nodes and edges as undirected edges from the source to the destination
|
||||
// without first clearing the destination. Copy will panic if a node ID in the source
|
||||
// graph matches a node ID in the destination.
|
||||
//
|
||||
// If the source is undirected and the destination is directed both directions will
|
||||
// be present in the destination after the copy is complete.
|
||||
//
|
||||
// If the source is a directed graph, the destination is undirected, and a fundamental
|
||||
// cycle exists with two nodes where the edge weights differ, the resulting destination
|
||||
// graph's edge weight between those nodes is undefined. If there is a defined function
|
||||
// to resolve such conflicts, an UndirectWeighted may be used to do this.
|
||||
func CopyWeighted(dst WeightedBuilder, src Weighted) {
|
||||
nodes := src.Nodes()
|
||||
for nodes.Next() {
|
||||
dst.AddNode(nodes.Node())
|
||||
}
|
||||
nodes.Reset()
|
||||
for nodes.Next() {
|
||||
u := nodes.Node()
|
||||
uid := u.ID()
|
||||
to := src.From(uid)
|
||||
for to.Next() {
|
||||
v := to.Node()
|
||||
dst.SetWeightedEdge(src.WeightedEdge(uid, v.ID()))
|
||||
}
|
||||
}
|
||||
}
|
6
vendor/gonum.org/v1/gonum/graph/internal/linear/doc.go
generated
vendored
6
vendor/gonum.org/v1/gonum/graph/internal/linear/doc.go
generated
vendored
|
@ -1,6 +0,0 @@
|
|||
// Copyright ©2017 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 linear provides common linear data structures.
|
||||
package linear // import "gonum.org/v1/gonum/graph/internal/linear"
|
73
vendor/gonum.org/v1/gonum/graph/internal/linear/linear.go
generated
vendored
73
vendor/gonum.org/v1/gonum/graph/internal/linear/linear.go
generated
vendored
|
@ -1,73 +0,0 @@
|
|||
// 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 linear
|
||||
|
||||
import (
|
||||
"gonum.org/v1/gonum/graph"
|
||||
)
|
||||
|
||||
// NodeStack implements a LIFO stack of graph.Node.
|
||||
type NodeStack []graph.Node
|
||||
|
||||
// Len returns the number of graph.Nodes on the stack.
|
||||
func (s *NodeStack) Len() int { return len(*s) }
|
||||
|
||||
// Pop returns the last graph.Node on the stack and removes it
|
||||
// from the stack.
|
||||
func (s *NodeStack) Pop() graph.Node {
|
||||
v := *s
|
||||
v, n := v[:len(v)-1], v[len(v)-1]
|
||||
*s = v
|
||||
return n
|
||||
}
|
||||
|
||||
// Push adds the node n to the stack at the last position.
|
||||
func (s *NodeStack) Push(n graph.Node) { *s = append(*s, n) }
|
||||
|
||||
// NodeQueue implements a FIFO queue.
|
||||
type NodeQueue struct {
|
||||
head int
|
||||
data []graph.Node
|
||||
}
|
||||
|
||||
// Len returns the number of graph.Nodes in the queue.
|
||||
func (q *NodeQueue) Len() int { return len(q.data) - q.head }
|
||||
|
||||
// Enqueue adds the node n to the back of the queue.
|
||||
func (q *NodeQueue) Enqueue(n graph.Node) {
|
||||
if len(q.data) == cap(q.data) && q.head > 0 {
|
||||
l := q.Len()
|
||||
copy(q.data, q.data[q.head:])
|
||||
q.head = 0
|
||||
q.data = append(q.data[:l], n)
|
||||
} else {
|
||||
q.data = append(q.data, n)
|
||||
}
|
||||
}
|
||||
|
||||
// Dequeue returns the graph.Node at the front of the queue and
|
||||
// removes it from the queue.
|
||||
func (q *NodeQueue) Dequeue() graph.Node {
|
||||
if q.Len() == 0 {
|
||||
panic("queue: empty queue")
|
||||
}
|
||||
|
||||
var n graph.Node
|
||||
n, q.data[q.head] = q.data[q.head], nil
|
||||
q.head++
|
||||
|
||||
if q.Len() == 0 {
|
||||
q.head = 0
|
||||
q.data = q.data[:0]
|
||||
}
|
||||
|
||||
return n
|
||||
}
|
||||
|
||||
// Reset clears the queue for reuse.
|
||||
func (q *NodeQueue) Reset() {
|
||||
q.head = 0
|
||||
q.data = q.data[:0]
|
||||
}
|
6
vendor/gonum.org/v1/gonum/graph/internal/ordered/doc.go
generated
vendored
6
vendor/gonum.org/v1/gonum/graph/internal/ordered/doc.go
generated
vendored
|
@ -1,6 +0,0 @@
|
|||
// Copyright ©2017 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 ordered provides common sort ordering types.
|
||||
package ordered // import "gonum.org/v1/gonum/graph/internal/ordered"
|
93
vendor/gonum.org/v1/gonum/graph/internal/ordered/sort.go
generated
vendored
93
vendor/gonum.org/v1/gonum/graph/internal/ordered/sort.go
generated
vendored
|
@ -1,93 +0,0 @@
|
|||
// 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 ordered
|
||||
|
||||
import "gonum.org/v1/gonum/graph"
|
||||
|
||||
// ByID implements the sort.Interface sorting a slice of graph.Node
|
||||
// by ID.
|
||||
type ByID []graph.Node
|
||||
|
||||
func (n ByID) Len() int { return len(n) }
|
||||
func (n ByID) Less(i, j int) bool { return n[i].ID() < n[j].ID() }
|
||||
func (n ByID) Swap(i, j int) { n[i], n[j] = n[j], n[i] }
|
||||
|
||||
// BySliceValues implements the sort.Interface sorting a slice of
|
||||
// []int64 lexically by the values of the []int64.
|
||||
type BySliceValues [][]int64
|
||||
|
||||
func (c BySliceValues) Len() int { return len(c) }
|
||||
func (c BySliceValues) Less(i, j int) bool {
|
||||
a, b := c[i], c[j]
|
||||
l := len(a)
|
||||
if len(b) < l {
|
||||
l = len(b)
|
||||
}
|
||||
for k, v := range a[:l] {
|
||||
if v < b[k] {
|
||||
return true
|
||||
}
|
||||
if v > b[k] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return len(a) < len(b)
|
||||
}
|
||||
func (c BySliceValues) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
|
||||
|
||||
// BySliceIDs implements the sort.Interface sorting a slice of
|
||||
// []graph.Node lexically by the IDs of the []graph.Node.
|
||||
type BySliceIDs [][]graph.Node
|
||||
|
||||
func (c BySliceIDs) Len() int { return len(c) }
|
||||
func (c BySliceIDs) Less(i, j int) bool {
|
||||
a, b := c[i], c[j]
|
||||
l := len(a)
|
||||
if len(b) < l {
|
||||
l = len(b)
|
||||
}
|
||||
for k, v := range a[:l] {
|
||||
if v.ID() < b[k].ID() {
|
||||
return true
|
||||
}
|
||||
if v.ID() > b[k].ID() {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return len(a) < len(b)
|
||||
}
|
||||
func (c BySliceIDs) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
|
||||
|
||||
// Int64s implements the sort.Interface sorting a slice of
|
||||
// int64.
|
||||
type Int64s []int64
|
||||
|
||||
func (s Int64s) Len() int { return len(s) }
|
||||
func (s Int64s) Less(i, j int) bool { return s[i] < s[j] }
|
||||
func (s Int64s) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
|
||||
// Reverse reverses the order of nodes.
|
||||
func Reverse(nodes []graph.Node) {
|
||||
for i, j := 0, len(nodes)-1; i < j; i, j = i+1, j-1 {
|
||||
nodes[i], nodes[j] = nodes[j], nodes[i]
|
||||
}
|
||||
}
|
||||
|
||||
// LinesByIDs implements the sort.Interface sorting a slice of graph.LinesByIDs
|
||||
// lexically by the From IDs, then by the To IDs, finally by the Line IDs.
|
||||
type LinesByIDs []graph.Line
|
||||
|
||||
func (n LinesByIDs) Len() int { return len(n) }
|
||||
func (n LinesByIDs) Less(i, j int) bool {
|
||||
a, b := n[i], n[j]
|
||||
if a.From().ID() != b.From().ID() {
|
||||
return a.From().ID() < b.From().ID()
|
||||
}
|
||||
if a.To().ID() != b.To().ID() {
|
||||
return a.To().ID() < b.To().ID()
|
||||
}
|
||||
return n[i].ID() < n[j].ID()
|
||||
}
|
||||
func (n LinesByIDs) Swap(i, j int) { n[i], n[j] = n[j], n[i] }
|
6
vendor/gonum.org/v1/gonum/graph/internal/set/doc.go
generated
vendored
6
vendor/gonum.org/v1/gonum/graph/internal/set/doc.go
generated
vendored
|
@ -1,6 +0,0 @@
|
|||
// Copyright ©2017 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 set provides integer and graph.Node sets.
|
||||
package set // import "gonum.org/v1/gonum/graph/internal/set"
|
36
vendor/gonum.org/v1/gonum/graph/internal/set/same.go
generated
vendored
36
vendor/gonum.org/v1/gonum/graph/internal/set/same.go
generated
vendored
|
@ -1,36 +0,0 @@
|
|||
// Copyright ©2014 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.
|
||||
|
||||
// +build !appengine,!safe
|
||||
|
||||
package set
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// same determines whether two sets are backed by the same store. In the
|
||||
// current implementation using hash maps it makes use of the fact that
|
||||
// hash maps are passed as a pointer to a runtime Hmap struct. A map is
|
||||
// not seen by the runtime as a pointer though, so we use unsafe to get
|
||||
// the maps' pointer values to compare.
|
||||
func same(a, b Nodes) bool {
|
||||
return *(*uintptr)(unsafe.Pointer(&a)) == *(*uintptr)(unsafe.Pointer(&b))
|
||||
}
|
||||
|
||||
// intsSame determines whether two sets are backed by the same store. In the
|
||||
// current implementation using hash maps it makes use of the fact that
|
||||
// hash maps are passed as a pointer to a runtime Hmap struct. A map is
|
||||
// not seen by the runtime as a pointer though, so we use unsafe to get
|
||||
// the maps' pointer values to compare.
|
||||
func intsSame(a, b Ints) bool {
|
||||
return *(*uintptr)(unsafe.Pointer(&a)) == *(*uintptr)(unsafe.Pointer(&b))
|
||||
}
|
||||
|
||||
// int64sSame determines whether two sets are backed by the same store. In the
|
||||
// current implementation using hash maps it makes use of the fact that
|
||||
// hash maps are passed as a pointer to a runtime Hmap struct. A map is
|
||||
// not seen by the runtime as a pointer though, so we use unsafe to get
|
||||
// the maps' pointer values to compare.
|
||||
func int64sSame(a, b Int64s) bool {
|
||||
return *(*uintptr)(unsafe.Pointer(&a)) == *(*uintptr)(unsafe.Pointer(&b))
|
||||
}
|
36
vendor/gonum.org/v1/gonum/graph/internal/set/same_appengine.go
generated
vendored
36
vendor/gonum.org/v1/gonum/graph/internal/set/same_appengine.go
generated
vendored
|
@ -1,36 +0,0 @@
|
|||
// Copyright ©2014 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.
|
||||
|
||||
// +build appengine safe
|
||||
|
||||
package set
|
||||
|
||||
import "reflect"
|
||||
|
||||
// same determines whether two sets are backed by the same store. In the
|
||||
// current implementation using hash maps it makes use of the fact that
|
||||
// hash maps are passed as a pointer to a runtime Hmap struct. A map is
|
||||
// not seen by the runtime as a pointer though, so we use reflect to get
|
||||
// the maps' pointer values to compare.
|
||||
func same(a, b Nodes) bool {
|
||||
return reflect.ValueOf(a).Pointer() == reflect.ValueOf(b).Pointer()
|
||||
}
|
||||
|
||||
// intsSame determines whether two sets are backed by the same store. In the
|
||||
// current implementation using hash maps it makes use of the fact that
|
||||
// hash maps are passed as a pointer to a runtime Hmap struct. A map is
|
||||
// not seen by the runtime as a pointer though, so we use reflect to get
|
||||
// the maps' pointer values to compare.
|
||||
func intsSame(a, b Ints) bool {
|
||||
return reflect.ValueOf(a).Pointer() == reflect.ValueOf(b).Pointer()
|
||||
}
|
||||
|
||||
// int64sSame determines whether two sets are backed by the same store. In the
|
||||
// current implementation using hash maps it makes use of the fact that
|
||||
// hash maps are passed as a pointer to a runtime Hmap struct. A map is
|
||||
// not seen by the runtime as a pointer though, so we use reflect to get
|
||||
// the maps' pointer values to compare.
|
||||
func int64sSame(a, b Int64s) bool {
|
||||
return reflect.ValueOf(a).Pointer() == reflect.ValueOf(b).Pointer()
|
||||
}
|
228
vendor/gonum.org/v1/gonum/graph/internal/set/set.go
generated
vendored
228
vendor/gonum.org/v1/gonum/graph/internal/set/set.go
generated
vendored
|
@ -1,228 +0,0 @@
|
|||
// Copyright ©2014 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 set
|
||||
|
||||
import "gonum.org/v1/gonum/graph"
|
||||
|
||||
// Ints is a set of int identifiers.
|
||||
type Ints map[int]struct{}
|
||||
|
||||
// The simple accessor methods for Ints are provided to allow ease of
|
||||
// implementation change should the need arise.
|
||||
|
||||
// Add inserts an element into the set.
|
||||
func (s Ints) Add(e int) {
|
||||
s[e] = struct{}{}
|
||||
}
|
||||
|
||||
// Has reports the existence of the element in the set.
|
||||
func (s Ints) Has(e int) bool {
|
||||
_, ok := s[e]
|
||||
return ok
|
||||
}
|
||||
|
||||
// Remove deletes the specified element from the set.
|
||||
func (s Ints) Remove(e int) {
|
||||
delete(s, e)
|
||||
}
|
||||
|
||||
// Count reports the number of elements stored in the set.
|
||||
func (s Ints) Count() int {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
// IntsEqual reports set equality between the parameters. Sets are equal if
|
||||
// and only if they have the same elements.
|
||||
func IntsEqual(a, b Ints) bool {
|
||||
if intsSame(a, b) {
|
||||
return true
|
||||
}
|
||||
|
||||
if len(a) != len(b) {
|
||||
return false
|
||||
}
|
||||
|
||||
for e := range a {
|
||||
if _, ok := b[e]; !ok {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Int64s is a set of int64 identifiers.
|
||||
type Int64s map[int64]struct{}
|
||||
|
||||
// The simple accessor methods for Ints are provided to allow ease of
|
||||
// implementation change should the need arise.
|
||||
|
||||
// Add inserts an element into the set.
|
||||
func (s Int64s) Add(e int64) {
|
||||
s[e] = struct{}{}
|
||||
}
|
||||
|
||||
// Has reports the existence of the element in the set.
|
||||
func (s Int64s) Has(e int64) bool {
|
||||
_, ok := s[e]
|
||||
return ok
|
||||
}
|
||||
|
||||
// Remove deletes the specified element from the set.
|
||||
func (s Int64s) Remove(e int64) {
|
||||
delete(s, e)
|
||||
}
|
||||
|
||||
// Count reports the number of elements stored in the set.
|
||||
func (s Int64s) Count() int {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
// Int64sEqual reports set equality between the parameters. Sets are equal if
|
||||
// and only if they have the same elements.
|
||||
func Int64sEqual(a, b Int64s) bool {
|
||||
if int64sSame(a, b) {
|
||||
return true
|
||||
}
|
||||
|
||||
if len(a) != len(b) {
|
||||
return false
|
||||
}
|
||||
|
||||
for e := range a {
|
||||
if _, ok := b[e]; !ok {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Nodes is a set of nodes keyed in their integer identifiers.
|
||||
type Nodes map[int64]graph.Node
|
||||
|
||||
// NewNodes returns a new Nodes.
|
||||
func NewNodes() Nodes {
|
||||
return make(Nodes)
|
||||
}
|
||||
|
||||
// NewNodes returns a new Nodes with the given size hint, n.
|
||||
func NewNodesSize(n int) Nodes {
|
||||
return make(Nodes, n)
|
||||
}
|
||||
|
||||
// The simple accessor methods for Nodes are provided to allow ease of
|
||||
// implementation change should the need arise.
|
||||
|
||||
// Add inserts an element into the set.
|
||||
func (s Nodes) Add(n graph.Node) {
|
||||
s[n.ID()] = n
|
||||
}
|
||||
|
||||
// Remove deletes the specified element from the set.
|
||||
func (s Nodes) Remove(e graph.Node) {
|
||||
delete(s, e.ID())
|
||||
}
|
||||
|
||||
// Count returns the number of element in the set.
|
||||
func (s Nodes) Count() int {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
// Has reports the existence of the elements in the set.
|
||||
func (s Nodes) Has(n graph.Node) bool {
|
||||
_, ok := s[n.ID()]
|
||||
return ok
|
||||
}
|
||||
|
||||
// CloneNodes returns a clone of src.
|
||||
func CloneNodes(src Nodes) Nodes {
|
||||
dst := make(Nodes, len(src))
|
||||
for e, n := range src {
|
||||
dst[e] = n
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Equal reports set equality between the parameters. Sets are equal if
|
||||
// and only if they have the same elements.
|
||||
func Equal(a, b Nodes) bool {
|
||||
if same(a, b) {
|
||||
return true
|
||||
}
|
||||
|
||||
if len(a) != len(b) {
|
||||
return false
|
||||
}
|
||||
|
||||
for e := range a {
|
||||
if _, ok := b[e]; !ok {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// UnionOfNodes returns the union of a and b.
|
||||
//
|
||||
// The union of two sets, a and b, is the set containing all the
|
||||
// elements of each, for instance:
|
||||
//
|
||||
// {a,b,c} UNION {d,e,f} = {a,b,c,d,e,f}
|
||||
//
|
||||
// Since sets may not have repetition, unions of two sets that overlap
|
||||
// do not contain repeat elements, that is:
|
||||
//
|
||||
// {a,b,c} UNION {b,c,d} = {a,b,c,d}
|
||||
//
|
||||
func UnionOfNodes(a, b Nodes) Nodes {
|
||||
if same(a, b) {
|
||||
return CloneNodes(a)
|
||||
}
|
||||
|
||||
dst := make(Nodes)
|
||||
for e, n := range a {
|
||||
dst[e] = n
|
||||
}
|
||||
for e, n := range b {
|
||||
dst[e] = n
|
||||
}
|
||||
|
||||
return dst
|
||||
}
|
||||
|
||||
// IntersectionOfNodes returns the intersection of a and b.
|
||||
//
|
||||
// The intersection of two sets, a and b, is the set containing all
|
||||
// the elements shared between the two sets, for instance:
|
||||
//
|
||||
// {a,b,c} INTERSECT {b,c,d} = {b,c}
|
||||
//
|
||||
// The intersection between a set and itself is itself, and thus
|
||||
// effectively a copy operation:
|
||||
//
|
||||
// {a,b,c} INTERSECT {a,b,c} = {a,b,c}
|
||||
//
|
||||
// The intersection between two sets that share no elements is the empty
|
||||
// set:
|
||||
//
|
||||
// {a,b,c} INTERSECT {d,e,f} = {}
|
||||
//
|
||||
func IntersectionOfNodes(a, b Nodes) Nodes {
|
||||
if same(a, b) {
|
||||
return CloneNodes(a)
|
||||
}
|
||||
dst := make(Nodes)
|
||||
if len(a) > len(b) {
|
||||
a, b = b, a
|
||||
}
|
||||
for e, n := range a {
|
||||
if _, ok := b[e]; ok {
|
||||
dst[e] = n
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
54
vendor/gonum.org/v1/gonum/graph/internal/uid/uid.go
generated
vendored
54
vendor/gonum.org/v1/gonum/graph/internal/uid/uid.go
generated
vendored
|
@ -1,54 +0,0 @@
|
|||
// Copyright ©2014 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 uid implements unique ID provision for graphs.
|
||||
package uid
|
||||
|
||||
import "gonum.org/v1/gonum/graph/internal/set"
|
||||
|
||||
// Max is the maximum value of int64.
|
||||
const Max = int64(^uint64(0) >> 1)
|
||||
|
||||
// Set implements available ID storage.
|
||||
type Set struct {
|
||||
maxID int64
|
||||
used, free set.Int64s
|
||||
}
|
||||
|
||||
// NewSet returns a new Set. The returned value should not be passed except by pointer.
|
||||
func NewSet() Set {
|
||||
return Set{maxID: -1, used: make(set.Int64s), free: make(set.Int64s)}
|
||||
}
|
||||
|
||||
// NewID returns a new unique ID. The ID returned is not considered used
|
||||
// until passed in a call to use.
|
||||
func (s *Set) NewID() int64 {
|
||||
for id := range s.free {
|
||||
return id
|
||||
}
|
||||
if s.maxID != Max {
|
||||
return s.maxID + 1
|
||||
}
|
||||
for id := int64(0); id <= s.maxID+1; id++ {
|
||||
if !s.used.Has(id) {
|
||||
return id
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
// Use adds the id to the used IDs in the Set.
|
||||
func (s *Set) Use(id int64) {
|
||||
s.used.Add(id)
|
||||
s.free.Remove(id)
|
||||
if id > s.maxID {
|
||||
s.maxID = id
|
||||
}
|
||||
}
|
||||
|
||||
// Release frees the id for reuse.
|
||||
func (s *Set) Release(id int64) {
|
||||
s.free.Add(id)
|
||||
s.used.Remove(id)
|
||||
}
|
9
vendor/gonum.org/v1/gonum/graph/iterator/doc.go
generated
vendored
9
vendor/gonum.org/v1/gonum/graph/iterator/doc.go
generated
vendored
|
@ -1,9 +0,0 @@
|
|||
// Copyright ©2018 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 iterator provides node, edge and line iterators.
|
||||
//
|
||||
// The iterators provided satisfy the graph.Nodes, graph.Edges and
|
||||
// graph.Lines interfaces.
|
||||
package iterator
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue