Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8347371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:20:39+00:00 2026-06-09T07:20:39+00:00

In my code, at certain point i have to multiply 2 matrices and take

  • 0

In my code, at certain point i have to multiply 2 matrices and take the result in a 3rd matrix. I’m using cvMatMul() for this and getting an assertion failed error.
The part of the code which does the matrix multiplication:

CvMat* mulMatTt = cvCreateMat(EigenVector->rows,vi->cols,CV_32FC1);
cvMatMul(vi,EigenVector,mulMatTt);

Here, vi has 1 row and 10000 cols and Eigen Vector is a 1×1 square matrix. I believe the error is while allocating the size of the matrix mulMatTt. Can someone suggest how i can get this working?

The error:

OpenCV Error: Assertion failed ((D.rows == ((flags & CV_GEMM_A_T) == 0 ? A.rows : A.cols)) && (D.cols == ((flags & CV_GEMM_B_T) == 0 ? B.cols : B.rows)) && D.type() == A.type()) in cvGEMM, file C:\opencv\modules\core\src\matmul.cpp, line 29 30
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:20:40+00:00Added an answer on June 9, 2026 at 7:20 am

    Well that’s a pretty horrible to read assertion. It checks three things (all in the one assertion so we don’t know which is wrong). So give the library writers a few minus points there.

    The three things it checks are:
    1) The number of rows of your results matrix is equal to the number of rows of your first matrix (unless you asked for the first matrix to be transposed before the multiplication, in which case it checks if the rows is equivalent to the columns).
    2) The number of columns of your results matrix is equal to the number of columns of your second matrix (again, unless it was transposed as above).
    3) That the type of your results matrix is the same as the type of your first matrix.

    Basically, this is checking that the matrix D = AB is well formed. I assume that there is another check which makes sure A and B are compatible to be multiplied together (A.cols == B.rows (unless transposed) && A.type ==B.type).

    So we are failing to make our results matrix correctly.
    I think the line:

    CvMat* mulMatTt = cvCreateMat(EigenVector->rows,vi->cols,CV_32FC);
    

    should be:

    CvMat* mulMatTt = cvCreateMat(vi->rows, EigenVector->cols,CV_32FC);
    

    I assume that the types are correct. Also, just a small nitpick on coding style, the pointer dereference should belong with the variable not the type:

    CvMat *mulMatTt;
    

    or else you might fall in to this trap:

    CvMat* mulMatTt, identity_matrix;
    

    where it looks like identity_matrix is of type CvMat* but in fact is CvMat!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing certain code in MIPS and I've come to the point where
I need to code certain Dialogs as Activities that look like dialogs. For this
I have a situation where I want certain code to be executed no matter
I'm using the following code to UPDATE certain records from the db: IList<Item> list;
Currently I'm using the following code to append certain elements to the DOM: $('<p/>',
I have a workflow, that at a certain point, needs to be triggered recursively.
Having already read this question I'm reasonably certain that a given process using floating
I've looked at this which seems to have no effect on my code. I've
I have a small program that should move the mouse to a certain point
I have a bunch of buttons on my form, and at a certain point

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.