ganrac

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 17 Imported by: 1

README

GaNRAC Logo GaNRAC Logo

GaNRAC

Getting started

Requirements
install ox-asir

CentOS

# yum install libX11-devel libXt-devel libXaw-devel
> curl -O "http://www.math.sci.kobe-u.ac.jp/pub/OpenXM/Head/openxm-head.tar.gz"
> tar xf openxm-head.tar.gz
> (cd OpenXM/src; make install)
> (cd OpenXM/rc; make install)
> while :; do ox -ox ox_asir -control 1234 -data 4321; done

Ubuntu

# apt install build-essential m4 bison
# apt install libx11-dev libxt-dev libxaw7-dev
> curl -O "http://www.math.sci.kobe-u.ac.jp/pub/OpenXM/Head/openxm-head.tar.gz"
> tar xf openxm-head.tar.gz
> (cd OpenXM/src; make install)
> (cd OpenXM/rc; make install)
> while :; do ox -ox ox_asir -control 1234 -data 4321; done

Installation

downloading the binary

See https://github.com/hiwane/ganrac/releases

compiling from source code

Required: go (1.18 or newer)

ox-asir version

> go install github.com/hiwane/ganrac/cmd/ganrac-ox@latest
> # go get github.com/hiwane/ganrac/cmd/ganrac-ox

SageMath version

> go install github.com/hiwane/ganrac/cmd/ganrac-sage@latest
> # go get github.com/hiwane/ganrac/cmd/ganrac-sage

Demo

ganrac9

real Quantifier Elimination

See qe.md for details.

ganrac7

F = ex([x], a*x^2+b*x+c==0);
qe(F);
G = example("quad");
H = time(qe(G[0]));
qe(all([x,y,z], equiv(G[1], H)));
real QE by Cylindrical Algebraic Decomposition

See cad.md for details.

ganrac8

vars(c,b,a,x);
F = ex([x], a*x^2+b*x+c <= 0);
F;
C = cadinit(F);
cadproj(C);
print(C, "proj");
print(C, "proj", 3, 0);
cadlift(C);
print(C, "sig");
print(C, "sig", 0);
print(C, "cell", 0, 1);
cadsfc(C);
print(C, "stat");

Documentation

Index

Constants

View Source
const (
	PF_EVAL_UNKNOWN = -1
	PF_EVAL_NO      = 0
	PF_EVAL_YES     = 1

	PROJ_McCallum = 0
	PROJ_HONG     = 1

	CAD_STAGE_INITED int8 = 0
	CAD_STAGE_PROJED int8 = 1
	CAD_STAGE_LIFTED int8 = 2
)
View Source
const (
	EVEN_NO   = 0x00
	EVEN_NG   = 0x01
	EVEN_LIN1 = 0x02 // 線形,ただし,主係数は定数
	EVEN_LIN2 = 0x04 // 線形で,主係数が変数
	EVEN_OK   = 0x08 // atom の因数分解した因子すべてが even 例:(x^2+1) * (x^4+3*x^2+1)
	EVEN_OKM  = 0x10 // atom.getPoly() が even 例:(x-1)*(x+1)
	EVEN_LIN  = EVEN_LIN1 | EVEN_LIN2
)
View Source
const (
	LT       OP = 0x1
	EQ       OP = 0x2
	GT       OP = 0x4
	LE       OP = LT | EQ
	GE       OP = GT | EQ
	NE       OP = GT | LT
	OP_TRUE  OP = GT | EQ | LT
	OP_FALSE OP = 0x0

	FTAG_TRUE  uint = 0x101
	FTAG_FALSE uint = 0x102
	FTAG_ATOM  uint = 0x103
	FTAG_AND   uint = 0x104
	FTAG_OR    uint = 0x105
	FTAG_ALL   uint = 0x106
	FTAG_EX    uint = 0x107
)
View Source
const (
	TAG_NONE = iota
	TAG_STR
	TAG_NUM
	TAG_POLY
	TAG_FOF
	TAG_LIST
	TAG_CAD

	FORMAT_TEX    = 'P'
	FORMAT_DUMP   = 'V'
	FORMAT_SRC    = 'S'
	FORMAT_QEPCAD = 'Q'
	FORMAT_INDEX  = 'I'
)
View Source
const (
	NTAG_NONE = iota
	NTAG_INT
	NTAG_RAT
	NTAG_BININT
	NTAG_INTERVAL
	NTAG_MOD
)
View Source
const (
	QEALGO_VSLIN  = 0x0001
	QEALGO_VSQUAD = 0x0002

	QEALGO_EQLIN  = 0x0010
	QEALGO_EQQUAD = 0x0020

	QEALGO_NEQ = 0x0100 // 非等式制約QE

	QEALGO_ATOM = 0x0200 // ex([x], f(x) <= 0)
	QEALGO_SDC  = 0x0400 // ex([x], x>=0 && f(x) <= 0)

	QEALGO_SMPL_EVEN = 0x100000000
	QEALGO_SMPL_HOMO = 0x200000000
	QEALGO_SMPL_TRAN = 0x400000000
	QEALGO_SMPL_ROTA = 0x800000000
)
View Source
const (
	// pdq() の復帰
	SFC_PROJ_DEFINABLE   = 0
	SFC_PROJ_UNDEFINABLE = 1
	SFC_PROJ_UNDET       = 2
)
View Source
const ATOMQE_MAX_DEG = 8
View Source
const KARATSUBA_DEG_MOD = 4

go test -bench BenchmarkModularMulPoly -run BenchmarkModularMulPoly -o prof/ganrac -count=N 3x20= 34.222 4x20= 30.380 5x20= 31.947

View Source
const OPVS_SHIFT = 8
View Source
const SDCQE_MAX_DEG = 8

Variables

View Source
var DebugCounter map[string]int = make(map[string]int)

Functions

func ExampleNames added in v0.0.4

