Removed matMul() from Helpers.hpp and renamed matMul2() to matMul().

This commit is contained in:
François Coppens 2021-03-10 15:27:53 +01:00
parent ffbde8f88c
commit e18e80ff5c
2 changed files with 3 additions and 15 deletions

View File

@ -37,6 +37,7 @@ void showMatrix(T *matrix, unsigned int M, string name) {
cout << " ]," << endl; cout << " ]," << endl;
} }
cout << "]" << endl; cout << "]" << endl;
cout << endl;
} }
template<typename T> template<typename T>
@ -51,20 +52,7 @@ T *transpose(T *A, unsigned int M) {
} }
template<typename T> template<typename T>
T *matMul(T *A, T *B, unsigned int M) { void matMul(T *A, T *B, T *C, unsigned int M) {
T *C = new T[M*M] {0};
for (unsigned int i = 0; i < M; i++) {
for (unsigned int j = 0; j < M; j++) {
for (unsigned int k = 0; k < M; k++) {
C[i*M+j] += A[i*M+k] * B[k*M+j];
}
}
}
return C;
}
template<typename T>
void matMul2(T *A, T *B, T *C, unsigned int M) {
memset(C, 0, M*M*sizeof(T)); memset(C, 0, M*M*sizeof(T));
for (unsigned int i = 0; i < M; i++) { for (unsigned int i = 0; i < M; i++) {
for (unsigned int j = 0; j < M; j++) { for (unsigned int j = 0; j < M; j++) {

View File

@ -132,7 +132,7 @@ void MaponiA3(double *Slater_inv, unsigned int Dim,
* ylk[l][p[k]][i + 1] / beta; * ylk[l][p[k]][i + 1] / beta;
} }
} }
matMul2(Al, last, next, Dim); matMul(Al, last, next, Dim);
double *tmp = next; double *tmp = next;
next = last; next = last;
last = tmp; last = tmp;