Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #13674

Re: Permutation Tensor

From mhx@iae.nl (Marcel Hendrix)
Subject Re: Permutation Tensor
Newsgroups comp.lang.forth
Message-ID <17621796968435@frunobulax.edu> (permalink)
Date 2012-07-07 18:41 +0200
References <9b0e8738-1608-4239-9851-1f39a77ae48a@r3g2000yqh.googlegroups.com>
Organization Wanadoo

Show all headers | View raw


Krishna Myneni <krishna.myneni@ccreweb.org> writes Re: Permutation Tensor

> On Jul 7, 10:53 am, m...@iae.nl (Marcel Hendrix) wrote:
>> Krishna Myneni <krishna.myn...@ccreweb.org> writes Re: Permutation Tensor

[..]

> I stand corrected! How about Paul's locals version? 
[..]

Nice register based code (when using the iForth PARAMS|), but the 
multiplications apparently slow it down (eps). With Standard LOCALS| the 
code is prepostorously slow (eps2).

-marcel

-- ------------------------------------------------
\ For i,j,k  in {1,2,3}, returns n = -1, 0, or 1
: lcsymbol ( i j k -- n )
    >r >r 10 * r> + 10 * r> +
    case
      123 of  1 endof
      231 of  1 endof
      312 of  1 endof
[..]

: eps  params| i j k | ( i j k -- n )  i j - j k - * k i - * 2/ ; 
: eps2 LOCALS| k j i | ( i j k -- n )  i j - j k - * k i - * 2/ ; 

[..]

: TESTe  ( -- n ) 0  4 0 DO 4 0 DO  4 0 DO  K J I eps       +  LOOP LOOP LOOP ;
: TESTe2 ( -- n ) 0  4 0 DO 4 0 DO  4 0 DO  K J I eps2      +  LOOP LOOP LOOP ;

: TOPTEST ( u -- )
	1 UMAX LOCAL #times
	CR ." lcsymbol  : " timer-reset 0  #times 0 ?DO TEST   + LOOP . .elapsed
	CR ." lcsymbol2 : " timer-reset 0  #times 0 ?DO TEST2  + LOOP . .elapsed
	CR ." lcsymbol3 : " timer-reset 0  #times 0 ?DO TEST3  + LOOP . .elapsed
	CR ." lcsymbol4 : " timer-reset 0  #times 0 ?DO TEST4  + LOOP . .elapsed 
	CR ." eps       : " timer-reset 0  #times 0 ?DO TESTe  + LOOP . .elapsed 
	CR ." eps2      : " timer-reset 0  #times 0 ?DO TESTe2 + LOOP . .elapsed ;

\ FORTH> 10000000 toptest
\ lcsymbol  : 0 3.059 seconds elapsed.
\ lcsymbol2 : 0 2.773 seconds elapsed.
\ lcsymbol3 : 0 1.492 seconds elapsed.
\ lcsymbol4 : 0 1.531 seconds elapsed.
\ eps       : 0 2.850 seconds elapsed.
\ eps2      : 0 5.933 seconds elapsed. ok

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Permutation Tensor Arnold Doray <invalid@invalid.com> - 2012-07-05 07:13 +0000
  Re: Permutation Tensor "A. K." <akk@nospam.org> - 2012-07-05 09:25 +0200
    Re: Permutation Tensor Arnold Doray <invalid@invalid.com> - 2012-07-05 08:42 +0000
      Re: Permutation Tensor "A. K." <akk@nospam.org> - 2012-07-05 11:25 +0200
        Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-06 18:49 -0700
          Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 08:32 +0200
            Re: Permutation Tensor "A. K." <akk@nospam.org> - 2012-07-07 09:49 +0200
            Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 05:35 -0700
               Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 15:45 +0200
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 07:32 -0700
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 17:53 +0200
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 09:10 -0700
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 18:41 +0200
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 12:24 -0700
                Re: Permutation Tensor Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-07-08 07:48 +0100
                Re: Permutation Tensor Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-07-08 08:09 +0100
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-08 09:23 +0200
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-08 05:55 -0700
                Re: Permutation Tensor Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-07-08 20:14 +0100
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-08 13:49 -0700
                Re: Permutation Tensor Paul Rubin <no.email@nospam.invalid> - 2012-07-07 13:03 -0700
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 23:54 +0200
                Re: Permutation Tensor Paul Rubin <no.email@nospam.invalid> - 2012-07-07 16:43 -0700
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-08 09:07 +0200
                Re: Permutation Tensor Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-08 13:03 +0000
                Re: Permutation Tensor anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-09 14:50 +0000
                Re: Permutation Tensor m.a.m.hendrix@tue.nl - 2012-07-10 00:28 -0700
                Re: Permutation Tensor anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-10 10:11 +0000
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-10 21:37 +0200
                Re: Permutation Tensor anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-11 13:50 +0000
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-10 05:10 -0700
        Re: Permutation Tensor Paul Rubin <no.email@nospam.invalid> - 2012-07-06 20:46 -0700
          Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 05:36 -0700
  Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-06 18:18 -0700
    Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-06 18:33 -0700
    Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 07:28 -0700
      Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 08:02 -0700
  Re: Permutation Tensor Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-07 19:58 +0000
    Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-08 05:45 -0700
      Re: Permutation Tensor Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-08 20:05 +0000
  Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-08 14:24 +0200
    Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-11 07:09 +0200
      Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-11 18:42 +0200
        Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-11 20:18 +0200
          Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-12 12:43 +0200
  Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-08 23:44 +0200
    Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-10 17:06 -0700
      Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-11 07:09 +0200

csiph-web