func ExampleNames() []string

func GetColordFml

func GetColordFml() bool

func IncDebugCounter added in v0.0.3

func IncDebugCounter(f string, n int) int

func MaxPrec

func MaxPrec(x, y *Interval) uint

func NewCadErrorWO added in v0.0.4

func NewCadErrorWO(cell *Cell) error

func NewFofQuadEq added in v0.0.3

func NewFofQuadEq(g *Ganrac, p *Poly, lv Level) *fof_quad_eq

func NewQeCond added in v0.0.3

func NewQeCond() *qeCond

func NewReduceInfo added in v0.0.3

func NewReduceInfo(g *Ganrac, c, neccon, sufcon Fof) *reduce_info

neccon: 必要条件 sufcon: 十分条件

func QEOptionNames added in v0.0.4

func QEOptionNames() []string

func SetColordFml

func SetColordFml(b bool)

func VarNum added in v0.0.2

func VarNum() int

func VarStr added in v0.0.2

func VarStr(lv Level) string

Types

type Atom

type Atom struct {
	// contains filtered or unexported fields
}

func (*Atom) Clone added in v0.0.4

func (p *Atom) Clone() *Atom

func (*Atom) Deg

func (p *Atom) Deg(lv Level) int

func (*Atom) Equals

func (p *Atom) Equals(qq interface{}) bool

func (*Atom) FmlLess

func (p *Atom) FmlLess(qq Fof) bool

func (*Atom) Format

func (p *Atom) Format(b fmt.State, format rune)

func (*Atom) Indets

func (p *Atom) Indets(b []bool)

func (*Atom) IsQff

func (p *Atom) IsQff() bool

func (*Atom) IsQuantifier

func (p *Atom) IsQuantifier() bool

func (*Atom) Not

func (p *Atom) Not() Fof

func (*Atom) String

func (p *Atom) String() string

func (*Atom) Subst

func (p *Atom) Subst(xs RObj, lvs Level) Fof

func (*Atom) Tag

func (p *Atom) Tag() uint

type AtomF

type AtomF struct {
	FofTFbase
}

func (*AtomF) Deg

func (p *AtomF) Deg(lv Level) int

func (*AtomF) Equals

func (p *AtomF) Equals(qq interface{}) bool

func (*AtomF) FmlLess

func (p *AtomF) FmlLess(q Fof) bool

func (*AtomF) Format

func (p *AtomF) Format(s fmt.State, format rune)

func (*AtomF) Indets

func (p *AtomF) Indets(b []bool)

func (*AtomF) IsQff

func (p *AtomF) IsQff() bool

func (*AtomF) IsQuantifier

func (p *AtomF) IsQuantifier() bool

func (*AtomF) Not

func (p *AtomF) Not() Fof

func (*AtomF) String

func (p *AtomF) String() string

func (*AtomF) Subst

func (p *AtomF) Subst(xs RObj, lvs Level) Fof

func (*AtomF) Tag

func (p *AtomF) Tag() uint

type AtomProj

type AtomProj struct {
	Atom
	// contains filtered or unexported fields
}

type AtomT

type AtomT struct {
	FofTFbase
}

func (*AtomT) Deg

func (p *AtomT) Deg(lv Level) int

func (*AtomT) Equals

func (p *AtomT) Equals(qq interface{}) bool

func (*AtomT) FmlLess

func (p *AtomT) FmlLess(q Fof) bool

func (*AtomT) Format

func (p *AtomT) Format(s fmt.State, format rune)

func (*AtomT) Indets

func (p *AtomT) Indets(b []bool)

func (*AtomT) IsQff

func (p *AtomT) IsQff() bool

func (*AtomT) IsQuantifier

func (p *AtomT) IsQuantifier() bool

func (*AtomT) Not

func (p *AtomT) Not() Fof

func (*AtomT) String

func (p *AtomT) String() string

func (*AtomT) Subst

func (p *AtomT) Subst(xs RObj, lvs Level) Fof

func (*AtomT) Tag

func (p *AtomT) Tag() uint

type BinInt

type BinInt struct {
	Number
	// contains filtered or unexported fields
}

BinInt is an NObj

func NewBinInt

func NewBinInt(n *big.Int, m int) *BinInt

func (*BinInt) Abs

func (z *BinInt) Abs() NObj

func (*BinInt) Add

func (x *BinInt) Add(yy RObj) RObj

func (*BinInt) AddInt

func (x *BinInt) AddInt(y *Int) RObj

func (*BinInt) Cmp

func (z *BinInt) Cmp(xx NObj) int

func (*BinInt) CmpAbs

func (z *BinInt) CmpAbs(xx NObj) int

func (*BinInt) Div

func (x *BinInt) Div(yy NObj) RObj

func (*BinInt) Equals

func (x *BinInt) Equals(yy interface{}) bool

func (*BinInt) Float

func (z *BinInt) Float() float64

func (*BinInt) Format

func (x *BinInt) Format(s fmt.State, format rune)

func (*BinInt) IsMinusOne

func (x *BinInt) IsMinusOne() bool

func (*BinInt) IsOne

func (x *BinInt) IsOne() bool

func (*BinInt) IsZero

func (x *BinInt) IsZero() bool

func (*BinInt) Mul

func (x *BinInt) Mul(yy RObj) RObj

func (*BinInt) MulInt

func (x *BinInt) MulInt(y *Int) RObj

func (*BinInt) Neg

func (x *BinInt) Neg() RObj

func (*BinInt) Pow

func (x *BinInt) Pow(r *Int) RObj

func (*BinInt) Sign

func (x *BinInt) Sign() int

func (*BinInt) String

func (x *BinInt) String() string

func (*BinInt) Sub

func (x *BinInt) Sub(yy RObj) RObj

func (*BinInt) Subst

func (z *BinInt) Subst(x RObj, lv Level) RObj

func (*BinInt) ToInt added in v0.0.5

func (z *BinInt) ToInt(p *Int) *Int

整数に丸める. input z = (x+p) * 2^m return integer y s.t. t <= z < t+1 Params: p = 0 or 1 is expected

func (*BinInt) ToIntRat

func (z *BinInt) ToIntRat() NObj

type CAD

type CAD struct {
	// contains filtered or unexported fields
}

func NewCAD

func NewCAD(prenex_formula Fof, g *Ganrac) (*CAD, error)

func (*CAD) Fprint

func (cad *CAD) Fprint(b io.Writer, args ...interface{}) error

func (*CAD) FprintInput

func (cad *CAD) FprintInput(b io.Writer, args ...interface{}) error

func (*CAD) FprintProj

func (cad *CAD) FprintProj(b io.Writer, args ...interface{}) error

func (*CAD) FprintProjs

func (cad *CAD) FprintProjs(b io.Writer, lv Level)

func (*CAD) InitProj added in v0.0.3

func (c *CAD) InitProj(algo ProjectionAlgo)

func (*CAD) InitRoot added in v0.0.3

func (c *CAD) InitRoot()

func (*CAD) Lift

func (cad *CAD) Lift(index ...int) error

func (*CAD) Print

func (cad *CAD) Print(args ...interface{}) error

func (*CAD) PrintProj

func (cad *CAD) PrintProj(args ...interface{})

func (*CAD) Projection

func (cad *CAD) Projection(algo ProjectionAlgo) (*List, error)

func (*CAD) Root added in v0.0.3

func (c *CAD) Root() *Cell

func (*CAD) Sfc

func (cad *CAD) Sfc() (Fof, error)

func (*CAD) String

func (c *CAD) String() string

func (*CAD) Tag

func (c *CAD) Tag() uint

type CADSfc

type CADSfc struct {
	// contains filtered or unexported fields
}

func NewCADSfc

func NewCADSfc(cad *CAD) *CADSfc

type CADStat

type CADStat struct {
	// contains filtered or unexported fields
}

func (CADStat) Fprint

func (stat CADStat) Fprint(b io.Writer, cad *CAD)

type CAD_error_wo added in v0.0.4

type CAD_error_wo struct {
	// contains filtered or unexported fields
}

func (*CAD_error_wo) Error added in v0.0.4

func (e *CAD_error_wo) Error() string

type CAS added in v0.0.2

type CAS interface {
	Gcd(p, q *Poly) RObj

	/* asir format
	 * Factor(p) = [[c, 1], [q2, n2], [q3, n3], ..., [qm, nm]]
	 *  where
	 *     c in Q and
	 * 	   q2, ..., qm in Q[X] and
	 * 	   n2, ..., nm in N and
	 *     p = c* q2^n2 * q3^n3 * ... * qm^nm
	 */
	Factor(p *Poly) *List

	Discrim(p *Poly, lv Level) RObj
	Resultant(p *Poly, q *Poly, lv Level) RObj

	/* principal subresultant coefficient */
	Psc(p *Poly, q *Poly, lv Level, j int32) RObj

	/*
	 * slope resultant
	 * H. Hong. Quantifier elimination for formulas constrained by quadratic equations
	 */
	Slope(p *Poly, q *Poly, lv Level, k int32) RObj

	// Subresultant seq.
	// cc の値により, psc 等に変える
	//   0: subresultant seq.
	//   1: principal subresultant seq.
	//   2: constant term
	//   3: 1+2
	Sres(p *Poly, q *Poly, lv Level, cc int32) *List

	// groebner basis
	// vars 変数順序を表す
	// 束縛変数と自由変数を分けるために block order を用いる. n はそのための区切りの位置を表す.
	// 区切りが必要のない場合は,n=0 を用いる
	GB(p *List, vars *List, n int) *List

	// returns reduce(p, gb), sgn < 0
	// (vars, n) については,GB を参照
	Reduce(p *Poly, gb *List, vars *List, n int) (RObj, bool)

	Eval(p string) (GObj, error)

	Close() error

	SetLogger(logger *log.Logger)
}

type Cell

type Cell struct {
	// contains filtered or unexported fields
}

func NewCell

func NewCell(cad *CAD, parent *Cell, idx uint) *Cell

func (*Cell) Fprint

func (cell *Cell) Fprint(b io.Writer, args ...interface{}) error

func (*Cell) Index

func (cell *Cell) Index() []uint

インデックスを返す. 論文等は 1 始まりだが,0 始まりであることに注意 つまり, section は奇数である

func (*Cell) Neg

func (cell *Cell) Neg() *Cell

func (*Cell) Prec

func (cell *Cell) Prec() uint

func (*Cell) Precs

func (cell *Cell) Precs() []uint

func (*Cell) Print

func (cell *Cell) Print(args ...interface{}) error

func (*Cell) Sign

func (cell *Cell) Sign() int

returns the sign of the sample point

func (*Cell) Square

func (cell *Cell) Square(even int)

func (*Cell) Truth added in v0.0.3

func (cell *Cell) Truth() int8

type Cellmod

type Cellmod struct {
	// contains filtered or unexported fields
}

func NewCellmod

func NewCellmod(cell *Cell) *Cellmod

type Dict

type Dict struct {
	GObj
	// contains filtered or unexported fields
}

func NewDict

func NewDict() *Dict

func (*Dict) Equals

func (z *Dict) Equals(vv interface{}) bool

func (*Dict) Format

func (z *Dict) Format(s fmt.State, format rune)

func (*Dict) Get

func (z *Dict) Get(k string) (GObj, error)

func (*Dict) Indets

func (z *Dict) Indets(b []bool)

func (*Dict) Len

func (z *Dict) Len() int

func (*Dict) Set

func (z *Dict) Set(k string, v GObj) error

setser

func (*Dict) String

func (z *Dict) String() string

