basis

package
v0.0.0-...-cc019de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2022 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const CASES_SIZE = 2048
View Source
const DefaultNForBenchmark = 30

Variables

View Source
var DefaultPrecession = 0.001

DefaultPrecession - максимальная допустимая погрешность по умолчанию - 0.1%

Functions

func AssertIsValidSuperFunc

func AssertIsValidSuperFunc(t *testing.T, x1 float64, x2 float64, n uint8, impl SuperFuncType, precession float64)

AssertIsValidSuperFunc - вспомогательное утверждение для сравнения результатов float64, использует IsEqualWithPrecession для сравнения с допустимой погрешностью для сравнения использует вычисляемый эталон на основе базовой функции

func AssertIsValidSuperFuncF

func AssertIsValidSuperFuncF(t *testing.T, reference float64, x1 float64, x2 float64, n uint8, impl SuperFuncType, precession float64)

AssertIsValidSuperFuncF - вспомогательное утверждение для сравнения результатов float64, использует IsEqualWithPrecession для сравнения с допустимой погрешностью для сравнения использует заранее вычисленное значение [reference]

func BasicSuperFuncImpl

func BasicSuperFuncImpl(x1 float64, x2 float64, n uint8) float64

BasicSuperFuncImpl - начальная не оптимизированная версия функции описывает основной инвариантный алгоритм: 1. `n==0` -> `x1` 2. `n==1` -> `x1 * x2` 3. `n>1` -> `f(x1, x2, n-2) * f(x1, x2, n-1)`

func IsEqualWithPrecession

func IsEqualWithPrecession(reference float64, actual float64, precession float64) bool

IsEqualWithPrecession IsEqualWithDelta вспомогательная функция для сравнения float64 с учетом допустимой точности вычислений относительно эталона, например погрешность 1% `IsEqualWithPrecession(x1,x2,0.01)`

func OldHackedSuperFuncBenchmark

func OldHackedSuperFuncBenchmark(impl SuperFuncType, b *testing.B)

SuperFuncBenchmark - обобщенный бенчмарк для SuperFuncType использование в своем коде: `func BenchmarkMySuperFunc(b *testing.B) { SuperFuncBenchmark(MyFunc, b) }`

func SuperFuncBenchmark

func SuperFuncBenchmark(impl SuperFuncType, b *testing.B)

SuperFuncBenchmark - обобщенный бенчмарк для SuperFuncType использование в своем коде: `func BenchmarkMySuperFunc(b *testing.B) { SuperFuncBenchmark(MyFunc, b) }`

func SuperFuncTestCase

func SuperFuncTestCase(impl SuperFuncType, t *testing.T)

SuperFuncTestCase - стандартный набор тестов для тестирования переданного экземпляра SuperFuncType должен в обязательном порядке выполняться для всех реализаций используется достаточно просто: `func TestMySuperFunc(t *testing.T) { SuperFuncTestCase(MyFunc, t) }`

Types

type SuperFuncType

type SuperFuncType func(x1 float64, x2 float64, n uint8) float64

SuperFuncType - сигнатура типа для реализуемой функции

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL