OSDN Git Service

new repo
[bytom/vapor.git] / vendor / gonum.org / v1 / gonum / blas / gonum / general_single.go
1 // Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT.
2
3 // Copyright ©2014 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 gonum
8
9 import (
10         math "gonum.org/v1/gonum/internal/math32"
11 )
12
13 type general32 struct {
14         data       []float32
15         rows, cols int
16         stride     int
17 }
18
19 func (g general32) clone() general32 {
20         data := make([]float32, len(g.data))
21         copy(data, g.data)
22         return general32{
23                 data:   data,
24                 rows:   g.rows,
25                 cols:   g.cols,
26                 stride: g.stride,
27         }
28 }
29
30 func (g general32) equal(a general32) bool {
31         if g.rows != a.rows || g.cols != a.cols || g.stride != a.stride {
32                 return false
33         }
34         for i, v := range g.data {
35                 if a.data[i] != v {
36                         return false
37                 }
38         }
39         return true
40 }
41
42 func (g general32) equalWithinAbs(a general32, tol float32) bool {
43         if g.rows != a.rows || g.cols != a.cols || g.stride != a.stride {
44                 return false
45         }
46         for i, v := range g.data {
47                 if math.Abs(a.data[i]-v) > tol {
48                         return false
49                 }
50         }
51         return true
52 }