func (*Dict) Tag

func (z *Dict) Tag() uint

type Exists

type Exists struct {
	// contains filtered or unexported fields
}

func (*Exists) Deg

func (p *Exists) Deg(lv Level) int

func (*Exists) Equals

func (p *Exists) Equals(qq interface{}) bool

func (*Exists) Fml

func (p *Exists) Fml() Fof

func (*Exists) FmlLess

func (p *Exists) FmlLess(q Fof) bool

func (*Exists) Format

func (p *Exists) Format(b fmt.State, format rune)

func (*Exists) Get

func (p *Exists) Get(idx *Int) (interface{}, error)

func (*Exists) Indets

func (p *Exists) Indets(b []bool)

func (*Exists) IsQff

func (p *Exists) IsQff() bool

func (*Exists) IsQuantifier

func (p *Exists) IsQuantifier() bool

func (*Exists) Not

func (p *Exists) Not() Fof

func (*Exists) Qs

func (p *Exists) Qs() []Level

func (*Exists) String

func (p *Exists) String() string

func (*Exists) Subst

func (p *Exists) Subst(xs RObj, lvs Level) Fof

func (*Exists) Tag

func (p *Exists) Tag() uint

type FmlAnd

type FmlAnd struct {
	// contains filtered or unexported fields
}

func (*FmlAnd) Deg

func (p *FmlAnd) Deg(lv Level) int

func (*FmlAnd) Equals

func (p *FmlAnd) Equals(qq interface{}) bool

func (*FmlAnd) FmlLess

func (p *FmlAnd) FmlLess(q Fof) bool

func (*FmlAnd) Fmls

func (p *FmlAnd) Fmls() []Fof

func (*FmlAnd) Format

func (p *FmlAnd) Format(b fmt.State, format rune)

func (*FmlAnd) Get

func (p *FmlAnd) Get(idx *Int) (Fof, error)

func (*FmlAnd) Indets

func (p *FmlAnd) Indets(b []bool)

func (*FmlAnd) IsQff

func (p *FmlAnd) IsQff() bool

func (*FmlAnd) IsQuantifier

func (p *FmlAnd) IsQuantifier() bool

func (*FmlAnd) Len

func (p *FmlAnd) Len() int

func (*FmlAnd) Not

func (p *FmlAnd) Not() Fof

func (*FmlAnd) String

func (p *FmlAnd) String() string

func (*FmlAnd) Subst

func (p *FmlAnd) Subst(xs RObj, lvs Level) Fof

func (*FmlAnd) Tag

func (p *FmlAnd) Tag() uint

type FmlOr

type FmlOr struct {
	// contains filtered or unexported fields
}

func (*FmlOr) Deg

func (p *FmlOr) Deg(lv Level) int

func (*FmlOr) Equals

func (p *FmlOr) Equals(qq interface{}) bool

func (*FmlOr) FmlLess

func (p *FmlOr) FmlLess(q Fof) bool

func (*FmlOr) Fmls

func (p *FmlOr) Fmls() []Fof

func (*FmlOr) Format

func (p *FmlOr) Format(b fmt.State, format rune)

func (*FmlOr) Get

func (p *FmlOr) Get(idx *Int) (Fof, error)

func (*FmlOr) Indets

func (p *FmlOr) Indets(b []bool)

func (*FmlOr) IsQff

func (p *FmlOr) IsQff() bool

func (*FmlOr) IsQuantifier

func (p *FmlOr) IsQuantifier() bool

func (*FmlOr) Len

func (p *FmlOr) Len() int

func (*FmlOr) Not

func (p *FmlOr) Not() Fof

func (*FmlOr) String

func (p *FmlOr) String() string

func (*FmlOr) Subst

func (p *FmlOr) Subst(xs RObj, lvs Level) Fof

func (*FmlOr) Tag

func (p *FmlOr) Tag() uint

type Fof

type Fof interface {
	GObj
	fmt.Formatter

	IsQff() bool        // quantifier free formula
	IsQuantifier() bool // ForAll か Exists なら true

	Not() Fof // 否定

	Subst(xs RObj, lv Level) Fof

	Deg(lv Level) int
	FmlLess(a Fof) bool // normalize() でのソート用
	// contains filtered or unexported methods
}

first-order formula

func NewAtom

func NewAtom(p RObj, op OP) Fof

func NewAtoms

func NewAtoms(pp []RObj, op OP) Fof

func NewBool

func NewBool(b bool) Fof

func NewExists

func NewExists(lv []Level, fml Fof) Fof

func NewFmlAnd

func NewFmlAnd(pp Fof, qq Fof) Fof

func NewFmlAnds added in v0.0.3

func NewFmlAnds(pp ...Fof) Fof

func NewFmlEquiv added in v0.0.3

func NewFmlEquiv(f1, f2 Fof) Fof

func NewFmlImpl added in v0.0.4

func NewFmlImpl(f1, f2 Fof) Fof

func NewFmlOr

func NewFmlOr(pp Fof, qq Fof) Fof

func NewFmlOrs added in v0.0.3

func NewFmlOrs(pp ...Fof) Fof

func NewForAll added in v0.0.4

func NewForAll(lv []Level, fml Fof) Fof

func NewQuantifier

func NewQuantifier(forex bool, lvv []Level, fml Fof) Fof

type FofAO

type FofAO interface {
	// and/or
	Fof

	Fmls() []Fof

	Len() int
	// contains filtered or unexported methods
}

type FofQ

type FofQ interface {
	// quantifier
	Fof

	Qs() []Level
	Fml() Fof
	// contains filtered or unexported methods
}

type FofTFbase

type FofTFbase struct {
	Fof
}

type ForAll

type ForAll struct {
	// contains filtered or unexported fields
}

func (*ForAll) Deg

func (p *ForAll) Deg(lv Level) int

func (*ForAll) Equals

