Kristoffer I encountered a similar problem. The best idea I had was to define different types (with different names), and then to write a function `SymmetricTensor(dimension, order)` that returns the type you want.
-erik On Fri, Feb 19, 2016 at 11:53 AM, Kristoffer Carlsson <[email protected]> wrote: > I think a simple example will explain better than I could myself. > > What I want to do is something similar to: > > immutable foo{1, T} > data::Vector{T} > end > > immutable foo{2, T} > data::Matrix{T} > end > > Just like you can specialize functions for different parameter value is > there a way to specialize the type of the field for a specific parameter > value. > > What I reality want to do is to store second order symmetric tensors with a > vector as data and fourth order symmetric tensors with a matrix as data. > > But I still want to be able to have my type as SymmetricTensor{dimension, > order} > > // Kristoffer -- Erik Schnetter <[email protected]> http://www.perimeterinstitute.ca/personal/eschnetter/
