yhseq-0.3.0.1: Calculation of YH sequence system

Safe HaskellNone
LanguageHaskell2010
Extensions
  • DerivingStrategies
  • DerivingVia
  • GeneralizedNewtypeDeriving

Numeric.YHSeq.V0201

Description

YH数列システム 2.0.1 の定義。

ここでは Data.IntSetData.Vector を活用している。

英語では YH sequence system 2.0.1 と呼ぶことにする。短く呼ぶときは YHSS 2.0.1 と呼ぶことにする。

Synopsis

Documentation

genVec :: (Ord i, Integral i) => i -> (i -> a) -> Vector a Source #

1 から n までの配列に関数を適用する。

0 が与えられた場合は空の配列を返す。

newtype Sequence Source #

数列、または列。

Constructors

Sequence 

Fields

ixSeq :: Sequence -> Int -> Int Source #

Sequence のための添字演算。

makeSeqFromList :: [Int] -> Sequence Source #

リストから数列を作る。

newtype Difference Source #

階差。

数列の階差を取った列を階差列と呼ぶことにする。たとえば (1,2,4,8,16,...) の階差列は (0,1,2,4,8,...) だ。

Constructors

Difference 

Fields

Instances
Bounded Difference Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Enum Difference Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Eq Difference Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Integral Difference Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Num Difference Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Ord Difference Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Read Difference Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Real Difference Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Show Difference Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Semigroup Difference Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Monoid Difference Source # 
Instance details

Defined in Numeric.YHSeq.V0201

newtype Index Source #

添字。

添字といっても Sequence の添字ではなく親を参照したりするときに使う添字だ。 ixSeq を見てもらえば分かるように、 Sequence の添字は普通の Int だ。

Constructors

Index 

Fields

Instances
Bounded Index Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Enum Index Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Eq Index Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

(==) :: Index -> Index -> Bool #

(/=) :: Index -> Index -> Bool #

Integral Index Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Num Index Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Ord Index Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

compare :: Index -> Index -> Ordering #

(<) :: Index -> Index -> Bool #

(<=) :: Index -> Index -> Bool #

(>) :: Index -> Index -> Bool #

(>=) :: Index -> Index -> Bool #

max :: Index -> Index -> Index #

min :: Index -> Index -> Index #

Read Index Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Real Index Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

toRational :: Index -> Rational #

Show Index Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

showsPrec :: Int -> Index -> ShowS #

show :: Index -> String #

showList :: [Index] -> ShowS #

Semigroup Index Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

(<>) :: Index -> Index -> Index #

sconcat :: NonEmpty Index -> Index #

stimes :: Integral b => b -> Index -> Index #

Monoid Index Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

mempty :: Index #

mappend :: Index -> Index -> Index #

mconcat :: [Index] -> Index #

newtype IndexSet Source #

添字の集合。

添字の集合と言っても、たぶん先祖の集合を表すのにしか使わないと思う。

Constructors

IndexSet 

Fields

newtype Depth Source #

深さ。

YHSS 2.0.1 では、深さは 0 にならない。

Constructors

Depth 

Fields

Instances
Bounded Depth Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Enum Depth Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Eq Depth Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

(==) :: Depth -> Depth -> Bool #

(/=) :: Depth -> Depth -> Bool #

Integral Depth Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Num Depth Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Ord Depth Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

compare :: Depth -> Depth -> Ordering #

(<) :: Depth -> Depth -> Bool #

(<=) :: Depth -> Depth -> Bool #

(>) :: Depth -> Depth -> Bool #

(>=) :: Depth -> Depth -> Bool #

max :: Depth -> Depth -> Depth #

min :: Depth -> Depth -> Depth #

Read Depth Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Real Depth Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

toRational :: Depth -> Rational #

Show Depth Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

showsPrec :: Int -> Depth -> ShowS #

show :: Depth -> String #

showList :: [Depth] -> ShowS #

Semigroup Depth Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

(<>) :: Depth -> Depth -> Depth #

sconcat :: NonEmpty Depth -> Depth #

stimes :: Integral b => b -> Depth -> Depth #

Monoid Depth Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

mempty :: Depth #

mappend :: Depth -> Depth -> Depth #

mconcat :: [Depth] -> Depth #

data Mountain Source #

山。

条件として dMt と pMt と aMt の長さはそれぞれ sMt に等しい。

Constructors

Mountain 

Fields

ixMtToDiff :: Mountain -> Index -> Depth -> Difference Source #

山から階差を添字で取得する。

ixMtToPaet :: Mountain -> Index -> Depth -> Index Source #

山から親の添字を添字で取得する。

ixMtToAnce :: Mountain -> Index -> Depth -> IndexSet Source #

山から先祖の集合を添字で取得する。

calcDiffOnMtFromSeqWiM :: Mountain -> Sequence -> Index -> Depth -> Difference Source #

メモを参照しながら数列から山の階差の部分を計算する。

calcPaetOnMtFromSeqWiM :: Mountain -> Index -> Depth -> Index Source #

メモを参照しながら数列から山の親の添字の部分を計算する。

calcAnceOnMtFromSeqWiM :: Mountain -> Index -> Depth -> IndexSet Source #

メモを参照しながら数列から山の先祖の集合の部分を計算する。

isAnceAtSh :: Mountain -> Index -> Depth -> Index -> Bool Source #

一つ浅い深さで先祖であるか。

名前は at shallow の略である。

calcMtFromSeq :: Sequence -> Mountain Source #

数列から山を計算する。

newtype Class Source #

クラス。

Constructors

Class 

Fields

Instances
Bounded Class Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Enum Class Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Eq Class Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

(==) :: Class -> Class -> Bool #

(/=) :: Class -> Class -> Bool #

Integral Class Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Num Class Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Ord Class Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

