I just find a solution: use AbstractArray(I don't know if this appears only
in v0.4,but this is what I need I think!) thanks folks!
2015-10-15 20:53 GMT+08:00 Roger Luo :
> I just start to write the program so I may not have any code to post.
> I want to define a
On Thu, Oct 15, 2015 at 8:53 AM, Roger Luo wrote:
> I just start to write the program so I may not have any code to post.
> I want to define a position of a particle like
>
> type particle{T}
> pos::T
> end
>
> but I hope the type of pos can be limited rather than the
It's like what if I want to define a 3-dimension linear space R^3 as an
abstract type and the Array{Float,3} is a subtype-like type of the abstract
type 3-dimension linear space?
I want a linear space as abstract type and some subtypes that can do the
linear algebra.
2015-09-25 20:36 GMT+08:00
I just start to write the program so I may not have any code to post.
I want to define a position of a particle like
type particle{T}
pos::T
end
but I hope the type of pos can be limited rather than the supertype any
2015-10-15 20:51 GMT+08:00 Roger Luo :
> It's
On Thu, Oct 15, 2015 at 10:05 AM, Roger Luo wrote:
> But what if I want to restrict the number of a array I use?
> if the type is like
>
> type particle
> pos
> end
>
> and I want to restrict the pos's type to be an Array but the dimension
> should be 1,but do not
Thanks!
在 2015年10月15日星期四 UTC+8下午10:13:08,Yichao Yu写道:
>
> On Thu, Oct 15, 2015 at 10:05 AM, Roger Luo > wrote:
> > But what if I want to restrict the number of a array I use?
> > if the type is like
> >
> > type particle
> > pos
> > end
> >
> > and I want to
But what if I want to restrict the number of a array I use?
if the type is like
type particle
pos
end
and I want to restrict the pos's type to be an Array but the dimension
should be 1,but do not restrict the Type of the Array
or is there any other type can act like a vector but not the
Julia's parametric types are invariant (except tuples). To figure out
what that means have a read through
http://docs.julialang.org/en/release-0.4/manual/types/#parametric-composite-types
> How to make Array{BigFloat,1}<:Array{Real,1}?
This is always false (that is invariance). But presumably
Thanks,I've read about the arrays,but just don't know how to define some
existed type.
though a type may be define as:
type a{T<:Integer}<:Real
xxx
end
but that's will work in my function.I tried to pass different types into a
function, so I asked this question.
still do not understand why can
I have some trouble understand your question.
On Fri, Sep 25, 2015 at 8:22 AM, Roger Luo wrote:
> Thanks,I've read about the arrays,but just don't know how to define some
> existed type.
You cannot redefine a type. Or do you mean how are certain existed
types
10 matches
Mail list logo