1 / 3

Technische Informatik

Technische Informatik. Reihungen – Felder - Arrays. Beispiel 2 – Matrizen Multiplikation. J. X. =. I. C. A. B. Diesen Wert wollen wir ausrechnen – also – was steht an der Stelle c ij Quadratische Multiplikation A besteht wie B aus n² - Daten.  c ij = ∑ a ik * b kj.

maille
Download Presentation

Technische Informatik

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Technische Informatik Reihungen – Felder - Arrays

  2. Beispiel 2 – Matrizen Multiplikation J X = I C A B Diesen Wert wollen wir ausrechnen – also – was steht an der Stelle cij Quadratische Multiplikation A besteht wie B aus n² - Daten.  cij =∑ aik * bkj d.h. wir rennen einmal durch die i-te Zeile und einmal durch die jte Spalte. Diese werden jeweils komponentenweise miteinander multipliziert und aufaddiert. n=1 k=0

  3. Für jedes ij in der Ergebnis Matrix müssen wir also obige Summe ausrechnen. Jetzt das Ganze in z.B. JAVA final int [ ] N = 4; // Konstante double [ ] [ ] a= ……. //irgendwie mit Werten füllen double [ ] [ ] b = …….. double [ ] [ ] c = new double [ N ] [ N ]; for (i = 0; i<N; i++) { for ( j=0; j<N; j++) { c [ i ] [ j ] = 0.0; // Init for ( k=0; k<N; k++) c [ i ] ] j ] = c [ i ] [ j ] + a [ i ] [ k ] * b [ k ] [ j ] } }

More Related