Guidance
指路人
g.yi.org
software / rapidq / Examples / ASM / rqasm / vector_rq.rq

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
' Uses pure Rapid-Q code to calculate sum of 10000 vectors

     DECLARE FUNCTION GetTickCount LIB "kernel32" ALIAS "GetTickCount" AS LONG


' prepare data
     DEFINT i, Tmr, j, Vectors(1 TO 30000), Result(1 TO 3)

     RANDOMIZE 666
     FOR i = 1 TO 30000
      Vectors(i) = RND * 10
     NEXT i

' calculate
     Tmr = GetTickCount
     Result(1) = 0: Result(2) = 0
     Result(3) = 0: j = 1
     FOR i = 1 TO 10000
      Result(1) = Result(1) + Vectors(j)
      Result(2) = Result(2) + Vectors(j + 1)
      Result(3) = Result(3) + Vectors(j + 2)
      j += 3
     NEXT i
     Tmr = GetTickCount - Tmr

' display the result
     PRINT "The result is {", Result(1), ", ", Result(2), ", ", Result(3), "}"
     PRINT "Elapsed time: ", Tmr, " ms"
掌柜推荐
 
 
¥289.00 ·
 
 
¥1,080.00 ·
 
 
¥1,380.00 ·
 
 
¥638.00 ·
 
 
¥1,290.00 ·
 
 
¥1,420.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:42:30