C++ matrix multiplication warning appears

Asked 2 years ago, Updated 2 years ago, 74 views

What's wrong?

code

vector<double>MatrixVector(vector<vector>double>A,
    vector<double>b){
    unsigned longm = A.size();
    unsigned long n = A.front().size();
    vector<vector<double>>d(m);

    for(inti=0;i<m;i++){
        for(int j=0;j<n;j++){
            d[i][j] = 0;

            for(intk=0;k<n;k++){
                d[i][j]+=A[i][k]*b[j];
            }
        }
    }
}

warning messages

control reach end of non-void function [-Wreturn-type]

c++ procession

2022-09-30 19:44

1 Answers

As warned, the MatrixVector function declares a return value of type vector<double> but does not contain a return statement.


2022-09-30 19:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.