1 // Copyright ©2015 The Gonum Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
7 import "gonum.org/v1/gonum/blas"
9 // SymmetricCols represents a matrix using the conventional column-major storage scheme.
10 type SymmetricCols Symmetric
12 // From fills the receiver with elements from a. The receiver
13 // must have the same dimensions and uplo as a and have adequate
14 // backing data storage.
15 func (t SymmetricCols) From(a Symmetric) {
17 panic("blas64: mismatched dimension")
20 panic("blas64: mismatched BLAS uplo")
24 panic("blas64: bad BLAS uplo")
26 for i := 0; i < a.N; i++ {
27 for j := i; j < a.N; j++ {
28 t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
32 for i := 0; i < a.N; i++ {
33 for j := 0; j <= i; j++ {
34 t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
40 // From fills the receiver with elements from a. The receiver
41 // must have the same dimensions and uplo as a and have adequate
42 // backing data storage.
43 func (t Symmetric) From(a SymmetricCols) {
45 panic("blas64: mismatched dimension")
48 panic("blas64: mismatched BLAS uplo")
52 panic("blas64: bad BLAS uplo")
54 for i := 0; i < a.N; i++ {
55 for j := i; j < a.N; j++ {
56 t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
60 for i := 0; i < a.N; i++ {
61 for j := 0; j <= i; j++ {
62 t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
68 // SymmetricBandCols represents a symmetric matrix using the band column-major storage scheme.
69 type SymmetricBandCols SymmetricBand
71 // From fills the receiver with elements from a. The receiver
72 // must have the same dimensions, bandwidth and uplo as a and
73 // have adequate backing data storage.
74 func (t SymmetricBandCols) From(a SymmetricBand) {
76 panic("blas64: mismatched dimension")
79 panic("blas64: mismatched bandwidth")
82 panic("blas64: short stride for source")
85 panic("blas64: short stride for destination")
88 panic("blas64: mismatched BLAS uplo")
102 panic("blas64: bad BLAS uplo")
113 // From fills the receiver with elements from a. The receiver
114 // must have the same dimensions, bandwidth and uplo as a and
115 // have adequate backing data storage.
116 func (t SymmetricBand) From(a SymmetricBandCols) {
118 panic("blas64: mismatched dimension")
121 panic("blas64: mismatched bandwidth")
123 if a.Stride < a.K+1 {
124 panic("blas64: short stride for source")
126 if t.Stride < t.K+1 {
127 panic("blas64: short stride for destination")
129 if t.Uplo != a.Uplo {
130 panic("blas64: mismatched BLAS uplo")
133 Rows: t.N, Cols: t.N,
138 Rows: a.N, Cols: a.N,
144 panic("blas64: bad BLAS uplo")