How about creating a page in the jwiki, e.g.
http://www.jsoftware.com/jwiki/Puzzles/Copy_Columns ?

In the interpreter, copy4=: (* {:@$) $"1 ] is implemented
using the "repeated squaring" algorithm in copy2 and copy2a.
http://www.jsoftware.com/jwiki/Essays/Repeated_Squaring



----- Original Message ----- 
From: "Oleg Kobchenko" <[EMAIL PROTECTED]>
To: "Programming forum" <[email protected]>
Sent: Saturday, March 18, 2006 3:45 PM
Subject: RE: [Jprogramming] Different(and maybe more elegant) ways of copying?

There is an enhancement to batchtest to show barchart
and quivalence.

   http://www.jsoftware.com/jwiki/Guides/Batch_Test

+--+--------+---------------------+
|  |A       |B                    |
+--+--------+---------------------+
|0 |**  *** |******     ********* |
|1 |*   *** |**         ******    |
|2 |*   *** |***        ********* |
|2a|**  ****|*****      **********|
|3 |*** ****|********** ********* |
|3a|**  *** |*****      ********* |
|4 |*   *   |**         ***       |
+--+--------+---------------------+

   eqtest'pcopy1'
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1

NB. here is the full script ============================

require 'user/batchtest/batchtest.ijs'
(coclass [ coerase@<) 'pcopy1'
coextend 'pbatchtest'

create=: 3 : 0
  CASPR=: 'copy'
  create_pbatchtest_ f. ''
  TITLE=: 'Copy'
  SHOWWHAT=: ;:'tableout barsout plot'
  ITERATIONS=: 5
  XPOSE=: 1
  XARG=: '2000'
)

copy0=: 13 : ',./ > x $< y'
copy1=: ([ (* $ [EMAIL PROTECTED]) {:@[EMAIL PROTECTED]) {"1 ]
copy2=: 4 : '> ,.&.>/ ,.~&.>^:(I.|.#:x) <y'
copy2a=: 4 : '(x*{:$y) {."1 ,.~^:(>.2^.1>.x) y'
copy3=: ,/@(#,:)&.|:
copy3a=: [:,./ (#,:)
copy4=: (* {:@$) $"1 ]

seriesA=: 10 10 $'abcd'
seriesB=: 20 10 $'abcd'

btest >coname''   NB. run with Ctrl+W


--- Oleg Kobchenko <[EMAIL PROTECTED]> wrote:

> Here is another
> 
>    copy4=: (* {:@$) $"1 ]
> 
> +--+------------------+---------------------+
> |  |A                 |B                    |
> +--+------------------+---------------------+
> |0 | 0.00101577 526144| 0.00291462 1.05043e6|
> |1 | 0.00053694 525632| 0.00103952    787776|
> |2 |0.000362057 523520| 0.00171139 1.04192e6|
> |2a| 0.00118339 528384| 0.00272772 1.05267e6|
> |3 | 0.00150857 526720| 0.00523586 1.05101e6|
> |3a|0.000719645 526144| 0.00256317 1.05043e6|
> |4 | 6.95619e_5 263552|0.000824127    525696|
> +--+------------------+---------------------+
> 
> copy0=: 13 : ',./ > x $< y'
> copy1=: ([ (* $ [EMAIL PROTECTED]) {:@[EMAIL PROTECTED]) {"1 ]
> copy2=: 4 : '> ,.&.>/ ,.~&.>^:(I.|.#:x) <y'
> copy2a=: 4 : '(x*{:$y) {."1 ,.~^:(>.2^.1>.x) y'
> copy3=: ,/@(#,:)&.|:
> copy3a=: [:,./ (#,:)
> copy4=: (* {:@$) $"1 ]
> 
> seriesA=: 10 10 $'abcd'
> seriesB=: 20 10 $'abcd'
> 
>    2000 (copy0 -: copy4) seriesA
> 1


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to