turn on suggestions

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

Showing results for

- Navigation
- Simcenter
- Forums
- Blogs
- Knowledge Bases

- Siemens PLM Community
- Simcenter
- CAE Simulation - Femap Forum
- API - Matrix Operations: Multiplication, Adition, ...

Options

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

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

11-20-2015 03:12 PM

I am making an API in which I need to make matrix operations between multi dimensional arrays.

Multiplication, Adition, Transpose and Inverse.

How is it done on Femap API.

The example I found for VBA is: (Is it the same on Femap API?)

Dim aMatrix As Variant

Dim bMatrix As Variant

Dim cMatrix As Variant

' get aMatrix and bMatrix

cMatrix = Application.MMult(aMatrix, bMatrix)

3 REPLIES

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

11-23-2015 03:40 AM

Hi,

There are no matrix manipulation functions that I am aware of in FEMAP.

The MMult you speak of seems related to MS Excel. FEMAP can easily "plug into" Excel, there are many FEMAP Symposium presentation which deal with this, for ex P. Kriengsiri's excellent 2014 presentation (which even goes further):

So the overall way you have to solve your problem is to use third party libraries/software. This can be done either from inside FEMAP (i.e. using VB6 in the API window) or outside (from Visual Studio or Excel, using VBA). This choice is yours. Of course you can also always write these functions...

From inside FEMAP you can plug into Excel, or use a 3rd party library such as ALGLIB which is extremely usfeul and outstandingly written, granted not obvious how to use at first. If you need to get into real fierce maths, I recommend this. If you need to invert small matrices and are under Excel limitations (don't know wether they still exist in the later versions actually) stick with Excel.

APavageau

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

03-21-2016 05:10 AM

Just have a look on google for matrix multiply algorithm.

Same thing for transpose / inverse.

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

04-15-2016 10:57 AM

Dear Felipe,

In principle you can quite easily write the functions for the multiplication, addition, and transpose yourself using a double loop, but taking the inverse is somewhat more of a challenge. For myself, I am using a Gauss-Jordan scheme that works quite nice for not too large matrices (I keep under 5x5):

Public Function MatrixInverse(a() As Double) As Double() Dim c#(), x#, y# Dim m&, u#, i&, j&, rv&() Dim q&, w& m = UBound(a, 1) ReDim c(0 To m, 0 To m), rv(0 To m, 0 To 1) For i = 0 To m: c(i, i) = 1: Next i For q = 0 To m 'for each column u = 10 ^ 15 For i = 0 To m 'for each row If rv(i, 0) = 0 Then If a(i, q) <> 0 Then If (Log(a(i, q) ^ 2)) ^ 2 < u Then u = (Log(a(i, q) ^ 2)) ^ 2 'function of entry value w = i 'highest row where function of entry value is smaller than previous End If End If End If Next i rv(w, 0) = w + 1: rv(q, 1) = w: x = a(w, q) For j = 0 To m a(w, j) = a(w, j) / x c(w, j) = c(w, j) / x Next j For i = 0 To m If rv(i, 0) = 0 Then y = a(i, q) For j = 0 To m a(i, j) = a(i, j) - y * a(w, j) c(i, j) = c(i, j) - y * c(w, j) Next j End If Next i, q 'BACK SOLUTION For q = m To 1 Step -1: For w = q - 1 To 0 Step -1 x = a(rv(w, 1), q) a(rv(w, 1), q) = a(rv(w, 1), q) - x * a(rv(q, 1), q) For j = 0 To m c(rv(w, 1), j) = c(rv(w, 1), j) - x * c(rv(q, 1), j) Next j Next w, q For q = 0 To m: For j = 0 To m a(q, j) = c(rv(q, 1), j) Next j, q MatrixInverse = a End Function

Hope this helps! Have fun!

Best wishes,

Cor

Start with these Femap Basics videos

Watch Femap How To videos on YouTube

Watch Femap Tips & Tricks videos on YouTube

Download the Femap 45 day Free Trial

Download the Femap Student Edition

Watch Femap How To videos on YouTube

Watch Femap Tips & Tricks videos on YouTube

Download the Femap 45 day Free Trial

Download the Femap Student Edition

Follow Siemens PLM Software

© 2018 Siemens Product Lifecycle Management Software Inc