English
Source / code snippets

from two Randwertvektoren a and b' a Matrix C create, with X4-Assembler

 

p.specht

the following Prog for X4-ASM prepares the Spatprodukt zweier Vektoren To to size 500 x 500. it deals itself circa a demonstration without jedwede Gewähr!

Formel: c_i,j = a_i X (b_j)'

Window Title "Spatprodukt zweier Randwert-Vektoren on a Matrix, with X4-ASM"
Window Style 24:Cls:set("AsmMode",0)
'--------------------------
Var Asize& = 20
Var Bsize& = 4' ... Examples
'{--------------------------
print "\n Spatprodukt zweier Randwert-Vektoren | . __ with the Dimensionen ";
print stature$("#,##0",Asize&);"And ";stature$("#,##0",Bsize&)
declare i&,j&,err&,tmp&,tm&
tmp&=&gettickcount
declare a![Asize&-1],b![Bsize&-1],c![Asize&-1,Bsize&-1]
tmp&=&gettickcount-tmp&
Print "\n Vektoren and Spat declared in ";tmp&;" ms."
'}
'{
print "\n values allocated in ... ";:Randomize
tmp&=&gettickcount
a![]=&index+1' rnd() ' 2e10
b![]=10*&index'rnd(100)  ' rnd() ' -1.1e10
tmp&=&gettickcount-tmp&
print tmp&; " ms."
'}
'{asmSPATPRODfloat
ASM "aSPATPRODf",5'addr(a![0]),sizeof(a![]),addr(b![0]),sizeof(b![]),addr(c![0,0])
'errors intercepting
mov edi,par2:cmp edi,501:jge err1
mov edi,par4:cmp edi,501:jge err1
'Init
mov eax,par1'vec->a_ram
mov ebx,par3'vec->b_ram
mov ecx,par5'vec->c_ram
mov edx,0'i->a
mov esi,0'j->b
FINIT
MAINLOOP:
FLD qword ptr [eax]
FLD qword ptr [ebx]
FMUL
FSTP qword ptr [ecx]
'nextrow:
inc edx
cmp edx,par2'if row = size_a
apiece prepnextcol
add eax,8
add ecx,8
jmp MAINLOOP
prepnextcol:
inc esi'nextcol
cmp esi,par4'if col=size_b
apiece noerr'then end
mov edx,0
mov eax,par1'else resetvec_a
add ebx,8'next vec_b
add ecx,8'incr vec_c
jmp MAINLOOP
'Fehlertabelle
err1:
mov eax,$FFFFFFFF
jmp ready
noerr:
mov eax,0
ready:
ENDASM
tm&=&gettickcount
err&=aSPATPRODf( addr(a![0]),sizeof(a![]), addr(b![0]),sizeof(b![]), addr(c![0,0]) )
tm&=&gettickcount-tm&
'}
'{ Ausgabeteil

if err&

    font 2:print "\n *** Error ";err&;": vector To big! ***":font 0

else

    set("decimals",14):set("numwidth",18)
    font 2:print "\n\n Result errechnet in ";tm&;" ms."
    waitinput 5000
    print "\n Spatmatrix:\n":font 0

    whileloop 0,Asize&-1:i&=&Loop

        whileloop 0,Bsize&-1:j&=&Loop

            print c![i&,j&],
            endwhile:print
            endwhile:print "\n---":beep

        endif

        waitinput
        end
        '}
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/26/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.401 Views

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie