lni
1st August 2010, 14:31
Hi,
I am looking at Qt's script example but got lost...
I have several QVector<double> array in my C++ program with same length, such as
QVector<double> aArray, bArray, cArray...
I want users to be able to enter their own math expression, such as:
result = aArray^2 + bArray / cArray.
The operation is actually on each element. In C++, it would look like this:
QVector<double> result( aArray.length() );
for ( int idx = 0; idx < aArray.length(); idx++ ) {
result [ idx ] = aArray[ idx ]^2 + bArray[ idx ] / cArray[ idx ].
}
Then the result should be returned to the C++ program.
Can someone give me a light?
Many thanks.
I am looking at Qt's script example but got lost...
I have several QVector<double> array in my C++ program with same length, such as
QVector<double> aArray, bArray, cArray...
I want users to be able to enter their own math expression, such as:
result = aArray^2 + bArray / cArray.
The operation is actually on each element. In C++, it would look like this:
QVector<double> result( aArray.length() );
for ( int idx = 0; idx < aArray.length(); idx++ ) {
result [ idx ] = aArray[ idx ]^2 + bArray[ idx ] / cArray[ idx ].
}
Then the result should be returned to the C++ program.
Can someone give me a light?
Many thanks.