Skip to content

Explicit typecast in pcasvd prevents FixedSizeArray usage #245

@bertini97

Description

@bertini97

Hi, when using FixedSizeArrays and trying to do PCA with the SVD method

using FixedSizeArrays, MultivariateStats
M = FixedSizeArray(randn(10, 100))
fit(PCA, M, method=:svd)

one is met with

TypeError: in typeassert, expected Vector{Float64}, got a value of type FixedSizeArray{Float64, 1, Memory{Float64}}

Stacktrace:
 [1] pcasvd(Z::FixedSizeArray{…}, mean::FixedSizeArray{…}, n::Int64; maxoutdim::Int64, pratio::Float64)
   @ MultivariateStats ~/.julia/packages/MultivariateStats/sSKHh/src/pca.jl:242

because of the cast in

v = Svd.S::Vector{T}

Overwriting the function removing the explicit typecast makes it work (it results in an unrelated error in StatsBase). Is there something that can be done about this? Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions