comp.lang.ada
 help / color / mirror / Atom feed
From: Phil Clayton <phil.clayton@lineone.net>
Subject: Re: on using array index, vectorized operation
Date: Sun, 27 Mar 2011 15:37:13 -0700 (PDT)
Date: 2011-03-27T15:37:13-07:00	[thread overview]
Message-ID: <74980e07-b6d2-42ee-9354-5c2dfd5fdcde@y31g2000prd.googlegroups.com> (raw)
In-Reply-To: imoc1n$1fa$1@speranza.aioe.org

On Mar 27, 11:00 pm, "Nasser M. Abbasi" <n...@12000.org> wrote:
> Only problem now is that I need to figure the castings I need
> to do to make the compile happy, Since now I get the error:
>
> $ gnatmake foo.adb
> gcc-4.4 -c foo.adb
> foo.adb:10:14: there is no applicable operator "-" for type "buffer_t" defined at line 2
> gnatmake: "foo.adb" compilation error
> $
>
> Will look at this now, how best to solve this? I understand
> that it want me to define a "-" operator for buffer_t. I really do
> not want to cast things, I need to find the best solution to this.
>
> May be I need to define a function "-" for buffer_t ?

(So please ignore my previous question.)

I had a similar quandary a few years ago where it was necessary to
describe results of vectorized operations (from Simulink as it
happens) using a language that had no natural support for
vectorization.  The thought of defining variants of operations to work
on 1-D arrays, another set of variants for 2-D arrays etc. was too
horrendous.  It was far simpler to promote scalar operations using a
loop, like in your example.  (We actually produced a vectorized meta-
notation that allowed an expression form of loop like 'for-aggregates'
that I've mentioned before, so didn't need to deal with temporary
variables.)  My advice would be to stick to the loop version, with
temporary variables if necessary, as that is most traceable to the
original text and surely the most maintainable.

Phil



> But I am happy now that at least I can avoid explicit loops if needed.



  reply	other threads:[~2011-03-27 22:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-27  1:31 on using array index, vectorized operation Nasser M. Abbasi
2011-03-27 18:48 ` Nasser M. Abbasi
2011-03-27 20:01 ` Cyrille
2011-03-27 20:44   ` Nasser M. Abbasi
2011-03-27 21:02     ` Pascal Obry
2011-03-27 21:30     ` Shark8
2011-03-27 22:00       ` Nasser M. Abbasi
2011-03-27 22:37         ` Phil Clayton [this message]
2011-03-27 22:43           ` Nasser M. Abbasi
2011-03-27 22:59             ` Phil Clayton
2011-03-27 22:09     ` Phil Clayton
2011-03-27 22:12       ` Nasser M. Abbasi
2011-03-27 22:23       ` Nasser M. Abbasi
2011-03-29  2:50         ` Randy Brukardt
2011-03-29  4:55           ` Nasser M. Abbasi
2011-03-29 20:11             ` Phil Clayton
2011-03-29 21:17               ` Nasser M. Abbasi
2011-03-29 22:49                 ` Phil Clayton
2011-03-29 23:47                   ` Nasser M. Abbasi
2011-03-30 13:00                     ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox