# Cholfact on reshape of view of array

**URL:** https://discourse.julialang.org/t/cholfact-on-reshape-of-view-of-array/10674
**Category:** Numerics
**Created:** [May 3, 2018, 9:13am UTC](https://discourse.julialang.org/t/cholfact-on-reshape-of-view-of-array/10674 "2018-05-03T09:13:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![lcambier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lcambier/32/4072_2.png) [@lcambier](https://discourse.julialang.org/u/lcambier)
#### Post date: [May 3, 2018, 9:13am UTC](https://discourse.julialang.org/t/cholfact-on-reshape-of-view-of-array/10674/1 "2018-05-03T09:13:13Z")

</div>

Hi,

I would like to be able to compute the following

```julia
julia> A = ones(1000);
julia> B = view(A, 100:199);
julia> C = reshape(B, 10, 10);
julia> F = cholfact!(C) # Obviously this is not SPD :D 

```

But I get

`ERROR: MethodError: no method matching cholfact!(::Base.ReshapedArray{Float64,2,SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true},Tuple{}})`

I think the underlying thing I’m describing is ok, but I don’t seem to be able to express it correctly so that Cholfact can take it.

Any idea?

---

<div class="post-metadata">

### Author: ![andreasnoack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andreasnoack/32/27_2.png) [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)
#### Post date: [May 3, 2018, 9:38am UTC](https://discourse.julialang.org/t/cholfact-on-reshape-of-view-of-array/10674/2 "2018-05-03T09:38:04Z")

</div>

Which version of Julia? I get

```julia
julia> A = ones(1000);

julia> B = view(A, 100:199);

julia> C = reshape(B, 10, 10);

julia> F = cholfact!(C)
ERROR: Base.LinAlg.PosDefException(2)
Stacktrace:
 [1] _chol!(::Base.ReshapedArray{Float64,2,SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true},Tuple{}}, ::Type{UpperTriangular}) at ./linalg/cholesky.jl:55
 [2] cholfact!(::Hermitian{Float64,Base.ReshapedArray{Float64,2,SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true},Tuple{}}}, ::Type{Val{false}}) at ./linalg/cholesky.jl:211
 [3] cholfact!(::Base.ReshapedArray{Float64,2,SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true},Tuple{}}, ::Symbol) at ./linalg/cholesky.jl:256
 [4] cholfact!(::Base.ReshapedArray{Float64,2,SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true},Tuple{}}) at ./linalg/cholesky.jl:255

```

on Julia 0.6.2

---

<div class="post-metadata">

### Author: ![lcambier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lcambier/32/4072_2.png) [@lcambier](https://discourse.julialang.org/u/lcambier)
#### Post date: [May 3, 2018, 2:06pm UTC](https://discourse.julialang.org/t/cholfact-on-reshape-of-view-of-array/10674/3 "2018-05-03T14:06:36Z")

</div>

> [@andreasnoack](#):
>
> F = cholfact!(C)

Ha 😃 0.6. Great. I will update then.
