Introduction
Introduction Statistics Contact Development Disclaimer Help
tremoved redundant curly braces - numeric - C++ library with numerical algorith…
git clone git://src.adamsgaard.dk/numeric
Log
Files
Refs
LICENSE
---
commit 5a9cff5d2c3330ff6abc15165b23c09102d040aa
parent fd223ef5d4bd236655a1a2d1341ce2552aebfec4
Author: Anders Damsgaard Christensen <[email protected]>
Date: Wed, 23 Jan 2013 09:54:32 +0100
removed redundant curly braces
Diffstat:
M matrixmul/c-arrofarrs.c | 13 ++++++-------
M matrixmul/c-linarr.c | 3 +--
M matrixmul/cpp-linvectors.cpp | 3 +--
3 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/matrixmul/c-arrofarrs.c b/matrixmul/c-arrofarrs.c
t@@ -6,12 +6,11 @@ void matrixMult(double** A, double** B, double** C, unsigned…
unsigned int i, j, k;
double sum;
#pragma omp parallel for private (j,k,sum) shared(A,B,C,N) default(none)
- for (i = 0; i<N; i++) {
- for (j = 0; j<N; j++) {
+ for (i = 0; i<N; ++i) {
+ for (j = 0; j<N; ++j) {
sum = 0.0;
- for (k = 0; k<N; k++) {
+ for (k = 0; k<N; k++)
sum += A[i][k] * B[k][j];
- }
C[i][j] = sum;
}
}
t@@ -36,14 +35,14 @@ int main(int argc, char* argv[])
B = (double**) malloc(N * sizeof(double*));
C = (double**) malloc(N * sizeof(double*));
- for (i = 0; i < N; i++) {
+ for (i = 0; i < N; ++i) {
A[i] = (double*) malloc(N * sizeof(double));
B[i] = (double*) malloc(N * sizeof(double));
C[i] = (double*) malloc(N * sizeof(double));
}
- for (i = 0; i < N; i++) {
- for (j = 0; j < N; j++) {
+ for (i = 0; i < N; ++i) {
+ for (j = 0; j < N; ++j) {
A[i][j] = 2.0;
B[i][j] = (double) N*j + i;
}
diff --git a/matrixmul/c-linarr.c b/matrixmul/c-linarr.c
t@@ -9,9 +9,8 @@ void matrixMult(double* A, double* B, double* C, unsigned int …
for (i = 0; i<N; i++) {
for (j = 0; j<N; j++) {
sum = 0.0;
- for (k = 0; k<N; k++) {
+ for (k = 0; k<N; k++)
sum += A[k*N+i] * B[j*N+k];
- }
C[j*N+i] = sum;
}
}
diff --git a/matrixmul/cpp-linvectors.cpp b/matrixmul/cpp-linvectors.cpp
t@@ -11,9 +11,8 @@ void matrixMult(vector<double>& A, vector<double>& B, vector…
for (i = 0; i<N; i++) {
for (j = 0; j<N; j++) {
sum = 0.0;
- for (k = 0; k<N; k++) {
+ for (k = 0; k<N; k++)
sum += A[k*N+i] * B[j*N+k];
- }
C[j*N+i] = sum;
}
}
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.