On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n), then the
size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in
having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in
ats. If anyone can quickly go through it (whenever they get free time) and
comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n), then the size
(of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in having
dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in ats.
If anyone can quickly go through it (whenever they get free time) and
comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
So how do I determine the number of elements in arrayptr array.
One way I think I could determine the total size in bytes of an array and
then divide size of individual type , but how do I do this ?
Or you are asking to pass “n” the size of vector to functions that need it.
Thanks
On Fri, Feb 14, 2014 at 11:22 AM, gmhwxi <gmh...@gmail.com <javascript:>>wrote:
In general, if the index n occurs in the type vector(a, n), then the size
(of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in having
dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in ats.
If anyone can quickly go through it (whenever they get free time) and
comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
The functions qstruct_objectify and qstruct_unobjectify may shed some
light on this.
On Friday, February 14, 2014 10:56:05 AM UTC-5, chotu s wrote:
Thanks a “lot” guys , I’ll read all the suggestions and links
tomorrow(as it is late here) and will ask related question after that.
Regarding stack allocation , what I had in mind was small size and
temporary arrays whose size is known at compile time , some thing like val
v = make_local_vector_n(n) , where n is known at compile time.
I think stack allocation idea came to me from the udacity parallel
programming competition where allocating main memory on gpu was costly(if I
remember correctly) , but they had different types of memory layer so one
can also use the fast shared memory whose capacity ranged from 64K to
256K(subject to correction).
Actually, most people do not realize that a real danger with alloca is
that tail-recursion,
which should be done in constant space, may easily cause stack-overflow
when it is coupled
with stack-allocation. The issue is very similar to inlining a function
that calls alloca.
On Friday, February 14, 2014 10:09:12 AM UTC-5, Brandon Barker wrote:
Thanks, also here’s some related discussion http://stackoverflow.com/
questions/1018853/why-is-alloca-not-considered-good-practice.
On Feb 14, 2014 9:43 AM, “gmhwxi” gmh...@gmail.com wrote:
You can use alloca to allocate memory on stack at run-time.
Here is an example I did:
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n), then
the size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in
having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean
allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors
in ats. If anyone can quickly go through it (whenever they get free time)
and comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/57f1a0bb-f0ba-4a06-95b3-15f988245530%40go oglegroups.com.