Total members 11894 |It is currently Fri Nov 22, 2024 9:09 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





my professor gave me this design document but i don't know where to start.
if you can help me that would be great. i really do need as much help as i can possibly get. thanks. [:

Project #6 Design Document Matrix Arithmetic

Input Items
1. Data Type input I or D
2. Matrix Dimensions
a. A (m, n) input m, input n
b. B (j, k) input j, input k
3. Operation input op

Allocations & Populations
1. Create reference variables
Code:
     a.   int [ ] [ ] aIntMatrix;
    b.   int [ ][ ] bIntMatrix;
    c.   int [ ][ ] cIntMatrix;
    d.   double [ ] [ ] aDblMatrix;
    e.   double [ ][ ] bDblMatrix;
    f.   double [ ][ ] cDblMatrix;


2. Create storage space for selected input matrices (dependent upon the data type and dimensions), e.g.,
Code:
a.   int [ ] [ ] aIntMatrix = new int[m][n];
b.   int [ ][ ] bIntMatrix = new int[j][k];


3. Create storage space for selected input matrices (dependent upon the data type, operation and dimensions), e.g.,
Code:
a.   int [ ][ ] cIntMatrix = new int[m][k]; for op == “MULTIPLY”
b.   int [ ][ ] cIntMatrix = new int[m][n]; for op == “ADDITION” or “SUBTRACTION”


4. Populate the selected input arrays
Computations

1. Main
Code:
If dataType is integer Switch(op) {
Case + : { cIntMatrix = addMatrix(aIntMatrix, bIntMatrix); printMatrix(aIntMatrix); printMatrix(bIntMatrix); printMatrix(cIntMatrix); break;
}
Case - : {
}
Case * : {
}
Else
Case + : {
}
Case - : {
}
Case * : {
}
}
Switch(op) {
}

2. Methods
a. addMatrix
Code:
for(int i = 0; i < ... ; i++) for(int j = 0; j < ... ; j++)
c[ i ][ j ] = a[ i ][ j ] + b[ i ][ j ];

b. subMatrix
Code:
for(int i = 0; i < ... ; i++) for(int j = 0; j < ... ; j++)

check dimensions for A (m, n) & B (j, k) check that m == j & n == k
Code:
c[ i ][ j ] = a[ i ][ j ] - b[ i ][ j ];

c. multMatrix
Code:
for(int k = 0; k < columns of c; k++) for(int i = 0; i < rows of b; i++)
for(int j = 0; j < columns of a ; j++) c[ i ][ k ] = a[ i ][ j ] * b[ j ][ k ]


check dimensions for A (m, n) & B (j, k) check that & n == j




Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Java Matrices using a Switch Statement
 java switch example     -  
 difference between break statement and a continue statement     -  
 difference between a while statement and a do statement     -  
 Switch vs Hub     -  
 php switch     -  
 JavaScript switch example     -  
 Use Switch with strings     -  
 network switch     -  
 switch command for string value     -  
 switch keyword in c++ usage     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com