Oh right, these are permeability tensors, thanks for explaining! In that case I think you could symmetrize the tensor for visualization purposes (if it mattered) and use the eigendecomposition if you wanted. Though as you can see, working directly with the tensor as a linear map can be very easy and arguably less mysterious.
Here’s an alternative visualization technique which doesn’t rely on the tensor being symmetrical. The idea is to plot the vector field K*v on the unit sphere using an arrow plot. I’ve added |K*v| as the color of the sphere.
I’ve also iterated over several origins to place a small 1x1x3 grid of these visualizations so you can see that’s quite easy.
using Makie
using LinearAlgebra
using StaticArrays
# Utility to split an array-of-length-3-arrays into x,y,z components
split_coords(ps) = getindex.(ps,1), getindex.(ps,2), getindex.(ps,3)
# Spherical Fibonacci numbers for Quasi-random distribution on the sphere.
# See "Spherical Fibonacci Point Sets for Illumination Integrals" by Marques et al.,
# doi:10.1111/cgf.12190
function spherical_fib(j, N)
θ = acos(1 - 2*j/N)
ϕ = 2*j*π/MathConstants.φ
(θ,ϕ)
end
# Convert spherical coordinates to Cartesian coordinates.
# Note that θ,ϕ are named according to the "physicist convention"
# Note that using Vec3f0 here is efficient, but you could just use a
# normal array and everything would still work.
spherical_to_cartesian(r,θ,ϕ) = Vec3f0(r*sin(θ)*cos(ϕ), r*sin(θ)*sin(ϕ), r*cos(θ))
K = SA[ 0.070087 -0.0386396 0.00209088;
-0.0441344 0.105735 0.00012994;
-0.00553273 -0.00292807 0.0896236]
# If desired, symmetrize K
# K = 0.5*(K + K')
scene = Scene()
for origin in Point3f0[(-3,0,0), (0,0,0), (3,0,0)]
# Plot a parametric unit sphere
θ = range(0,pi,length=100)
ϕ = permutedims(range(0,2pi,length=100))
ps = spherical_to_cartesian.(1.0, θ, ϕ)
surface!(scene, split_coords(Ref(origin) .+ ps)..., color=norm.(Ref(K) .* ps))
N = 500
vs = map(j->spherical_to_cartesian(1, spherical_fib(j,N)...), 1:N)
Kvs = Ref(K) .* vs
arrows!(scene, Ref(origin) .+ vs, 0.1 .* Kvs, arrowsize=0.05, linewidth=3, lengthscale=30, arrowcolor=norm.(Kvs))
end
scene
# Makie.save("tensor.png", scene)