compare :: Class -> Class -> Ordering #

(<) :: Class -> Class -> Bool #

(<=) :: Class -> Class -> Bool #

(>) :: Class -> Class -> Bool #

(>=) :: Class -> Class -> Bool #

max :: Class -> Class -> Class #

min :: Class -> Class -> Class #

Read Class Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Real Class Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

toRational :: Class -> Rational #

Show Class Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

showsPrec :: Int -> Class -> ShowS #

show :: Class -> String #

showList :: [Class] -> ShowS #

Semigroup Class Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

(<>) :: Class -> Class -> Class #

sconcat :: NonEmpty Class -> Class #

stimes :: Integral b => b -> Class -> Class #

Monoid Class Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

mempty :: Class #

mappend :: Class -> Class -> Class #

mconcat :: [Class] -> Class #

data CofType Source #

共終タイプ。

順序数に対して定義される数学的な共終数ではない。

Constructors

IsZero 
IsSucc 
IsLim Class 
Instances
Bounded CofType Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Eq CofType Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

(==) :: CofType -> CofType -> Bool #

(/=) :: CofType -> CofType -> Bool #

Ord CofType Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Read CofType Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Show CofType Source # 
Instance details

Defined in Numeric.YHSeq.V0201

calcBottom :: Mountain -> Index -> Depth Source #

階差が存在する最も大きい深さを、それぞれの添字について計算する。

ここで 0 の深さが現れているが、深さ 1 での階差が 0 でない限り、最終的な計算結果の深さは 0 にならない。

calcCofType :: Mountain -> CofType Source #

共終タイプを計算する。

data DPN Source #

DPN 形式。

条件として dDPN と pDPN と nDPN の長さはそれぞれ sDPN に等しい。

Constructors

DPN 
Instances
Eq DPN Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

(==) :: DPN -> DPN -> Bool #

(/=) :: DPN -> DPN -> Bool #

Ord DPN Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

compare :: DPN -> DPN -> Ordering #

(<) :: DPN -> DPN -> Bool #

(<=) :: DPN -> DPN -> Bool #

(>) :: DPN -> DPN -> Bool #

(>=) :: DPN -> DPN -> Bool #

max :: DPN -> DPN -> DPN #

min :: DPN -> DPN -> DPN #

Read DPN Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Show DPN Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Methods

showsPrec :: Int -> DPN -> ShowS #

show :: DPN -> String #

showList :: [DPN] -> ShowS #

ixDpnToDiff :: DPN -> Index -> Difference Source #

DPN 形式から階差を添字で取得する。

ixDpnToPaet :: DPN -> Index -> Vector Index Source #

DPN 形式から親の添字の列を添字で取得する。

ixDpnToNpth :: DPN -> Index -> Depth Source #

DPN 形式から深さを添字で取得する。

calcLimitDepth :: Mountain -> Depth Source #

展開に関わる最も大きい深さを計算する。

calcMaxDepth :: Mountain -> Index -> Depth Source #

展開に関わる最も大きい深さを、それぞれの添字について計算する。

calcDiffOnDpn :: Mountain -> Index -> Difference Source #

DPN 形式での階差の部分を計算する。

calcPaetOnDpn :: Mountain -> Index -> Vector Index Source #

DPN 形式での親の添字の部分を計算する。

calcNpthOnDpn :: Mountain -> Index -> Depth Source #

DPN 形式での深さの部分を計算する。

calcDpn :: Mountain -> DPN Source #

DPN 形式を計算する。

calcBadRoot :: Mountain -> Index Source #

悪部根を計算する。

calcDiffAtExp :: Mountain -> Index -> Difference Source #

展開する際の階差の部分を計算する。

calcPaetAtExp :: Mountain -> Index -> Vector Index Source #

展開する際の親の添字の部分を計算する。

calcNpthAtExp :: Mountain -> Index -> Depth Source #

展開する際の深さの部分を計算する。

expandMtAtLim1 :: Mountain -> Int -> DPN Source #

共終タイプが IsLim 1 である場合において山を展開する。

calcDiffOnMtFromDpnWiM :: Mountain -> DPN -> Index -> Depth -> Difference Source #

メモを参照しながら DPN 形式から山の階差の部分を計算する。

calcPaetOnMtFromDpnWiM :: DPN -> Index -> Depth -> Index Source #

メモを参照しながら DPN 形式から山の親の添字の部分を計算する。

calcAnceOnMtFromDpnWiM :: Mountain -> Index -> Depth -> IndexSet Source #

メモを参照しながら DPN 形式から山の先祖の集合の部分を計算する。

calcMtFromDpn :: DPN -> Mountain Source #

DPN 形式から山を計算する。

calcSeqFromMt :: Mountain -> Sequence Source #

山から数列を計算する。

expandSeqAtLim1 :: Sequence -> Int -> Sequence Source #

共終タイプが IsLim 1 である場合において数列を展開する。

data ExpandingError Source #

expandSeq および expandList におけるエラーを表現する型。

Constructors

OutOfIndexOnFunSeq

基本列において範囲から外れている時。

OutOfClass

クラスが範囲から外れている時。

Instances
Bounded ExpandingError Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Enum ExpandingError Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Eq ExpandingError Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Ord ExpandingError Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Read ExpandingError Source # 
Instance details

Defined in Numeric.YHSeq.V0201

Show ExpandingError Source # 
Instance details

Defined in Numeric.YHSeq.V0201

expandSeq :: Sequence -> Int -> Either ExpandingError Sequence Source #

数列を展開する。

makeListFromSeq :: Sequence -> [Int] Source #

数列からリストを作る。

expandList :: [Int] -> Int -> Either ExpandingError [Int] Source #

リストを展開する。