func (p *ForAll) Equals(qq interface{}) bool

func (*ForAll) Fml

func (p *ForAll) Fml() Fof

func (*ForAll) FmlLess

func (p *ForAll) FmlLess(q Fof) bool

func (*ForAll) Format

func (p *ForAll) Format(b fmt.State, format rune)

func (*ForAll) Get

func (p *ForAll) Get(idx *Int) (interface{}, error)

func (*ForAll) Indets

func (p *ForAll) Indets(b []bool)

func (*ForAll) IsQff

func (p *ForAll) IsQff() bool

func (*ForAll) IsQuantifier

func (p *ForAll) IsQuantifier() bool

func (*ForAll) Not

func (p *ForAll) Not() Fof

func (*ForAll) Qs

func (p *ForAll) Qs() []Level

func (*ForAll) String

func (p *ForAll) String() string

func (*ForAll) Subst

func (p *ForAll) Subst(xs RObj, lvs Level) Fof

func (*ForAll) Tag

func (p *ForAll) Tag() uint

type GObj

type GObj interface {
	fmt.Formatter
	String() string
	Tag() uint
}

ganrac object RObj, NObj, Fof, List, *String

type Ganrac

type Ganrac struct {
	// contains filtered or unexported fields
}

func NewGANRAC

func NewGANRAC() *Ganrac

func (*Ganrac) Close added in v0.0.3

func (g *Ganrac) Close()

func (*Ganrac) Eval

func (g *Ganrac) Eval(r io.Reader) (interface{}, error)

func (*Ganrac) FunctionNames added in v0.0.4

func (g *Ganrac) FunctionNames() []string

func (*Ganrac) InitVarList

func (g *Ganrac) InitVarList(vlist []string) error

func (*Ganrac) Logger added in v0.0.2

func (g *Ganrac) Logger() *log.Logger

func (*Ganrac) QE

func (g *Ganrac) QE(fof Fof, qeopt *QEopt) Fof

func (*Ganrac) SetCAS added in v0.0.2

func (g *Ganrac) SetCAS(cas CAS)

func (*Ganrac) SetLogger

func (g *Ganrac) SetLogger(logger *log.Logger)

func (*Ganrac) SetParaNum added in v0.0.4

func (g *Ganrac) SetParaNum(n int)

type Int

type Int struct {
	Number
	// contains filtered or unexported fields
}

Int is an NObj

func NewInt

func NewInt(n int64) *Int

func NewIntZ

func NewIntZ(z *big.Int) *Int

func ParseInt

func ParseInt(s string, base int) *Int

func (*Int) Abs

func (z *Int) Abs() NObj

func (*Int) Add

func (x *Int) Add(y RObj) RObj

func (*Int) Bit

func (x *Int) Bit(i int) uint

func (*Int) Cmp

func (z *Int) Cmp(xx NObj) int

func (*Int) CmpAbs

func (z *Int) CmpAbs(xx NObj) int

func (*Int) Div

func (x *Int) Div(yy NObj) RObj

func (*Int) Equals

func (x *Int) Equals(y interface{}) bool

func (*Int) Float

func (z *Int) Float() float64

func (*Int) Format

func (x *Int) Format(s fmt.State, format rune)

func (*Int) Gcd

func (x *Int) Gcd(y *Int) *Int

func (*Int) GcdEx

func (x *Int) GcdEx(y *Int) (*Int, *Int, *Int)

func (*Int) Int64

func (x *Int) Int64() int64

func (*Int) IsInt64

func (x *Int) IsInt64() bool

func (*Int) IsMinusOne

func (x *Int) IsMinusOne() bool

func (*Int) IsOne

func (x *Int) IsOne() bool

func (*Int) IsZero

func (x *Int) IsZero() bool

func (*Int) Mul

func (x *Int) Mul(y RObj) RObj

func (*Int) N added in v0.0.2

func (x *Int) N() *big.Int

func (*Int) Neg

func (x *Int) Neg() RObj

func (*Int) Pow

func (x *Int) Pow(y *Int) RObj

func (*Int) QuoRem added in v0.0.4

func (x *Int) QuoRem(y *Int) (*Int, *Int)

func (*Int) Set

func (x *Int) Set(y RObj) RObj

func (*Int) Sign

func (x *Int) Sign() int

func (*Int) String

func (x *Int) String() string

func (*Int) Sub

func (x *Int) Sub(y RObj) RObj

func (*Int) Subst

func (z *Int) Subst(x RObj, lv Level) RObj

type Interval

type Interval struct {
	Number
	// contains filtered or unexported fields
}

Interval is an NObj

func FRealRoot

func FRealRoot(prec uint, lmax int, poly []*big.Float, rand float64) []*Interval

func NewIntervalFloat

func NewIntervalFloat(n *big.Float, prec uint) *Interval

func NewIntervalInt64

func NewIntervalInt64(n int64, prec uint) *Interval

func (*Interval) Abs

func (x *Interval) Abs() NObj

func (*Interval) Add

func (x *Interval) Add(yy RObj) RObj

func (*Interval) AddFloat

func (x *Interval) AddFloat(y *big.Float) *Interval

func (*Interval) Cmp

func (x *Interval) Cmp(y NObj) int

func (*Interval) CmpAbs

func (x *Interval) CmpAbs(y NObj) int

func (*Interval) ContainsZero

func (c *Interval) ContainsZero() bool

func (*Interval) Div

func (x *Interval) Div(yy NObj) RObj

func (*Interval) Equals

func (x *Interval) Equals(v interface{}) bool

func (*Interval) Float

func (x *Interval) Float() float64

func (*Interval) Format

func (x *Interval) Format(s fmt.State, format rune)

func (*Interval) IsMinusOne

func (x *Interval) IsMinusOne() bool

func (*Interval) IsOne

func (x *Interval) IsOne() bool

func (*Interval) IsZero

