dotnet / dotnet/docs

assignment statement error in parallel-programming exapmle

Open
#40,576 1 comment 0 reactions 1 assignee Claimed by @adegeo View on GitHub
:watch: Not Triaged dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

### Type of issue

Typo

### Description

**Sequential_Loop** in *basic matrix multiplication*
```
#region Sequential_Loop
static void MultiplyMatricesSequential(double[,] matA, double[,] matB,
double[,] result)
{
int matACols = matA.GetLength(1);
int matBCols = matB.GetLength(1);
int matARows = matA.GetLength(0);

for (int i = 0; i < matARows; i++)
{
for (int j = 0; j < matBCols; j++)
{
double temp = 0;
for (int k = 0; k < matACols; k++)
{
temp += matA[i, k] * matB[k, j];
}
result[i, j] += temp;
}
}
}
#endregion
```
**result[i, j] += temp;**
should be
**result[i, j] = temp;**

### Page URL

https://learn.microsoft.com/zh-cn/dotnet/standard/parallel-programming/how-to-write-a-simple-parallel-for-loop

### Content source URL

https://github.com/dotnet/docs/blob/main/docs/standard/parallel-programming/how-to-write-a-simple-parallel-for-loop.md

### Document Version Independent Id

1603adc7-b23f-ff8f-4c18-7c3f84fbcba8

### Article author

adegeo

### Metadata

* ID: 629911c2-f9cc-7deb-df8e-3012d3e6afd0
* Service: **dotnet-fundamentals**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.