Unify `kernelmatrix`, `kernelkronmat`, `kronecker_kernelmatrix`, and `kernelpdmat`?

オープン
#384 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
リファクタリング
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
julia

調査の方向性

まず、kernelmatrix、kernelkronmat、kronecker_kernelmatrix、kernelpdmat の既存の実装と呼び出し箇所を読みます。それらの dispatch とコンテナ型の挙動を比較し、統一 API のスコープと互換性要件を定義します。メンテナーが設計に合意し、影響を受ける機能が引き続きカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

It's late and I haven't thought much about it - but maybe we could unify the different kernel matrix functions by using

# maybe the default dispatch  should depend on `k`, `x`, and `y`?
kernelmatrix(k, x, y) = kernelmatrix(Matrix, k, x, y)
kernelmatrix(k, x) = kernelmatrix(Matrix, k, x)

function kernelmatrix(::Type{T}, k, x, y)::T where {T<:Matrix}
    ...
end
function kernelmatrix(::Type{T}, k, x)::T where {T<:Matrix}
    ...
end

# instead of kronecker_kernelmatrix
function kernelmatrix(::Type{T}, k::MOKernel, x::IsotopicMOInputsUnion, y::IsotopicMOInputsUnion)::T where {T<:KroneckerProduct}
    ...
end
...

# instead of kernelpdmat
function kernelmatrix(::Type{T}, k, x)::T where {T<:PDMat}
    ...
end

I'm sure some parts of the sketch could be improved but the main idea would be to unify the different functions by using an additional argument with the desired (possibly abstract) container type for dispatching.

I assume this would also make it a bit more convenient to eg extend kernelmatrix to CuArray or static arrays.

One could even include kernelkronmat (I assume) if we define a special input type that we can dispatch on:

function kernelmatrix(::Type{T}, k, xgrid::Gridtype)::T where {T<:KroneckerProduct}
...
end
主要言語
Julia
スター
276
フォーク
42
平均マージ
3日 12時間
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

JuliaGaussianProcesses/KernelFunctions.jl のほかの issue

JuliaGaussianProcesses/KernelFunctions.jl の issue をすべて見る

似ている issue

Julia の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。