Static Array times scalar

How to multiply a static array with a scalar with allocating memory ?

I tried

Aloc = SVector{36}(SVector(Bloc)./Scalar(area)

and variants without succes.

Thx!

Could you make an MWE? What is Bloc? What is Scalar() and area? What error are you seeing?

FWIW:

julia> v1 = SVector(1, 2, 3)
3-element SVector{3, Int64} with indices SOneTo(3):
 1
 2
 3

julia> v1 / 2
3-element SVector{3, Float64} with indices SOneTo(3):
 0.5
 1.0
 1.5

julia> v1 ./ 2
3-element SVector{3, Float64} with indices SOneTo(3):
 0.5
 1.0
 1.5

julia> v1 .= v1 ./ 2
ERROR: setindex!(::SVector{3, Int64}, value, ::Int) is not defined.
 Hint: Use `MArray` or `SizedArray` to create a mutable static array

Many thanks.

I fixed the issue in creating a MWE.

Cheers, Domenico.

2 Likes