Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Initializing QGenericMatrix

I need a matrix for matrix multiplication for neural networks and since I use the Qt Framework which provides QGenericMatrix I thought I give it a try. But I have no idea how to initialize the matrix with data.

It got this constructor but I am not able to use it right.

QGenericMatrix::QGenericMatrix(const T * values)

So it would help if someone could give me an example initialization for e.g.

    QGenericMatrix<2,2,int> a();

If I search for QGenericMatrix I hardly find anything except the official class definition, so I was wondering if QGenericMatrix is a good choice at all?

like image 840
Sharky Bamboozle Avatar asked Dec 30 '25 13:12

Sharky Bamboozle


1 Answers

It is simple to pass values directly to the constructor:

int values[] = {
    1, 2,
    3, 4
};

QGenericMatrix<2,2,int> matrix(values);
like image 105
demonplus Avatar answered Jan 01 '26 01:01

demonplus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!