forked from freudenreichan/info2Praktikum-NeuronalesNetz
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb72278d55 | ||
|
|
f1af6c1e4a | ||
|
|
9606b5a03e | ||
|
|
4a1b6cbb40 |
@@ -90,6 +90,15 @@ Matrix add(const Matrix matrix1, const Matrix matrix2) {
|
|||||||
// Matrix
|
// Matrix
|
||||||
if (rowsEqual == 1 && colsEqual == 1) {
|
if (rowsEqual == 1 && colsEqual == 1) {
|
||||||
Matrix result = createMatrix(matrix1.rows, matrix1.cols);
|
Matrix result = createMatrix(matrix1.rows, matrix1.cols);
|
||||||
|
<<<<<<< HEAD
|
||||||
|
if (result.buffer == NULL){
|
||||||
|
return (Matrix){0,0,NULL};
|
||||||
|
}
|
||||||
|
for (int i = 0; i< rows1; i++) {
|
||||||
|
for (int j= 0; j< cols1; j++){
|
||||||
|
int valueM1= getMatrixAt(matrix1, i, j);
|
||||||
|
int valueM2= getMatrixAt(matrix2, i, j);
|
||||||
|
=======
|
||||||
if (result.buffer == NULL) {
|
if (result.buffer == NULL) {
|
||||||
return (Matrix){0, 0, NULL};
|
return (Matrix){0, 0, NULL};
|
||||||
}
|
}
|
||||||
@@ -97,6 +106,7 @@ Matrix add(const Matrix matrix1, const Matrix matrix2) {
|
|||||||
for (int j = 0; j < cols1; j++) {
|
for (int j = 0; j < cols1; j++) {
|
||||||
int valueM1 = getMatrixAt(matrix1, i, j);
|
int valueM1 = getMatrixAt(matrix1, i, j);
|
||||||
int valueM2 = getMatrixAt(matrix2, i, j);
|
int valueM2 = getMatrixAt(matrix2, i, j);
|
||||||
|
>>>>>>> main
|
||||||
int sum = valueM1 + valueM2;
|
int sum = valueM1 + valueM2;
|
||||||
setMatrixAt(sum, result, i, j);
|
setMatrixAt(sum, result, i, j);
|
||||||
}
|
}
|
||||||
@@ -107,8 +117,20 @@ Matrix add(const Matrix matrix1, const Matrix matrix2) {
|
|||||||
Matrix newMatrix = broadcastingCols(matrix1, cols2);
|
Matrix newMatrix = broadcastingCols(matrix1, cols2);
|
||||||
// add
|
// add
|
||||||
Matrix result = createMatrix(newMatrix.rows, newMatrix.cols);
|
Matrix result = createMatrix(newMatrix.rows, newMatrix.cols);
|
||||||
|
<<<<<<< HEAD
|
||||||
|
if (result.buffer == NULL){
|
||||||
|
return (Matrix){0,0,NULL};
|
||||||
|
}
|
||||||
|
for (int i = 0; i< rows1; i++) {
|
||||||
|
for (int j= 0; j< cols2; j++){
|
||||||
|
int valueM1= getMatrixAt(newMatrix, i, j);
|
||||||
|
int valueM2= getMatrixAt(matrix2, i, j);
|
||||||
|
int sum = valueM1 + valueM2;
|
||||||
|
setMatrixAt(sum, result, i, j);
|
||||||
|
=======
|
||||||
if (result.buffer == NULL) {
|
if (result.buffer == NULL) {
|
||||||
return (Matrix){0, 0, NULL};
|
return (Matrix){0, 0, NULL};
|
||||||
|
>>>>>>> main
|
||||||
}
|
}
|
||||||
for (int i = 0; i < rows1; i++) {
|
for (int i = 0; i < rows1; i++) {
|
||||||
for (int j = 0; j < cols2; j++) {
|
for (int j = 0; j < cols2; j++) {
|
||||||
@@ -123,8 +145,20 @@ Matrix add(const Matrix matrix1, const Matrix matrix2) {
|
|||||||
Matrix newMatrix2 = broadcastingCols(matrix2, cols1);
|
Matrix newMatrix2 = broadcastingCols(matrix2, cols1);
|
||||||
// add
|
// add
|
||||||
Matrix result = createMatrix(newMatrix2.rows, newMatrix2.cols);
|
Matrix result = createMatrix(newMatrix2.rows, newMatrix2.cols);
|
||||||
|
<<<<<<< HEAD
|
||||||
|
if (result.buffer == NULL){
|
||||||
|
return (Matrix){0,0,NULL};
|
||||||
|
}
|
||||||
|
for (int i = 0; i< rows1; i++) {
|
||||||
|
for (int j= 0; j< cols1; j++){
|
||||||
|
int valueM1= getMatrixAt(matrix1, i, j);
|
||||||
|
int valueM2= getMatrixAt(newMatrix2, i, j);
|
||||||
|
int sum = valueM1 + valueM2;
|
||||||
|
setMatrixAt(sum, result, i, j);
|
||||||
|
=======
|
||||||
if (result.buffer == NULL) {
|
if (result.buffer == NULL) {
|
||||||
return (Matrix){0, 0, NULL};
|
return (Matrix){0, 0, NULL};
|
||||||
|
>>>>>>> main
|
||||||
}
|
}
|
||||||
for (int i = 0; i < rows1; i++) {
|
for (int i = 0; i < rows1; i++) {
|
||||||
for (int j = 0; j < cols1; j++) {
|
for (int j = 0; j < cols1; j++) {
|
||||||
@@ -143,8 +177,20 @@ Matrix add(const Matrix matrix1, const Matrix matrix2) {
|
|||||||
Matrix newMatrix = broadcastingRows(matrix1, rows2);
|
Matrix newMatrix = broadcastingRows(matrix1, rows2);
|
||||||
// add
|
// add
|
||||||
Matrix result = createMatrix(newMatrix.rows, newMatrix.cols);
|
Matrix result = createMatrix(newMatrix.rows, newMatrix.cols);
|
||||||
|
<<<<<<< HEAD
|
||||||
|
if (result.buffer == NULL){
|
||||||
|
return (Matrix){0,0,NULL};
|
||||||
|
}
|
||||||
|
for (int i = 0; i< rows2; i++) {
|
||||||
|
for (int j= 0; j< cols1; j++){
|
||||||
|
int valueM1= getMatrixAt(newMatrix, i, j);
|
||||||
|
int valueM2= getMatrixAt(matrix2, i, j);
|
||||||
|
int sum = valueM1 + valueM2;
|
||||||
|
setMatrixAt(sum, result, i, j);
|
||||||
|
=======
|
||||||
if (result.buffer == NULL) {
|
if (result.buffer == NULL) {
|
||||||
return (Matrix){0, 0, NULL};
|
return (Matrix){0, 0, NULL};
|
||||||
|
>>>>>>> main
|
||||||
}
|
}
|
||||||
for (int i = 0; i < rows2; i++) {
|
for (int i = 0; i < rows2; i++) {
|
||||||
for (int j = 0; j < cols1; j++) {
|
for (int j = 0; j < cols1; j++) {
|
||||||
@@ -159,8 +205,20 @@ Matrix add(const Matrix matrix1, const Matrix matrix2) {
|
|||||||
Matrix newMatrix2 = broadcastingRows(matrix2, rows1);
|
Matrix newMatrix2 = broadcastingRows(matrix2, rows1);
|
||||||
// add
|
// add
|
||||||
Matrix result = createMatrix(newMatrix2.rows, newMatrix2.cols);
|
Matrix result = createMatrix(newMatrix2.rows, newMatrix2.cols);
|
||||||
|
<<<<<<< HEAD
|
||||||
|
if (result.buffer == NULL){
|
||||||
|
return (Matrix){0,0,NULL};
|
||||||
|
}
|
||||||
|
for (int i = 0; i< rows1; i++) {
|
||||||
|
for (int j= 0; j< cols1; j++){
|
||||||
|
int valueM1= getMatrixAt(matrix1, i, j);
|
||||||
|
int valueM2= getMatrixAt(newMatrix2, i, j);
|
||||||
|
int sum = valueM1 + valueM2;
|
||||||
|
setMatrixAt(sum, result, i, j);
|
||||||
|
=======
|
||||||
if (result.buffer == NULL) {
|
if (result.buffer == NULL) {
|
||||||
return (Matrix){0, 0, NULL};
|
return (Matrix){0, 0, NULL};
|
||||||
|
>>>>>>> main
|
||||||
}
|
}
|
||||||
for (int i = 0; i < rows1; i++) {
|
for (int i = 0; i < rows1; i++) {
|
||||||
for (int j = 0; j < cols1; j++) {
|
for (int j = 0; j < cols1; j++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user