gonum.org/v1/gonum@v0.14.0/blas/cblas64/conv_hermitian.go (about)

     1  // Code generated by "go generate gonum.org/v1/gonum/blas”; DO NOT EDIT.
     2  
     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.
     6  
     7  package cblas64
     8  
     9  import "gonum.org/v1/gonum/blas"
    10  
    11  // HermitianCols represents a matrix using the conventional column-major storage scheme.
    12  type HermitianCols Hermitian
    13  
    14  // From fills the receiver with elements from a. The receiver
    15  // must have the same dimensions and uplo as a and have adequate
    16  // backing data storage.
    17  func (t HermitianCols) From(a Hermitian) {
    18  	if t.N != a.N {
    19  		panic("cblas64: mismatched dimension")
    20  	}
    21  	if t.Uplo != a.Uplo {
    22  		panic("cblas64: mismatched BLAS uplo")
    23  	}
    24  	switch a.Uplo {
    25  	default:
    26  		panic("cblas64: bad BLAS uplo")
    27  	case blas.Upper:
    28  		for i := 0; i < a.N; i++ {
    29  			for j := i; j < a.N; j++ {
    30  				t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
    31  			}
    32  		}
    33  	case blas.Lower:
    34  		for i := 0; i < a.N; i++ {
    35  			for j := 0; j <= i; j++ {
    36  				t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
    37  			}
    38  		}
    39  	}
    40  }
    41  
    42  // From fills the receiver with elements from a. The receiver
    43  // must have the same dimensions and uplo as a and have adequate
    44  // backing data storage.
    45  func (t Hermitian) From(a HermitianCols) {
    46  	if t.N != a.N {
    47  		panic("cblas64: mismatched dimension")
    48  	}
    49  	if t.Uplo != a.Uplo {
    50  		panic("cblas64: mismatched BLAS uplo")
    51  	}
    52  	switch a.Uplo {
    53  	default:
    54  		panic("cblas64: bad BLAS uplo")
    55  	case blas.Upper:
    56  		for i := 0; i < a.N; i++ {
    57  			for j := i; j < a.N; j++ {
    58  				t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
    59  			}
    60  		}
    61  	case blas.Lower:
    62  		for i := 0; i < a.N; i++ {
    63  			for j := 0; j <= i; j++ {
    64  				t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
    65  			}
    66  		}
    67  	}
    68  }
    69  
    70  // HermitianBandCols represents an Hermitian matrix using the band column-major storage scheme.
    71  type HermitianBandCols HermitianBand
    72  
    73  // From fills the receiver with elements from a. The receiver
    74  // must have the same dimensions, bandwidth and uplo as a and
    75  // have adequate backing data storage.
    76  func (t HermitianBandCols) From(a HermitianBand) {
    77  	if t.N != a.N {
    78  		panic("cblas64: mismatched dimension")
    79  	}
    80  	if t.K != a.K {
    81  		panic("cblas64: mismatched bandwidth")
    82  	}
    83  	if a.Stride < a.K+1 {
    84  		panic("cblas64: short stride for source")
    85  	}
    86  	if t.Stride < t.K+1 {
    87  		panic("cblas64: short stride for destination")
    88  	}
    89  	if t.Uplo != a.Uplo {
    90  		panic("cblas64: mismatched BLAS uplo")
    91  	}
    92  	dst := BandCols{
    93  		Rows: t.N, Cols: t.N,
    94  		Stride: t.Stride,
    95  		Data:   t.Data,
    96  	}
    97  	src := Band{
    98  		Rows: a.N, Cols: a.N,
    99  		Stride: a.Stride,
   100  		Data:   a.Data,
   101  	}
   102  	switch a.Uplo {
   103  	default:
   104  		panic("cblas64: bad BLAS uplo")
   105  	case blas.Upper:
   106  		dst.KU = t.K
   107  		src.KU = a.K
   108  	case blas.Lower:
   109  		dst.KL = t.K
   110  		src.KL = a.K
   111  	}
   112  	dst.From(src)
   113  }
   114  
   115  // From fills the receiver with elements from a. The receiver
   116  // must have the same dimensions, bandwidth and uplo as a and
   117  // have adequate backing data storage.
   118  func (t HermitianBand) From(a HermitianBandCols) {
   119  	if t.N != a.N {
   120  		panic("cblas64: mismatched dimension")
   121  	}
   122  	if t.K != a.K {
   123  		panic("cblas64: mismatched bandwidth")
   124  	}
   125  	if a.Stride < a.K+1 {
   126  		panic("cblas64: short stride for source")
   127  	}
   128  	if t.Stride < t.K+1 {
   129  		panic("cblas64: short stride for destination")
   130  	}
   131  	if t.Uplo != a.Uplo {
   132  		panic("cblas64: mismatched BLAS uplo")
   133  	}
   134  	dst := Band{
   135  		Rows: t.N, Cols: t.N,
   136  		Stride: t.Stride,
   137  		Data:   t.Data,
   138  	}
   139  	src := BandCols{
   140  		Rows: a.N, Cols: a.N,
   141  		Stride: a.Stride,
   142  		Data:   a.Data,
   143  	}
   144  	switch a.Uplo {
   145  	default:
   146  		panic("cblas64: bad BLAS uplo")
   147  	case blas.Upper:
   148  		dst.KU = t.K
   149  		src.KU = a.K
   150  	case blas.Lower:
   151  		dst.KL = t.K
   152  		src.KL = a.K
   153  	}
   154  	dst.From(src)
   155  }