func (x *Interval) IsZero() bool

func (*Interval) Mul

func (x *Interval) Mul(yy RObj) RObj

func (*Interval) Mul2Exp

func (x *Interval) Mul2Exp(m uint) NObj

func (*Interval) MulFloat

func (x *Interval) MulFloat(y *big.Float) *Interval

func (*Interval) MulInt64

func (x *Interval) MulInt64(y int64) *Interval

func (*Interval) Neg

func (x *Interval) Neg() RObj

func (*Interval) Pow

func (x *Interval) Pow(yy *Int) RObj

func (*Interval) Prec

func (z *Interval) Prec() uint

func (*Interval) SetFloat

func (z *Interval) SetFloat(n *big.Float)

func (*Interval) SetFloat64

func (z *Interval) SetFloat64(n float64)

func (*Interval) SetInt64

func (z *Interval) SetInt64(n int64)

func (*Interval) SetPrec

func (z *Interval) SetPrec(prec uint)

func (*Interval) Sign

func (x *Interval) Sign() int

func (*Interval) String

func (z *Interval) String() string

func (*Interval) Sub

func (x *Interval) Sub(yy RObj) RObj

func (*Interval) SubFloat

func (x *Interval) SubFloat(y *big.Float) *Interval

func (*Interval) Subst

func (x *Interval) Subst(v RObj, lv Level) RObj

type Level

type Level int8

func VarStr2Lv added in v0.0.2

func VarStr2Lv(s string) (Level, bool)

type Levels

type Levels []Level

type List

type List struct {
	GObj
	// contains filtered or unexported fields
}

func NewList

func NewList(args ...interface{}) *List

func NewListN added in v0.0.4

func NewListN(n int, args ...interface{}) *List

func (*List) Append

func (z *List) Append(a GObj)

func (*List) Equals

func (z *List) Equals(vv interface{}) bool

func (*List) Format

func (z *List) Format(s fmt.State, format rune)

func (*List) Get

func (z *List) Get(ii *Int) (GObj, error)

func (*List) Geti

func (z *List) Geti(idx ...int) (GObj, error)

func (*List) Indets

func (z *List) Indets(b []bool)

func (*List) Iter

func (z *List) Iter() []GObj

func (*List) Len

func (z *List) Len() int

func (*List) Set

func (z *List) Set(ii *Int, v GObj) error

func (*List) Seti added in v0.0.2

func (z *List) Seti(i int, v GObj) error

func (*List) String

func (z *List) String() string

func (*List) Subst

func (z *List) Subst(xs RObj, lvs Level) *List

func (*List) Swap added in v0.0.2

func (z *List) Swap(i, j int) error

func (*List) Tag

func (z *List) Tag() uint

type Moder

type Moder interface {
	// modular arithmetic
	RObj
	// contains filtered or unexported methods
}

type NObj

type NObj interface {
	RObj

	Float() float64
	Cmp(x NObj) int
	CmpAbs(x NObj) int
	Abs() NObj
	Sign() int
	// contains filtered or unexported methods
}

numeric *Int, *Rat, *BinInt, *Interval, Uint

type NumRegion

type NumRegion struct {
	// contains filtered or unexported fields
}

nil は empty set を表す.

func NewNumRegion added in v0.0.3

func NewNumRegion() *NumRegion

func (*NumRegion) Format

func (m *NumRegion) Format(s fmt.State, format rune)

type Number

type Number struct {
	NObj
}

func (*Number) Deg added in v0.0.5

func (x *Number) Deg(lv Level) int

func (*Number) IsNumeric

func (x *Number) IsNumeric() bool

func (*Number) String

func (x *Number) String() string

func (*Number) Tag

func (x *Number) Tag() uint

type OP

type OP uint8

func (OP) Format added in v0.0.4

func (op OP) Format(b fmt.State, format rune)

func (OP) String

func (op OP) String() string

type Poly

type Poly struct {
	// contains filtered or unexported fields
}

poly in K[x_lv,...,x_n]

func NewPoly

func NewPoly(lv Level, deg_plus_1 int) *Poly

func NewPolyCoef

func NewPolyCoef(lv Level, coeffs ...interface{}) *Poly

func NewPolyInts

func NewPolyInts(lv Level, coeffs ...int64) *Poly

func NewPolyVar

func NewPolyVar(lv Level) *Poly

func NewPolyVarn added in v0.0.2

func NewPolyVarn(lv Level, deg int) *Poly

func VarPoly added in v0.0.2

func VarPoly(lv Level) *Poly

func (*Poly) Add

func (x *Poly) Add(y RObj) RObj

func (*Poly) Clone

func (z *Poly) Clone() *Poly

func (*Poly) Cmp

func (p *Poly) Cmp(q *Poly) int

func (*Poly) Coef

func (z *Poly) Coef(lv Level, deg uint) RObj

func (*Poly) Deg

func (z *Poly) Deg(lv Level) int

func (*Poly) Diff added in v0.0.2

func (z *Poly) Diff(lv Level) RObj

func (*Poly) Div

func (x *Poly) Div(y NObj) RObj

func (*Poly) Equals

func (z *Poly) Equals(x interface{}) bool

func (*Poly) Format

func (z *Poly) Format(s fmt.State, format rune)

func (*Poly) Indets

func (z *Poly) Indets(b []bool)

func (*Poly) IsMinusOne

func (z *Poly) IsMinusOne() bool

func (*Poly) IsNumeric

func (z *Poly) IsNumeric() bool

func (*Poly) IsOne

func (z *Poly) IsOne() bool

func (*Poly) IsZZ added in v0.0.4

func (x *Poly) IsZZ() bool

整数係数多項式か

func (*Poly) IsZero

func (z *Poly) IsZero() bool

func (*Poly) LeadinfCoef

func (z *Poly) LeadinfCoef() NObj

func (*Poly) Less

func (p *Poly) Less(q *Poly) bool

