| |
|
|
p.specht
| Als Vorbereitung a allfällligen Beschleunigung mittels Ensamblador...
Windowtitle "MATMUL - Matrixmultiplikation como Proc"
Windowstyle 24
Ventana 0,0-%maxx,%maxy:imprimir
Declarar s&,sz&,z&,err&
'z&=53 : sz&=50 : s&=17
z&=53 : sz&=1 : s&=10
set("decimals",0):set("numwidth",8)
dec z&:dec sz&:dec s&
Declarar u![z&,sz&],v![sz&,s&],w![z&,s&]
inc z&:inc sz&:inc s&
u![]=&index : v![]=3*&index
Check MATMUL(u![],v![],w![],s&,sz&,z&)
font 2
Check MATPRNT(w![],s&,z&)
waitinput
FIN
Proc MATMUL :parámetros a![],b![],c![],s&,sz&,z&
caso (s&<1) or (sz&<1) or (s&<1):volver -2
caso (s&*sz&*z&)>50000:volver -1
Declarar sum!,prod!,i&,j&,k&
dec s&:dec sz&:dec z&
Whileloop 0,z&:i&=&Loop
whileloop 0,s&:j&=&Loop
sum!=0
whileloop 0,sz&:k&=&Loop
prod!=a![i&,k&]*b![k&,j&]
sum!=sum!+prod!
EndWhile
c![i&,j&]=sum!
EndWhile
EndWhile
volver 0
ENDPROC
Proc MATPRNT
parámetros c![],s&,z&
caso (s&<1) or (s&<1):volver -2
caso (s&*z&)>50000:volver -3
caso (z&>53) or (s&>17):volver -4
declarar i&,j&
dec s&:dec z&
Whileloop 0,z&:i&=&Loop
whileloop 0,s&:j&=&Loop
imprimir c![i&,j&],
EndWhile:imprimir
EndWhile
volver 0
ENDPROC
proc Check:parámetros err&
seleccionar err&
caseof 0:volver
caseof -1:Imprimir " Error: *** Index Overflow ***"
caseof -2:Imprimir " Error: *** Index <=0 ***"
caseof -3:Imprimir " Error: *** Mat too big for RAM ***"
caseof -4:Imprimir " Problema: *** Mat too big for Screen ***"
otherwise :Imprimir " Error: *** unknown ***"
endselect
ENDPROC
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 26.05.2021 ▲ |
|
|
|