-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiplyElement.java
More file actions
35 lines (29 loc) · 1.11 KB
/
Copy pathMultiplyElement.java
File metadata and controls
35 lines (29 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package operations;
public class MultiplyElement extends AbstractOperation{
/*
Operation B[i][j][k] represents multiplying element M[k][i] by already calculated factor in corresponding FindFactorOperation.
M[k][j] *= A[i][j]
*/
private final int column;
private final int targetRow;
public MultiplyElement(double[][] matrix, Double[][] eliminationFactors, Double[] normalizationFactors, int sourceRow, int column, int targetRow){
super(matrix, eliminationFactors, normalizationFactors);
this.sourceRow = sourceRow;
this.column = column;
this.targetRow = targetRow;
this.operationSymbol = 'B';
}
@Override
public Void call() {
//target element is 0 and there is no need for row multiplying
if (eliminationFactors[sourceRow][targetRow] == null)
return null;
else
matrix[targetRow][column] *= eliminationFactors[sourceRow][targetRow];
return null;
}
@Override
public String toString(){
return "%c(%d, %d, %d)".formatted(operationSymbol, sourceRow, column, targetRow);
}
}