func (*Poly) Level added in v0.0.2

func (z *Poly) Level() Level

func (*Poly) Mul

func (x *Poly) Mul(yy RObj) RObj

func (*Poly) Neg

func (z *Poly) Neg() RObj

func (*Poly) NegX added in v0.0.4

func (f *Poly) NegX(lv Level) *Poly

returns f(-x)

func (*Poly) NewPoly added in v0.0.4

func (p *Poly) NewPoly() *Poly

func (*Poly) PPC added in v0.0.2

func (p *Poly) PPC() (*Poly, *Int)

func (*Poly) Pow

func (x *Poly) Pow(y *Int) RObj

func (*Poly) RealRootIsolation

func (p *Poly) RealRootIsolation(prec int) (*List, error)

func (*Poly) RootBound

func (z *Poly) RootBound() (NObj, error)

func (*Poly) Sdiv added in v0.0.2

func (xorg *Poly) Sdiv(y *Poly) RObj

func (*Poly) Set

func (z *Poly) Set(x RObj) RObj

func (*Poly) Sign

func (z *Poly) Sign() int

func (*Poly) String

func (z *Poly) String() string

func (*Poly) Sub

func (p *Poly) Sub(y RObj) RObj

func (*Poly) SubsXinv added in v0.0.3

func (q *Poly) SubsXinv() *Poly

func (*Poly) Subst

func (z *Poly) Subst(xs RObj, lv Level) RObj

func (*Poly) SubstIntv

func (z *Poly) SubstIntv(x *Interval, lv Level, prec uint) RObj

区間の代入なので 2 乗を利用したい.

func (*Poly) SubstXinvLv added in v0.0.4

func (f *Poly) SubstXinvLv(lv Level, n int) RObj

return x^n f(1/x) assume f(0) != 0, deg(f) <= n

func (*Poly) Tag

func (z *Poly) Tag() uint

type ProjFactor

type ProjFactor interface {
	P() *Poly
	Lv() Level
	Deg() int

	Index() uint
	SetIndex(i uint)

	// 入力の論理式に含まれるなら true
	Input() bool
	SetInputT(b bool)

	// 数値手法による評価
	Sign() sign_t
	SetSign(sgn sign_t)

	// 表示用
	FprintProjFactor(b io.Writer, cad *CAD)
	// contains filtered or unexported methods
}

type ProjFactorBase

type ProjFactorBase struct {
	// contains filtered or unexported fields
}

func (*ProjFactorBase) Deg

func (pfb *ProjFactorBase) Deg() int

func (*ProjFactorBase) Index

func (pfb *ProjFactorBase) Index() uint

func (*ProjFactorBase) Input

func (pfb *ProjFactorBase) Input() bool

func (*ProjFactorBase) Lv

func (pfb *ProjFactorBase) Lv() Level

func (*ProjFactorBase) P

func (pfb *ProjFactorBase) P() *Poly

func (*ProjFactorBase) SetIndex

func (pfb *ProjFactorBase) SetIndex(i uint)

func (*ProjFactorBase) SetInputT

func (pfb *ProjFactorBase) SetInputT(b bool)

func (*ProjFactorBase) SetSign

func (pfb *ProjFactorBase) SetSign(b sign_t)

func (*ProjFactorBase) Sign

func (pfb *ProjFactorBase) Sign() sign_t

type ProjFactorHH

type ProjFactorHH struct {
	ProjFactorBase
	// contains filtered or unexported fields
}

func (*ProjFactorHH) FprintProjFactor

func (pf *ProjFactorHH) FprintProjFactor(b io.Writer, cad *CAD)

type ProjFactorMC

type ProjFactorMC struct {
	ProjFactorBase
	// contains filtered or unexported fields
}

func (*ProjFactorMC) FprintProjFactor

func (pf *ProjFactorMC) FprintProjFactor(b io.Writer, cad *CAD)

type ProjFactors

type ProjFactors interface {
	Len() int
	// contains filtered or unexported methods
}

type ProjFactorsHH

type ProjFactorsHH struct {
	// contains filtered or unexported fields
}

func (*ProjFactorsHH) Len

func (pfs *ProjFactorsHH) Len() int

type ProjFactorsMC

type ProjFactorsMC struct {
	// contains filtered or unexported fields
}

func (*ProjFactorsMC) Len

func (pfs *ProjFactorsMC) Len() int
type ProjLink struct {
	// contains filtered or unexported fields
}

func (*ProjLink) Fprint

func (pl *ProjLink) Fprint(b io.Writer)

type ProjectionAlgo

type ProjectionAlgo int

type QEopt

type QEopt struct {
	Algo algo_t
	// contains filtered or unexported fields
}

func NewQEopt

func NewQEopt() *QEopt

func (*QEopt) AddAlgo added in v0.0.3

func (qeopt *QEopt) AddAlgo(algo algo_t)

func (*QEopt) DelAlgo added in v0.0.3

func (qeopt *QEopt) DelAlgo(algo algo_t)

func (*QEopt) SetAlgo

func (qeopt *QEopt) SetAlgo(algo algo_t, v bool)

type QeExample

type QeExample struct {
	Input  Fof
	Output Fof
	Ref    string
	DOI    string
}

func GetExampleFof

func GetExampleFof(name string) *QeExample

type RObj

type RObj interface {
	GObj

	Add(x RObj) RObj // z+x
	Sub(x RObj) RObj // z-x
	Mul(x RObj) RObj
	Div(x NObj) RObj
	Pow(x *Int) RObj
	Subst(x RObj, lv Level) RObj
	Neg() RObj
	Deg(lv Level) int // 次数を返す. zero の場合も 0 になる
	//	Set(x RObj) RObj
	Sign() int
	IsZero() bool
	IsOne() bool
	IsMinusOne() bool
	IsNumeric() bool
	// contains filtered or unexported methods
}

