JuliaGaussianProcesses / JuliaGaussianProcesses/KernelFunctions.jl

Calling kernelmatrix on a vector means its size becomes fixed (e.g. push! to it no longer works)

Open
#319 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Julia
Stars
275
Forks
41
PR merge metrics
No merged PRs in 30d

Description

This might be a bug of Julia but here goes:

This does not work

X = ColVecs(rand(3, 20))
Z = collect.(X)
kernelmatrix(SqExponentialKernel(), [X[1]], Z)
push!(Z, X[1])
ERROR: cannot resize array with shared data

but this does (note the copy on Z)

X = ColVecs(rand(3, 20))
Z = collect.(X)
kernelmatrix(SqExponentialKernel(), [X[1]], copy(Z))
push!(Z, X[1])

also this does not work

X = [rand(3) for _ in 1:20]
Z = collect.(X[1:5])
kernelmatrix(SqExponentialKernel(), [X[1]], Z)
push!(Z, X[1])

Also removing the call to kernelmatrix solves the problem, and
When going to the stack trace this just leads to some ccall, so it's hard to go further....

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the Julia examples in the report, comparing the calls with Z and copy(Z). Start at kernelmatrix and follow the stack trace into the reported ccall boundary to find why Z becomes non-resizable. Done means the original Z remains resizable after kernelmatrix, while the existing kernel-matrix examples continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.