Giter VIP home page Giter VIP logo

kohomology's Issues

instance of DenseNumVectorSpace

val DenseNumVectorSpaceOverIntRational = DenseNumVectorSpace.from(IntRationalField)

cache は型がやばいので、ついでやめた方が良いかも?

methods for Scalar<S>

  • 和の逆元 unaryMinus()、積の逆元(演算子? infix メソッド?)
  • minusdiv を↑を使って実装する?

Arb.list contains a bug?

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]

有限体

気が向いたら位数 p^n の有限体を実装する.

[FF] を読めば大体できそう.
Conway polynomial を作るところ,特に polynomial f が primitive かどうかを判定するところが非自明だと思ったけど,[GIP] を見ると「f が x^{d-1} を割るかどうか」みたいな判定だけやれば良いっぽい?

[HL] で「新しいアルゴリズム」が提唱されてるけど,(論文内の最後の方に書いてあるように)brute force より必ずしも早いわけではないっぽい(一長一短).
なので単純に brute force を実装した方が(実装の手間を考えると)良さそう.

参考文献:

monoid algebra

FreeGAlgebraMonoidGAlgebra (?) に一般化する.
(つまり,graded monoid からつくられる graded algebra)

Intellij Idea が重くなる

昨日(1/29)あたりから Intellij Idea が異常に重くなった.

試してみたこと:

  • キャッシュ削除
    • File -> Invalidate Caches / Restart
    • rm -r ~/.cache/JetBrains/
    • rm -r kohomology/.idea/
    • git clean -fdX
  • 再インストール

GVectorSpace のメンバ

現状では val getVectorSpace: (Degree) -> VectorSpace<B, S, V> としてるけど、
val getBasis: (Degree) -> List<B> で十分なのでは?

type variable 'Self'

interface Scalar<Self> みたいにして、自身を表す型引数だということを明示する?

multiproject

  • plugin とかの共通部分をまとめる
  • com.github.shwaka.kohomology.core.field にした方が良い?
  • js って名前どうなの?(js.js に出力される)
  • js の compile が失敗する (kotlin-jvm と kotlin-js で conflict?)

Compute determinant using permutations

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.

context に関連した問題点

  • rowEchelonForm の cache
  • get[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 を使いやすくする(vectorSpace1vectorSpace2 の context を統合する)

OverflowDetector

Improvement

  • overloads such as assertNoOverflow(n1: Int, n2: Int, operation: ...)
  • add comments on Integer<*>
  • add WrappedLong

Application

  • Apply to all (?) methods in IntRational (other than plus)
  • Apply to LongRational

Check

  • test in IntRational (depending on the system parameter kococo.debug)
  • decompile

make inline?

Make functions wrap and unwrap inline? (should improve performance)

cache in DenseNumVectorSpace

For each field (and dim?), the corresponding DenseNumVectorSpace should be unique.

It is difficult to implement caching in generic classes.

improve IntModp

  • validation (Is p prime? Has same p? etc...)
  • implement div (no pow for Int in kotlin?)
  • don't use data class (implement constructor with validation and normalization)

[Refactoring] operations of scalars as an extension method in Field (instead of "recursive interface")

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)
    }
}

summary of test failures

radarsh/gradle-test-logger-plugin#145
を参考にして summary of failures を表示するようにしてみたけど,
まだ色々と改善の余地がありそう.

  • 色をつける
  • 同じクラスに属するテストはひとまとめにする
  • クラスの名前は完全修飾名じゃなくて省略したやつにする
  • 長くなりそうなので,plugin (?) として分離する

GLinearMap.fromGVectors

GVector としての値が先に求まる場合に、いちど Vector に戻してから再度 GVector にするのは二度手間

matrix validation

  • 全ての行が同じ長さかどうかをコンストラクターでチェックする
  • 足し算とかをする前にサイズのチェック

type alias for deg

typealias Deg = Int

  • It's useful for future refactoring, e.g. replace Int with Long or custom class such as Z/2 (super)

DGA

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>
}

kohomology-js が動作しない

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());

improve rowEchelonForm

  • Use data class for the return value?
  • Cache
  • 'reduced' row echelon form?
  • Is there better implementation around exchangeCount?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.