ring ring in R[x], in R *Poly, *Int, *Rat, *BinInt, *Interval, Uint

func Add

func Add(x, y RObj) RObj

func Mul

func Mul(x, y RObj) RObj

func Sub

func Sub(x, y RObj) RObj

type RObjSample

type RObjSample struct {
}

func (*RObjSample) Add

func (z *RObjSample) Add(x RObj) RObj

func (*RObjSample) Deg added in v0.0.4

func (z *RObjSample) Deg(lv Level) int

func (*RObjSample) Div

func (z *RObjSample) Div(x NObj) RObj

func (*RObjSample) Equals

func (z *RObjSample) Equals(x interface{}) bool

func (*RObjSample) Format

func (z *RObjSample) Format(s fmt.State, format rune)

func (*RObjSample) IsMinusOne

func (z *RObjSample) IsMinusOne() bool

func (*RObjSample) IsNumeric

func (z *RObjSample) IsNumeric() bool

func (*RObjSample) IsOne

func (z *RObjSample) IsOne() bool

func (*RObjSample) IsZero

func (z *RObjSample) IsZero() bool

func (*RObjSample) Mul

func (z *RObjSample) Mul(x RObj) RObj

func (*RObjSample) Neg

func (z *RObjSample) Neg() RObj

func (*RObjSample) Pow

func (z *RObjSample) Pow(x *Int) RObj

func (*RObjSample) Set

func (z *RObjSample) Set(x RObj) RObj

func (*RObjSample) Sign

func (z *RObjSample) Sign() int

func (*RObjSample) String

func (z *RObjSample) String() string

func (*RObjSample) Sub

func (z *RObjSample) Sub(x RObj) RObj

func (*RObjSample) Subst

func (z *RObjSample) Subst(x RObj, lv Level) RObj

func (*RObjSample) Tag

func (z *RObjSample) Tag() uint

type Rat

type Rat struct {
	Number
	// contains filtered or unexported fields
}

Rat is an NObj

func NewRat added in v0.0.2

func NewRat(c *big.Rat) *Rat

func NewRatFrac

func NewRatFrac(num, den *Int) *Rat

func NewRatInt64

func NewRatInt64(num, den int64) *Rat

func (*Rat) Abs

func (z *Rat) Abs() NObj

func (*Rat) Add

func (x *Rat) Add(yy RObj) RObj

func (*Rat) Cmp

func (z *Rat) Cmp(xx NObj) int

func (*Rat) CmpAbs

func (z *Rat) CmpAbs(xx NObj) int

func (*Rat) Div

func (x *Rat) Div(yy NObj) RObj

func (*Rat) Equals

func (x *Rat) Equals(y interface{}) bool

func (*Rat) Float

func (z *Rat) Float() float64

func (*Rat) Format

func (x *Rat) Format(s fmt.State, format rune)

func (*Rat) IsMinusOne

func (x *Rat) IsMinusOne() bool

func (*Rat) IsOne

func (x *Rat) IsOne() bool

func (*Rat) IsZero

func (x *Rat) IsZero() bool

func (*Rat) Mul

func (x *Rat) Mul(yy RObj) RObj

func (*Rat) N added in v0.0.2

func (x *Rat) N() *big.Rat

func (*Rat) Neg

func (x *Rat) Neg() RObj

func (*Rat) Pow

func (x *Rat) Pow(y *Int) RObj

func (*Rat) Sign

func (x *Rat) Sign() int

func (*Rat) String

func (x *Rat) String() string

func (*Rat) Sub

func (x *Rat) Sub(yy RObj) RObj

func (*Rat) Subst

func (z *Rat) Subst(x RObj, lv Level) RObj

func (*Rat) ToInt added in v0.0.5

func (z *Rat) ToInt() *Int

ToInt returns the quotient x/y for y != 0. If y == 0, a division-by-zero run-time panic occurs.

type String

type String struct {
	GObj
	// contains filtered or unexported fields
}

func NewString

func NewString(s string) *String

func (*String) Format

func (z *String) Format(s fmt.State, format rune)

func (*String) S added in v0.0.2

func (s *String) S() string

func (*String) String

func (s *String) String() string

func (*String) Tag

func (s *String) Tag() uint

type Uint

type Uint uint32

Uint is an NObj

func (Uint) Abs

func (p Uint) Abs() NObj

func (Uint) Add

func (p Uint) Add(x RObj) RObj

func (Uint) Cmp

func (p Uint) Cmp(x NObj) int

func (Uint) CmpAbs

func (p Uint) CmpAbs(x NObj) int

func (Uint) Deg added in v0.0.4

func (x Uint) Deg(lv Level) int

func (Uint) Div

func (p Uint) Div(x NObj) RObj

func (Uint) Equals

func (p Uint) Equals(v interface{}) bool

func (Uint) Float

func (p Uint) Float() float64

func (Uint) Format

func (p Uint) Format(s fmt.State, format rune)

func (Uint) IsMinusOne

func (p Uint) IsMinusOne() bool

func (Uint) IsNumeric

func (p Uint) IsNumeric() bool

func (Uint) IsOne

func (p Uint) IsOne() bool

func (Uint) IsZero

func (p Uint) IsZero() bool

func (Uint) Mul

func (p Uint) Mul(x RObj) RObj

func (Uint) Neg

func (p Uint) Neg() RObj

func (Uint) Pow

func (p Uint) Pow(x *Int) RObj

func (Uint) Sign

func (p Uint) Sign() int

func (Uint) String

func (p Uint) String() string

func (Uint) Sub

func (p Uint) Sub(x RObj) RObj

func (Uint) Subst

func (p Uint) Subst(x RObj, lv Level) RObj

func (Uint) Tag

func (p Uint) Tag() uint

Directories

Path Synopsis
cas
ox
cmd
esp
sdc

Jump to

Keyboard shortcuts

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