0

Hi, I'm new to this forum and C#.
I try to make an array that each is the sum of the value of each row in sims array.
It gives me nothing but zero. Please help. TIA.

public double[] ave_S(int M, int N, double S, double sig, double dt, double[,] R, double r)
        {
            double[,] sims = GetSim(M, N, S, sig, dt, R, r); 
            double[] temp = new double[M];

            for (int i = 0; i < M; i++)
            {
                double temp_val = 0;

                for (int j = 0; j < N; j++)
                {
                    temp_val += sims[i, j];
                    
                }
                temp[i] = temp_val;      
                      
            }
            return temp;
        }
3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by bunny07
0

One or more of M, N and/or sims is equal to zero. Or you have the amazing coincidence that the sum of each row is zero.

0

Check out the parameters you pass to this function and also check the Getsims() function other than them this code has no problem

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.