- Community Home
- :
- Discussion Forums
- :
- Most Active Software Boards
- :
- LabVIEW
- :
- Determinant of a matrix with variables in FPGA

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

06-07-2019 03:16 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Labels:

Greetings,

**Short story:** I would like to find the determinant of a 2x2 matrix with variables on an FPGA in LabVIEW. I see how I could do this with a matrix that looks like [[2,1],[1,2]] but how could I do this with a matrix that looks like [[2-x,1],[1,2-x]]? The issue I see is how to treat the "x" in the FPGA space?

**Long story:** What I really want to do is find the eigenvalues of a generalized eigenvalue problem **A***Phi=**B***Phi*Lambda. A dream goal would be to do this on an FPGA but I think that may be a stretch. For the time being, I am trying to work my way through some of the math to find the eigenvalues of a 2x2 matrix and finding the determinant of a matrix is the first issue I have.

06-10-2019 04:26 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Austin-Downey,

Have you seen either of these articles? They do not specifically address taking the determinate of a matrix with variables. However, they may have some information that would help you get started.

- "Matrix*Vector Express VI" http://zone.ni.com/reference/en-XX/help/371599L-01/lvfpga/matrixvector/
- "Linear Algebra Matrix Multiply Function" https://zone.ni.com/reference/en-XX/help/371599P-01/lvfpga/la_matrixmultiply/

Kendal C.

Technical Support Engineer

National Instruments

Technical Support Engineer

National Instruments

06-16-2019 08:41 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

KendalC,

Thanks, after a week of reading and trial and error I have discovered this is a much harder problem than just finding some code. I am still working on it but I wanted to let others know that in case they are wanting to do this the best way seems to be to find an algorithm that will work for your size of matrix and implement this in LabVIEW code.

06-16-2019 08:58 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

After looking around the forums, examples, and internet I have come to the conclusion that there is not a good resource/example for how to implement the Linear Algebra Matrix Multiply on FPGA. As I am unable to get this VI to work I was hoping someone could help me. In general I have two questions:

1) What am I doing wrong in the VI posted below?

2) What is the benefit of using this VI as apposed to writing my own code?

For my code, here is the code I have on my target. This is for a simple 5x5 matrix, fed into the VI 1 element at a time. I know the FIFOs and splitting the arrays work as they were from my prior home-brew matrix multiply code but I am always open to suggestions.

And here is the code I have on my host,

As per writing my one code, I did so following the example here, https://forums.ni.com/t5/LabVIEW/Matrix-Multiplication-in-LabVIEW-FPGA-space/td-p/3561369/page/3 but I would like to get this VI working just to compile it and see if it uses more or less resources than my home-brewed code.

06-17-2019 02:58 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

That upper image of the FPGA code....... I don't think it will do what you think it should do.

While loop, Single-Cycle Timed loops, For Loops....... The whole thing only runs once...... You're either doing something incredibly brilliant or just plain wrong. I need a second opinion.

06-17-2019 12:10 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

After looking around the forums, examples, and internet I have come to the conclusion that there is not a good resource/example for how to implement the Linear Algebra Matrix Multiply on FPGA. As I am unable to get this VI to work I was hoping someone could help me. In general, I have two questions:

1) What am I doing wrong in the VI posted below?

2) What is the benefit of using this VI as opposed to writing my own code?

For my code, here is the code I have on my target. This is for a simple 5x5 matrix, fed into the VI 1 element at a time. I know the FIFOs and splitting the arrays work as they were from my prior home-brew matrix multiply code but I am always open to suggestions.

And here is the code I have on my host,

As per writing my one code, I did so following the example here, https://forums.ni.com/t5/LabVIEW/Matrix-Multiplication-in-LabVIEW-FPGA-space/td-p/3561369/page/3 but I would like to get this VI working just to compile it and see if it uses more or fewer resources than my home-brewed code.

06-17-2019 12:12 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Intaris,

Thanks for the reply but this was supposed to be a new thread. I must have messed something up when I posted it.

I have made a new thread here, https://forums.ni.com/t5/LabVIEW/Linear-Algebra-Matrix-Multiply-FPGA-Express-VI/td-p/3938434

I will answer your question there to keep this clean.

06-17-2019 12:17 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

From another thread (I messed up the original post) a comment was left stating,

"That upper image of the FPGA code....... I don't think it will do what you think it should do.

While loop, Single-Cycle Timed loops, For Loops....... The whole thing only runs once...... You're either doing something incredibly brilliant or just plain wrong. I need a second opinion."

I agree that in this configuration it looks like the matrix multiply function only runs once but I know that it must run over multiple clock cycles and when I collect all the "output valid" booleans I get multiple tags. So I assume this means the single cycle loop is somehow running more than once.

06-19-2019 11:42 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

All,

I am still trying to work on this project, I have a code that is compiling and running but is not returning the correct values. I have attached the code to this post but it will not let me upload my project. All the project has in it is a target-to-host FIFO. Any ideas on what I could be doing wrong?

06-19-2019 03:57 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I think I have some extra numbers in my FIFO that are the reason I am getting the wrong answer. From the code below I should be putting only 9 items into the FIFO but I am getting 9 numbers that start in the FIFO every time even before I run the code from the host computer.

This is my code on the target where I

And these are the first 9 numbers that I get out of the FIFO. I have no idea where there are coming from. They do not change when I change my input and are in the FIFO before the invoke method on the host VI runs the code.

The next 9 numbers seem to be correct but I don't know what is causing these first 9 numbers.