shwaka / kohomology Goto Github PK
View Code? Open in Web Editor NEWCohomology calculator for Sullivan algebras
Home Page: https://shwaka.github.io/kohomology
License: GNU General Public License v3.0
Cohomology calculator for Sullivan algebras
Home Page: https://shwaka.github.io/kohomology
License: GNU General Public License v3.0
typealias Deg = Int
Int
with Long
or custom class such as Z/2 (super)matrixSpace.arb(intArb, rowCount, colCount)
interface Scalar<Self>
みたいにして、自身を表す型引数だということを明示する?
data class
for the return value?NumVectorSpace.fromValues(vararg values: S): V
昨日(1/29)あたりから Intellij Idea が異常に重くなった.
試してみたこと:
File -> Invalidate Caches / Restart
rm -r ~/.cache/JetBrains/
rm -r kohomology/.idea/
git clean -fdX
tags representing fields: IntRational
, BigRational
Arb.list(Arb.int(-100..100), 5..5)
returns something like:
[0, 1, -1, 67, 65]
[0, 1, -1, -48, 2]
[0, 1, -1, 25, 70]
[0, 1, -1, -65, 74]
unaryMinus()
、積の逆元(演算子? infix
メソッド?)minus
と div
を↑を使って実装する?DenseMatrixSpace.fromVectors(v1, v2, ..., vn)
For each field
(and dim
?), the corresponding DenseNumVectorSpace
should be unique.
It is difficult to implement caching in generic classes.
pow
for Int
in kotlin?)data class
(implement constructor with validation and normalization)Improvement
assertNoOverflow(n1: Int, n2: Int, operation: ...)
Integer<*>
WrappedLong
Application
IntRational
(other than plus
)LongRational
Check
IntRational
(depending on the system parameter kococo.debug
)radarsh/gradle-test-logger-plugin#145
を参考にして summary of failures を表示するようにしてみたけど,
まだ色々と改善の余地がありそう.
Currently, we implement determinant only by using Gaussian elimination.
It would be nice to implement it also by using permutations (i.e. directly by definition), and compare the two implementations as a test.
implement DenseMatrix::toString
(and DenseMatrix::toPrettyString
?)
Set shape in the constructor?
rowEchelonForm
の cacheget[i, j]
とかは直接 Matrix
に定義しても良い気がするmultiply(matrix: M, scalar: S)
は multiply(scalar: S, matrix: M)
の方が良い気がするadd(a: Vector, b: Vector)
での VectorSpace
のチェックは a.vectorSpace == this
でやる (現状は a.vectorSpace == b.vectorSpace
)tensorProduct.withContext
を使いやすくする(vectorSpace1
と vectorSpace2
の context を統合する)Cannot import kococo from kohomology-js
class GAlgebra<B, S : Scalar<S>, V : NumVector<S, V>, M : Matrix<S, V, M>> : GVectorSpace<B, S, V>
interface Differential<B, S : Scalar<S>, V : NumVector<S, V>, M : Matrix<S, V, M>> {
val gVectorSpace: GVectorSpace<B, S, V>
val differential: GLinearMap<B, B, S, V, M>
fun cohomology(): GVectorSpace<B, S, V>
}
class ChainComplex<B, S : Scalar<S>, V : NumVector<S, V>, M : Matrix<S, V, M>> : Differential<B, S, V, M>
class DGAlgebra<B, S : Scalar<S>, V : NumVector<S, V>, M : Matrix<S, V, M>> : ChainComplex<B, S, V, M> {
override val gVectorSpace: GAlgebra<B, S, V, M>
override fun cohomology(): GAlgebra<B, S, V, M>
}
com.github.shwaka.kohomology.core.field
にした方が良い?js.js
に出力される)README.md
だけが変更されたときとか
if (hoge)
throw Exception("Error")
Multiply Int
with Scalar
or NumVector
GVector
としての値が先に求まる場合に、いちど Vector
に戻してから再度 GVector
にするのは二度手間
val DenseNumVectorSpaceOverIntRational = DenseNumVectorSpace.from(IntRationalField)
cache は型がやばいので、ついでやめた方が良いかも?
fromCoeff(coeffMap: Map<Int, S>)
的な感じで実装する?
fromBasisName(basisName: B)
は常にsparseなので、それを使って実装したい
前者は factory method だけど、後者は consturctor を直接使ってる
FreeGAlgebra
を MonoidGAlgebra
(?) に一般化する.
(つまり,graded monoid からつくられる graded algebra)
Add property dim
to the interfaces NumVector
and NumVectorSpace
?
FreeSpec
あたりを使って nested test にした方が FreeGAlgebraTest
は良い感じにまとめられそう。
しかし gradle-test-logger-plugin
が nested test にまだ対応していないので、とりあえず対応待ち。
参考:
全部の Indeterminate
の次数が負なら大丈夫 (正と負が混ざるとやばい)
現状では val getVectorSpace: (Degree) -> VectorSpace<B, S, V>
としてるけど、
val getBasis: (Degree) -> List<B>
で十分なのでは?
If an exception is thrown in a test, the stack trace is insufficient where the exception occurred
also update wrapper (run gradle wrapper
)
Make functions wrap
and unwrap
inline? (should improve performance)
interface Scalar
interface Field<S : Scalar> {
fun add(a: S, b: S): S
operator fun S.plus(other: S): S = this@Field.add(this, other)
fun <T> withContext(block: Field<S>.() -> T) = block()
}
data class IntRational(val numerator: Int, val denominator: Int) : Scalar
object IntRationalField : Field<IntRational> {
override fun add(a: IntRational, b: IntRational): IntRational {
val numerator = a.numerator * b.denominator + a.denominator * b.numerator
val denominator = a.denominator * b.denominator
return IntRational(numerator, denominator)
}
}
TensorProduct
-> TensorProductSpace
?vectorSpace1
-> firstComponent
?気が向いたら位数 p^n の有限体を実装する.
[FF] を読めば大体できそう.
Conway polynomial を作るところ,特に polynomial f が primitive かどうかを判定するところが非自明だと思ったけど,[GIP] を見ると「f が x^{d-1} を割るかどうか」みたいな判定だけやれば良いっぽい?
[HL] で「新しいアルゴリズム」が提唱されてるけど,(論文内の最後の方に書いてあるように)brute force より必ずしも早いわけではないっぽい(一長一短).
なので単純に brute force を実装した方が(実装の手間を考えると)良さそう.
参考文献:
該当箇所:
private val gVectorContext = GVectorContext(numVectorSpace.field, numVectorSpace, this)
BilinearMap を cache する
in RowEchelonForm
sealed class?
kohomology-js
をビルドしてブラウザから実行すると以下の実行時エラーが起きる.
Uncaught TypeError: Cannot read property '_field_4' of undefined
at new DenseMatrixSpace (webpack-internal:///./kotlin/kohomology-js.js:27821)
at Companion_29.from (webpack-internal:///./kotlin/kohomology-js.js:27951)
at Object.eval (webpack-internal:///./kotlin/kohomology-js.js:30354)
at eval (webpack-internal:///./kotlin/kohomology-js.js:5)
at Object.eval (webpack-internal:///./kotlin/kohomology-js.js:8)
at eval (webpack-internal:///./kotlin/kohomology-js.js:30365)
at Object../kotlin/kohomology-js.js (kohomology-js.js:493)
at __webpack_require__ (kohomology-js.js:30)
at Object.0 (kohomology-js.js:505)
at __webpack_require__ (kohomology-js.js:30)
b5ad32f (git bisect
して見つけた)
webpack-internal:///./kotlin/kohomology-js.js:30354
を見ると以下のように書いてある.
DenseMatrixSpaceOverIntRational
の定義が DenseNumVectorSpaceOverIntRational
よりも先に来てしまっているのが問題.
DenseMatrixSpaceOverIntRational = Companion_getInstance_28().from(DenseNumVectorSpaceOverIntRational);
DenseMatrixSpaceOverLongRational = Companion_getInstance_28().from(DenseNumVectorSpaceOverLongRational);
DenseMatrixSpaceOverBigRational = Companion_getInstance_28().from(DenseNumVectorSpaceOverBigRational);
DenseNumVectorSpaceOverIntRational = Companion_getInstance_29().from_0(IntRationalField_getInstance());
DenseNumVectorSpaceOverLongRational = Companion_getInstance_29().from_0(LongRationalField_getInstance());
DenseNumVectorSpaceOverBigRational = Companion_getInstance_29().from_0(BigRationalField_getInstance());
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.