Skip to content

Wrap matrix copyto! incorrect #144

Description

@liamh

When using copyto! with wrap_gsl_matrix, the result looks correct but it is not.

using GSL
mat = reshape([Float64(10*j+i) for i=1:2 for j=1:4],4,2)
matgsl = GSL.matrix_alloc(4,2)
copyto!(GSL.wrap_gsl_matrix(matgsl), CartesianIndices((4,2)), mat, CartesianIndices((4,2)))

Which gives the expected results for mat and GSL.wrap_gsl_matrix(matgsl)

4×2 Matrix{Float64}:
 11.0  12.0
 21.0  22.0
 31.0  32.0
 41.0  42.0

but e.g. the first column that's actually in the GSL matrix is not correct

[GSL.matrix_get(matgsl,i,0) for i=0:3]
4-element Vector{Float64}:
 11.0
 31.0
 12.0
 32.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions