Stefan Behnel wrote:
> Hi,
>
> Dag Sverre Seljebotn wrote:
>> OK, I misunderstood you again. Breaking down what you say in two:
>>
>> 1) Syntax of SIMD view type. You propose SIMD[something] instead of
>> basetype[something] -- that can obviously be made to work. As all syntax
>> it is a matter of taste. I'll certainly go for whatever majority vote
>> says here, it's not very important to me, but I vote for
>> basetype[something] as it looks a lot more attractive for potential
>> numerical users IMO.
>>
>> 2) Acquisition. You could rewrite your example with my syntax like e.g.
>> this:
>>
>> obj = cython_array_type[int](20, 20) # create array object
>> cdef int[:,:] some_simd
>> some_simd = int[:,:](obj)
>>
>> IIUC you would just switch out int[:,:] with SIMD[...] to get something
>> close to what you want.
>>
>> Hmm. I actually like the explicitness that you propose. But it is a
>> matter of verbosity/repeating, as replacing line 3 with "some_simd =
>> obj" could only mean one thing. I'm +0 on this issue.
>>
>> In pure Python mode, one would definitely have to do "some_simd =
>> int[:,:](obj)" though.
>
> Explicitness was a major reason for my counterproposal, yes. And I think
> the same would work in Python, where the SIMD type would be used to wrap a
> buffer/array object.
I'll let you and Robert go on with the syntax discussion without me.
However I have my doubts on whether you'll get anywhere, I maintain that
this is likely a matter of taste in the end, with no objectively "right"
or "wrong" decision.
Are you OK with leaving the issue to popular vote?
To recap, there's two decisions:
a) Whether a view must be explicitly requested or is "coerced", i.e.
whether one can do
x = np.sin(x) # get view on result
or has to do
x = SIMD_TYPE_SPECIFIER(np.sin(x))
b) SIMD view type syntax
I strongly maintain that some information must be present per dimension
-- I can post more details if you wish, but for clarity I will use
"stridespec" as a placeholder below.
Furthermore there's the question of allowing per-dimension wraparound
disabling.
Then, some options:
OPTION A:
int[::stridespec,::stridespec]
int[0::stridespec,::stridespec] -- default stridespec, but do not
wraparound on first dim
Default stridespec possible.
OPTION B:
SomeWord[int, ::stridespec, ::stridespec]
SomeWord[int, 0::stridespec, ::stridespec]
Default stridespec possible. Looks odd to me with the type on the "first
dimension".
OPTION C:
SomeWord[int, (stridespec, stridespec)]
SomeWord[int, (stridespec, stridespec), (False, True)]
Default stridespec not possible (unless perhaps on all strides at the
same time: SomeWord[int])
If you agree with a popular vote deciding it, I suppose we should start
a new thread and put it more nicely.
--
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev