Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ScalarMultiplication.cs
2{
6 public static partial class ArithmeticsOperations
7 {
13 public static void ScalarMultiplication(this Matrix<float> M, float Scalar)
14 {
15 int y, h = M.Height;
16 int x, w = M.Width;
17 int Index = M.Start;
18 int Skip = M.Skip;
19 float[] Data = M.Data;
20
21 for (y = 0; y < h; y++, Index += Skip)
22 {
23 for (x = 0; x < w; x++)
24 Data[Index++] *= Scalar;
25 }
26 }
27
33 public static void ScalarMultiplication(this Matrix<int> M, int Scalar)
34 {
35 int y, h = M.Height;
36 int x, w = M.Width;
37 int Index = M.Start;
38 int Skip = M.Skip;
39 int[] Data = M.Data;
40
41 for (y = 0; y < h; y++, Index += Skip)
42 {
43 for (x = 0; x < w; x++)
44 Data[Index++] *= Scalar;
45 }
46 }
47 }
48}
static void ScalarMultiplication(this Matrix< float > M, float Scalar)
Performs a scalar multiplication on each element in the matrix.
static void ScalarMultiplication(this Matrix< int > M, int Scalar)
Performs a scalar multiplication on each element in the matrix.
Implements a Matrix, basic component for computations in Image Processing and Computer Vision.
Definition: Matrix.cs:12
int Height
Height of matrix (number of rows)
Definition: Matrix.cs:136
T[] Data
Underlying data on which the matrix is defined.
Definition: Matrix.cs:114
int Width
Width of matrix (number of columns)
Definition: Matrix.cs:120
int Skip
Number of elements to skip from the right edge in the underlying data to the left edge of the new row...
Definition: Matrix.cs:233
int Start
Start offset of matrix in underlying data.
Definition: Matrix.cs:228