Documentation ¶
Index ¶
- Variables
- func Boardcast(a, b *Arrf) (*Arrf, *Arrf, error)
- func ContainsFloat64(s []float64, e float64) bool
- func ContainsInt(s []int, e int) bool
- func Hargmax(ln int, data []float64)
- func Hargmin(ln int, data []float64)
- func Hmax(ln int, data []float64)
- func Hmin(ln int, data []float64)
- func Hsort(ln int, data []float64)
- func Modf(b *Arrf) (*Arrf, *Arrf)
- func ProductIntSlice(slice []int) int
- func ReverseIntSlice(slice []int) []int
- func Roundf(val float64, places int) float64
- func SameBoolSlice(a, b []bool) bool
- func SameFloat64Slice(a, b []float64) bool
- func SameIntSlice(a, b []int) bool
- func Seed(seed int64)
- func Vargmax(ln int, a []float64)
- func Vargmin(ln int, a []float64)
- func Vmax(a, b []float64)
- func Vmin(a, b []float64)
- func Vsort(ln int, a []float64)
- type Arrb
- func ArrayB(data []bool, shape ...int) *Arrb
- func EmptyB(shape ...int) (a *Arrb)
- func Equal(a, b *Arrf) *Arrb
- func FillB(fullValue bool, shape ...int) *Arrb
- func Greater(a, b *Arrf) *Arrb
- func GreaterEqual(a, b *Arrf) *Arrb
- func IsFinit(b *Arrf) *Arrb
- func IsInf(b *Arrf) *Arrb
- func IsNaN(b *Arrf) *Arrb
- func Less(a, b *Arrf) *Arrb
- func LessEqual(a, b *Arrf) *Arrb
- func LogicalAnd(a, b *Arrb) *Arrb
- func LogicalNot(a *Arrb) *Arrb
- func LogicalOr(a, b *Arrb) *Arrb
- func NotEqual(a, b *Arrf) *Arrb
- type Arrf
- func Abs(b *Arrf) *Arrf
- func Acos(b *Arrf) *Arrf
- func Acosh(b *Arrf) *Arrf
- func Add(a, b *Arrf) *Arrf
- func Arange(vals ...int) *Arrf
- func ArgMax(a *Arrf, axis int) *Arrf
- func ArgMin(a *Arrf, axis int) *Arrf
- func Array(data []float64, shape ...int) *Arrf
- func Asin(b *Arrf) *Arrf
- func Asinh(b *Arrf) *Arrf
- func AtLeast2D(a *Arrf) *Arrf
- func Atan(b *Arrf) *Arrf
- func Atanh(b *Arrf) *Arrf
- func Ceil(b *Arrf) *Arrf
- func Concat(axis int, arrs ...*Arrf) *Arrf
- func CopySign(a, b *Arrf) *Arrf
- func Cos(b *Arrf) *Arrf
- func Cosh(b *Arrf) *Arrf
- func Div(a, b *Arrf) *Arrf
- func Exp(b *Arrf) *Arrf
- func Eye(n int) *Arrf
- func Fill(fillValue float64, shape ...int) *Arrf
- func Floor(b *Arrf) *Arrf
- func Hstack(arrs ...*Arrf) *Arrf
- func Identity(n int) *Arrf
- func Linspace(start, stop float64, num int) *Arrf
- func Log(b *Arrf) *Arrf
- func Log10(b *Arrf) *Arrf
- func Log1p(b *Arrf) *Arrf
- func Log2(b *Arrf) *Arrf
- func Max(a *Arrf, axis ...int) *Arrf
- func Maximum(a, b *Arrf) *Arrf
- func Mean(a *Arrf, axis ...int) *Arrf
- func Min(a *Arrf, axis ...int) *Arrf
- func Minimum(a, b *Arrf) *Arrf
- func Mod(a, b *Arrf) *Arrf
- func Mul(a, b *Arrf) *Arrf
- func Ones(shape ...int) *Arrf
- func OnesLike(a *Arrf) *Arrf
- func Pow(a, b *Arrf) *Arrf
- func Randn(shape ...int) *Arrf
- func Round(b *Arrf, places int) *Arrf
- func Sign(b *Arrf) *Arrf
- func Sin(b *Arrf) *Arrf
- func Sinh(b *Arrf) *Arrf
- func Sort(a *Arrf, axis ...int) *Arrf
- func Sqrt(b *Arrf) *Arrf
- func Square(b *Arrf) *Arrf
- func Std(a *Arrf, axis ...int) *Arrf
- func Sub(a, b *Arrf) *Arrf
- func Sum(a *Arrf, axis ...int) *Arrf
- func Tan(b *Arrf) *Arrf
- func Tanh(b *Arrf) *Arrf
- func Unique(a *Arrf) *Arrf
- func Var(a *Arrf, axis ...int) *Arrf
- func Vstack(arrs ...*Arrf) *Arrf
- func Where(cond *Arrb, tv, fv interface{}) *Arrf
- func Zeros(shape ...int) *Arrf
- func ZerosLike(a *Arrf) *Arrf
- func (a *Arrf) Add(b *Arrf) *Arrf
- func (a *Arrf) AddC(b float64) *Arrf
- func (a *Arrf) ArgMax(axis int) *Arrf
- func (a *Arrf) ArgMin(axis int) *Arrf
- func (a *Arrf) At(index ...int) float64
- func (a *Arrf) Copy() *Arrf
- func (a *Arrf) Div(b *Arrf) *Arrf
- func (a *Arrf) DivC(b float64) *Arrf
- func (a *Arrf) DotProd(b *Arrf) float64
- func (a *Arrf) Equal(b *Arrf) *Arrb
- func (a *Arrf) Flatten() *Arrf
- func (a *Arrf) Get(index ...int) float64
- func (a *Arrf) Greater(b *Arrf) *Arrb
- func (a *Arrf) GreaterEqual(b *Arrf) *Arrb
- func (a *Arrf) Index(ranges ...Range) *Arrf
- func (a *Arrf) IsEmpty() bool
- func (a *Arrf) Length() int
- func (a *Arrf) Less(b *Arrf) *Arrb
- func (a *Arrf) LessEqual(b *Arrf) *Arrb
- func (a *Arrf) MatProd(b *Arrf) *Arrf
- func (a *Arrf) Max(axis ...int) *Arrf
- func (a *Arrf) Mean(axis ...int) *Arrf
- func (a *Arrf) Min(axis ...int) *Arrf
- func (a *Arrf) Mul(b *Arrf) *Arrf
- func (a *Arrf) MulC(b float64) *Arrf
- func (a *Arrf) Ndims() int
- func (a *Arrf) NotEqual(b *Arrf) *Arrb
- func (a *Arrf) Reshape(shape ...int) *Arrf
- func (a *Arrf) SameShapeTo(b *Arrf) bool
- func (a *Arrf) Set(value float64, index ...int) *Arrf
- func (a *Arrf) Size() int
- func (a *Arrf) Sort(axis ...int) *Arrf
- func (a *Arrf) Std(axis ...int) *Arrf
- func (a *Arrf) String() (s string)
- func (a *Arrf) Sub(b *Arrf) *Arrf
- func (a *Arrf) SubC(b float64) *Arrf
- func (a *Arrf) Sum(axis ...int) *Arrf
- func (a *Arrf) Transpose(axes ...int) *Arrf
- func (a *Arrf) Values() []float64
- func (a *Arrf) Var(axis ...int) *Arrf
- type Range
Constants ¶
This section is empty.
Variables ¶
var ( INDEX_ERROR error = fmt.Errorf("INDEX ERROR") SHAPE_ERROR error = fmt.Errorf("SHAPE ERROR") DIMENTION_ERROR error = fmt.Errorf("DIMENTION ERROR") TYPE_ERROR error = fmt.Errorf("DATA TYPE ERROR") EMPTY_ARRAY_ERROR error = fmt.Errorf("EMPTY ARRAY ERROR") PARAMETER_ERROR error = fmt.Errorf("PARAMETER ERROR") UNIMPLEMENT_ERROR error = fmt.Errorf("UNIMPLEMENT ERROR") )
Functions ¶
func ContainsFloat64 ¶
func ContainsInt ¶
func ReverseIntSlice ¶
func SameBoolSlice ¶
判断两个[]bool是否相等。 相等是严格的相等,否则为不等。 如果有一个为nil则为不相等。
func SameFloat64Slice ¶
判断两个[]float64是否相等。 相等是严格的相等,否则为不等。 如果有一个为nil则为不相等。
func SameIntSlice ¶
判断两个[]int是否相等。 相等是严格的相等,否则为不等。 如果有一个为nil则为不相等。
Types ¶
type Arrb ¶
type Arrb struct {
// contains filtered or unexported fields
}
func ArrayB ¶
通过[]bool,形状来创建多维数组。 输入参数1:data []bool,以·C· 顺序存储,作为多维数组的输入数据,内部复制一份新的internalData,不改变data。 输入参数2:shape ...int,指定多维数组的形状,多维,类似numpy中的shape。
如果某一个(仅支持一个维度)维度为负数,则根据len(data)推断该维度的大小。
情况1:如果不指定shape,而且data为nil,则创建一个空的*Arrb。 情况2:如果不指定shape,而且data不为nil,则创建一个len(data)大小的一维*Arrb。 情况3:如果指定shape,而且data不为nil,则根据data大小创建多维数组,如果len(data)不等于shape,或者len(data)不能整除shape,抛出异常。 情况4:如果指定shape,而且data为nil,则创建shape大小的全为false的多维数组。
func GreaterEqual ¶
func LogicalAnd ¶
func LogicalNot ¶
func (*Arrb) LogicalAnd ¶
func (*Arrb) LogicalNot ¶
type Arrf ¶
type Arrf struct {
// contains filtered or unexported fields
}
func Arange ¶
通过指定起始、终止和步进量来创建一维Array。 输入参数: vals,可以有三种情况,详见下面描述。 情况1:Arange(stop): 以0开始的序列,创建Array [0, 0+(-)1, ..., stop),不包括stop,stop符号决定升降序。 情况2:Arange(start, stop):创建Array [start, start +(-)1, ..., stop),如果start小于start则递增,否则递减。 情况3:Arange(start, stop, step):创建Array [start, start + step, ..., stop),step符号决定升降序。 输入参数多于三个的都会被忽略。 输出序列为“整型数”序列。
func Array ¶
通过[]float64,形状来创建多维数组。 输入参数1:data []float64,以·C· 顺序存储,作为多维数组的输入数据,内部复制一份新的internalData,不改变data。 输入参数2:shape ...int,指定多维数组的形状,多维,类似numpy中的shape。
如果某一个(仅支持一个维度)维度为负数,则根据len(data)推断该维度的大小。
情况1:如果不指定shape,而且data为nil,则创建一个空的*Arrf。 情况2:如果不指定shape,而且data不为nil,则创建一个len(data)大小的一维*Arrf。 情况3:如果指定shape,而且data不为nil,则根据data大小创建多维数组,如果len(data)不等于shape,或者len(data)不能整除shape,抛出异常。 情况4:如果指定shape,而且data为nil,则创建shape大小的全为0.0的多维数组。
func Randn ¶
Return a random matrix with data from the "standard normal" distribution.
`randn` generates a matrix filled with random floats sampled from a univariate "normal" (Gaussian) distribution of mean 0 and variance 1.
Parameters ---------- \\*args : Arguments Shape of the output. If given as N integers, each integer specifies the size of one dimension. If given as a tuple, this tuple gives the complete shape.
Returns ------- Z : matrix of floats A matrix of floating-point samples drawn from the standard normal distribution.
func Unique ¶
Find the unique elements of an array.
Returns the sorted unique elements of an array. There are three optional outputs in addition to the unique elements: the indices of the input array that give the unique values, the indices of the unique array that reconstruct the input array, and the number of times each unique value comes up in the input array.
Parameters ---------- ar : array_like Input array. This will be flattened if it is not already 1-D. return_index : bool, optional If True, also return the indices of `ar` that result in the unique array. return_inverse : bool, optional If True, also return the indices of the unique array that can be used to reconstruct `ar`. return_counts : bool, optional If True, also return the number of times each unique value comes up in `ar`.
.. versionadded:: 1.9.0
Returns ------- unique : ndarray The sorted unique values. unique_indices : ndarray, optional The indices of the first occurrences of the unique values in the (flattened) original array. Only provided if `return_index` is True. unique_inverse : ndarray, optional The indices to reconstruct the (flattened) original array from the unique array. Only provided if `return_inverse` is True. unique_counts : ndarray, optional The number of times each of the unique values comes up in the original array. Only provided if `return_counts` is True.
func (*Arrf) Add ¶
两个多维数组相加,结果为新的多维数组,不修改原数组。 加法过程中间会发生广播,对矩阵运算有极大帮助。 fixme : by ledao 广播机制会进行额外的运算,对于简单的场景最好有判断,避免广播。
func (*Arrf) At ¶
获取index指定位置的元素。 index必须在shape规定的范围内,否则会抛出异常。 index的长度必须小于等于维度的个数,否则会抛出异常。 如果index的个数小于维度个数,则会取后面的第一个值。
func (*Arrf) GreaterEqual ¶
func (*Arrf) Sub ¶
两个多维数组相减,结果为新的多维数组,不修改原数组。 减法过程中间会发生广播,对矩阵运算有极大帮助。 fixme : by ledao 广播机制会进行额外的运算,对于简单的场景最好有判断,避免广播。