My goal is to initialize a size m x 3 matrix and fill its rows with 1 x 3 vectors (arrays I mean) obtained from a for loop. I'm not sure if I want to return the matrix (via pointer) yet or not. But I'm really rusty with C++ (wasn't very great to begin with). Any advice would be great. Here's my code:
#include "rk4.h"
#include <iostream>
using std::cout;
using std::endl;
double * rk4(double finalTime, double deltaTime, double Y0[])
{
double h = 0.0009765625; /// 1/2^10
double t0 = 0;
int rows = finalTime/h;
double * Y = new double[M][3];
for(int i = 0; i < 3; i++)
{
Y[0][i] = Y0[i];
}
cout << M << endl;
for(double t = t0; t <= finalTime; t+= h)
{
// Insert row into Y
}
return Y;
}
I'm getting an error that says cannot convert double(*)[3] to double* in initialization
. Also I'm expecting to use huge arrays for these computations so any other advice would be great.