English
Source / code snippets

MATMUL - real Matrizenmultiplikation as Proc

 

p.specht

as preparation to allfällligen Beschleunigung through Assembler...
Windowtitle "MATMUL - Matrixmultiplikation as Proc"
Windowstyle 24
Window 0,0-%maxx,%maxy:print
Declare 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&
Declare 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
END

Proc MATMUL :parameters a![],b![],c![],s&,sz&,z&

    case (s&<1) or (sz&<1) or (s&<1):return -2
    case (s&*sz&*z&)>50000:return -1
    Declare 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

    return 0

ENDPROC

Proc MATPRNT

    parameters c![],s&,z&
    case (s&<1) or (s&<1):return -2
    case (s&*z&)>50000:return -3
    case (z&>53) or (s&>17):return -4
    declare i&,j&
    dec s&:dec z&

    Whileloop 0,z&:i&=&Loop

        whileloop 0,s&:j&=&Loop

            print c![i&,j&],
            EndWhile:print

        EndWhile

        return 0

    ENDPROC

    proc Check:parameters err&

        select err&

            caseof  0:return

            caseof -1:Print " Error: *** index Overflow ***"

            caseof -2:Print " Error: *** index <=0 ***"

            caseof -3:Print " Error: *** Mat too big for RAM ***"

            caseof -4:Print " trouble: *** Mat too big for Screen ***"

            otherwise :Print " Error: *** unknown ***"

        endselect

    endproc

 
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.404 Views

Untitledvor 0 min.
Hans Neff01/24/23
Rschnett08/06/22
p.specht11/21/21
R.Schneider11/20/21
More...

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