1 // Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.
3 // Copyright ©2015 The Gonum Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
9 import "gonum.org/v1/gonum/blas"
11 // GeneralCols represents a matrix using the conventional column-major storage scheme.
12 type GeneralCols General
14 // From fills the receiver with elements from a. The receiver
15 // must have the same dimensions as a and have adequate backing
17 func (t GeneralCols) From(a General) {
18 if t.Rows != a.Rows || t.Cols != a.Cols {
19 panic("blas32: mismatched dimension")
21 if len(t.Data) < (t.Cols-1)*t.Stride+t.Rows {
22 panic("blas32: short data slice")
24 for i := 0; i < a.Rows; i++ {
25 for j, v := range a.Data[i*a.Stride : i*a.Stride+a.Cols] {
26 t.Data[i+j*t.Stride] = v
31 // From fills the receiver with elements from a. The receiver
32 // must have the same dimensions as a and have adequate backing
34 func (t General) From(a GeneralCols) {
35 if t.Rows != a.Rows || t.Cols != a.Cols {
36 panic("blas32: mismatched dimension")
38 if len(t.Data) < (t.Rows-1)*t.Stride+t.Cols {
39 panic("blas32: short data slice")
41 for j := 0; j < a.Cols; j++ {
42 for i, v := range a.Data[j*a.Stride : j*a.Stride+a.Rows] {
43 t.Data[i*t.Stride+j] = v
48 // TriangularCols represents a matrix using the conventional column-major storage scheme.
49 type TriangularCols Triangular
51 // From fills the receiver with elements from a. The receiver
52 // must have the same dimensions, uplo and diag as a and have
53 // adequate backing data storage.
54 func (t TriangularCols) From(a Triangular) {
56 panic("blas32: mismatched dimension")
59 panic("blas32: mismatched BLAS uplo")
62 panic("blas32: mismatched BLAS diag")
66 panic("blas32: bad BLAS uplo")
68 for i := 0; i < a.N; i++ {
69 for j := i; j < a.N; j++ {
70 t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
74 for i := 0; i < a.N; i++ {
75 for j := 0; j <= i; j++ {
76 t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
80 for i := 0; i < a.N; i++ {
81 for j := 0; j < a.N; j++ {
82 t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
88 // From fills the receiver with elements from a. The receiver
89 // must have the same dimensions, uplo and diag as a and have
90 // adequate backing data storage.
91 func (t Triangular) From(a TriangularCols) {
93 panic("blas32: mismatched dimension")
96 panic("blas32: mismatched BLAS uplo")
99 panic("blas32: mismatched BLAS diag")
103 panic("blas32: bad BLAS uplo")
105 for i := 0; i < a.N; i++ {
106 for j := i; j < a.N; j++ {
107 t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
111 for i := 0; i < a.N; i++ {
112 for j := 0; j <= i; j++ {
113 t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
117 for i := 0; i < a.N; i++ {
118 for j := 0; j < a.N; j++ {
119 t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
125 // BandCols represents a matrix using the band column-major storage scheme.
128 // From fills the receiver with elements from a. The receiver
129 // must have the same dimensions and bandwidth as a and have
130 // adequate backing data storage.
131 func (t BandCols) From(a Band) {
132 if t.Rows != a.Rows || t.Cols != a.Cols {
133 panic("blas32: mismatched dimension")
135 if t.KL != a.KL || t.KU != a.KU {
136 panic("blas32: mismatched bandwidth")
138 if a.Stride < a.KL+a.KU+1 {
139 panic("blas32: short stride for source")
141 if t.Stride < t.KL+t.KU+1 {
142 panic("blas32: short stride for destination")
144 for i := 0; i < a.Rows; i++ {
145 for j := max(0, i-a.KL); j < min(i+a.KU+1, a.Cols); j++ {
146 t.Data[i+t.KU-j+j*t.Stride] = a.Data[j+a.KL-i+i*a.Stride]
151 // From fills the receiver with elements from a. The receiver
152 // must have the same dimensions and bandwidth as a and have
153 // adequate backing data storage.
154 func (t Band) From(a BandCols) {
155 if t.Rows != a.Rows || t.Cols != a.Cols {
156 panic("blas32: mismatched dimension")
158 if t.KL != a.KL || t.KU != a.KU {
159 panic("blas32: mismatched bandwidth")
161 if a.Stride < a.KL+a.KU+1 {
162 panic("blas32: short stride for source")
164 if t.Stride < t.KL+t.KU+1 {
165 panic("blas32: short stride for destination")
167 for j := 0; j < a.Cols; j++ {
168 for i := max(0, j-a.KU); i < min(j+a.KL+1, a.Rows); i++ {
169 t.Data[j+a.KL-i+i*a.Stride] = a.Data[i+t.KU-j+j*t.Stride]
174 // TriangularBandCols represents a symmetric matrix using the band column-major storage scheme.
175 type TriangularBandCols TriangularBand
177 // From fills the receiver with elements from a. The receiver
178 // must have the same dimensions, bandwidth and uplo as a and
179 // have adequate backing data storage.
180 func (t TriangularBandCols) From(a TriangularBand) {
182 panic("blas32: mismatched dimension")
185 panic("blas32: mismatched bandwidth")
187 if a.Stride < a.K+1 {
188 panic("blas32: short stride for source")
190 if t.Stride < t.K+1 {
191 panic("blas32: short stride for destination")
193 if t.Uplo != a.Uplo {
194 panic("blas32: mismatched BLAS uplo")
196 if t.Diag != a.Diag {
197 panic("blas32: mismatched BLAS diag")
200 Rows: t.N, Cols: t.N,
205 Rows: a.N, Cols: a.N,
211 panic("blas32: bad BLAS uplo")
222 // From fills the receiver with elements from a. The receiver
223 // must have the same dimensions, bandwidth and uplo as a and
224 // have adequate backing data storage.
225 func (t TriangularBand) From(a TriangularBandCols) {
227 panic("blas32: mismatched dimension")
230 panic("blas32: mismatched bandwidth")
232 if a.Stride < a.K+1 {
233 panic("blas32: short stride for source")
235 if t.Stride < t.K+1 {
236 panic("blas32: short stride for destination")
238 if t.Uplo != a.Uplo {
239 panic("blas32: mismatched BLAS uplo")
241 if t.Diag != a.Diag {
242 panic("blas32: mismatched BLAS diag")
245 Rows: t.N, Cols: t.N,
250 Rows: a.N, Cols: a.N,
256 panic("blas32: bad BLAS uplo")
267 func min(a, b int) int {
274 func max(a, b int) int {