Question: / * * * create a MathMatrix of the specified size with all cells set to the intialValue. * pre: numRows > 0 , numCols
create a MathMatrix of the specified size with all cells set to the intialValue.
pre: numRows numCols
post: create a matrix with numRows rows and numCols columns.
All elements of this matrix equal initialVal.
In other words after this method has been called getValrc initialVal
for all valid r and c
@param numRows numRows
@param numCols numCols
@param initialVal all cells of this Matrix are set to initialVal
public int MathMatrixint numRows, int numCols, int initialVal
return null;
get the value of a cell in this MathMatrix.
pre: row row getNumRows col col getNumColumns
@param row row getNumRows
@param col col getNumColumns
@return the value at the specified position
public int getValint row, int col
return ;
Create and return a new Matrix that is a copy
of this matrix, but with all values multiplied by a scale
value.
pre: none
post: returns a new Matrix with all elements in this matrix
multiplied by factor.
In other words after this method has been called
returnedmatrix.getValrc originalmatrix.getValr c factor
for all valid r and c
@param factor the value to multiply every cell in this Matrix by
@return a MathMatrix that is a copy of this MathMatrix, but with all
values in the result multiplied by factor.
public MathMatrix getScaledMatrixint factor
return null;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
