# Thread: Derivative vector on Eigen arithmetic sequence

1. Beginner
Join Date
Apr 2020
Posts
6
Qt products
Platforms

## Derivative vector on Eigen arithmetic sequence

Hi the board

I've now a problem that i cant solve for many days on derivative vector

I've installed Eigen librairy and then i put some CSV data to a dynamic matrix, this part works
I can also find maximum of column, and parse the matrix with eigen::arithmeticsequence ( it was no more installed on 3.3.7...it was little hard to manage) but now i can do it

The problem is that i have to make a derivative of vector on another vector i will give sample example

matrix A 3x3 : 1 2 3
4 5 4
5 6 7

i have to make derivative 1st colum on third : like (5-1)/(7-3)
The problem i need to make it as sequence with (n-(n-2))/ (n-(n-2)) in automatic sequence...
I cant find any function in eigen to make easy derivative.... that's easy to sum ou minus column but cell by cell i cant solve any idea ?!

2. Guru
Join Date
Mar 2009
Location
Brisbane, Australia
Posts
7,671
Thanks
13
Thanked 1,595 Times in 1,523 Posts
Qt products
Platforms
Wiki edits
17

## Re: Derivative vector on Eigen arithmetic sequence

This has nothing to do with Qt.

I suggest you ask on an Eigen mailing list or IRC channel where someone will likely know the tool and understand enough of the mathematics to understand your question.

3. Beginner
Join Date
Apr 2020
Posts
6
Qt products
Platforms

## Re: Derivative vector on Eigen arithmetic sequence

Originally Posted by ChrisW67
This has nothing to do with Qt.

I suggest you ask on an Eigen mailing list or IRC channel where someone will likely know the tool and understand enough of the mathematics to understand your question.
May be it has nothing to do with qt .... but i'm coding on qt .... and moreover very hard to get any information about eigen on QT....

So after some hours i have found the solution, so i publish it to help may be some ppl in future

On Eigen need to install ArithmeticSequence.h ( little hard because some version hasnt got it, not to add manually it)

Then you should have a command called seqN

Here for example, the column 3 of matrix called Came and the code means Sequence from cell 2 ( so line 3), on all rows of A, with increment 1, on column 13, minus second sequence ...

Qt Code:
`Came.col(3)= A(seqN(2,A.rows(),1),13) - (A(seqN(0,A.rows(),1), 13));`
To copy to clipboard, switch view to plain text mode

Join Date
Jul 2008
Location
Germany
Posts
451
Thanks
9
Thanked 59 Times in 57 Posts
Qt products
Platforms

## Re: Derivative vector on Eigen arithmetic sequence

Originally Posted by benver
May be it has nothing to do with qt .... but i'm coding on qt .... and moreover very hard to get any information about eigen on QT....
I think this is a common misconception, although I'm not sure where it comes from.
Qt is just a C++ library like any other library. So Qt does not influence the usage of other libraries in any way, and problems that you have with another library are normally not Qt-related, even if you also use the Qt libraries in your program. You probably wouldn't ask Qt questions on the Eigen forum/mailing list/IRC channel just because you use them in the same program.

Ginsengelf

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.