Important alert: (current site time 7/16/2013 3:02:26 AM EDT)
 

winzip icon

Matrix Operations Library

Email
Submitted on: 1/16/2003 3:31:04 PM
By: Anas S. A. 
Level: Advanced
User Rating: By 49 Users
Compatibility: VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 37565
 
     Matrix Operations Library About a year ago, I was working on a project. The project required many matrix operations, that time I really wished that I would find a class or a library with ready functions for matrix manipulations (like addition, inverse, multiplication, etc…) to use in Visual Basic. Unfortunately I could not find such a class, so I decided to write my own class, I called it "cMathLib" . This class gives the user the flexibility to work with matrices and do operations on them. The dimensions of the matrices are neither pre-specified nor limited. The code is highly optimized for fast operation. The code attached contains the class file called with a demonstration on how to use it. Opperations included in the class are : Add, Subtract, Determinant, Inverse, Transpose, Multiply, atan2, arc cos, arc sin, PI, Print, MultiplyVectors,Magnitude of a Vector, scalar multiply, and scalar divide. I really hope this class would be of any help to any of you who needs to work with matrix operations.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

1/16/2003 4:44:51 PMBAS_ARM

5* (simple, clear & most of all usefull)
Some functions may generated for multi-dimencional arrays.
If anyone have the time he could writte code independed of array dimensions (maybee checking the number of array dimencions with the error in finding the Ubound etc)
(If this comment was disrespectful, please report it.)

 
1/16/2003 7:12:50 PM

Excellent, matrix operations can be a pain in the a*s unless you have a programmable calculator. Thanks for sharing it.
(If this comment was disrespectful, please report it.)

 
1/17/2003 4:28:11 AM

this code is perfect! it's fast, clear n usefull.really thanks for sharing :)
(If this comment was disrespectful, please report it.)

 
1/17/2003 5:19:39 AMM.C

Didnt test it jet, but 5 globes(I do belive to descriptions)
(If this comment was disrespectful, please report it.)

 
1/17/2003 7:35:23 AM

Keep Up the good work, thanks for sharing this code u saved me !!!
(If this comment was disrespectful, please report it.)

 
1/17/2003 1:11:03 PM

impressive work well explained easy and above all does the work, i never thought that any one would share such a library for free. Thnaks alot, now i can work on my project without writing any matrix functions. the code is fast !!
(If this comment was disrespectful, please report it.)

 
1/17/2003 4:02:13 PMThe New iSoftware Company!

Want to help me take this to vb .net?
(If this comment was disrespectful, please report it.)

 
1/17/2003 5:48:15 PM

Good work!! you deserve five stars
(If this comment was disrespectful, please report it.)

 
1/17/2003 9:32:39 PM

cool this class is a saver ,though i wished u had eigen vectors and rank functions in it too!! anyways thanks for sharing it :)
(If this comment was disrespectful, please report it.)

 
1/19/2003 3:23:32 AMRobert Rayment

Excellent and useful*****
(If this comment was disrespectful, please report it.)

 
1/19/2003 5:37:34 AMPeter Wilson

Keep up the good work!
(If this comment was disrespectful, please report it.)

 
1/19/2003 9:37:33 AM

u really did a good job man!
(If this comment was disrespectful, please report it.)

 
1/20/2003 6:46:40 AM

This is exactly what i want for my project thanx alot
(If this comment was disrespectful, please report it.)

 
1/20/2003 9:37:52 AM

easy well explained a definite 5 starts good work!
(If this comment was disrespectful, please report it.)

 
1/21/2003 12:40:24 PMDhaval Faria

its really excellent.. I was looking for this only.. I done this Matrix operationg.. Addition and Subtraction in VB.NET and now goin for more.. like inverse and all, but at the mean time, I found your.. so I get proper logic.. thanks man.. 5 globes from me.
(If this comment was disrespectful, please report it.)

 
1/21/2003 5:49:27 PM

Hey man its an awesome thing u did there, keep the hard work....urs
(If this comment was disrespectful, please report it.)

 
1/27/2003 1:30:13 AM

please send matrix library for multi and sum
(If this comment was disrespectful, please report it.)

 
4/17/2003 6:43:06 AMR. C. Sharma


function asin should be as follows

Public Function asin(ByVal X As Double) As Double
if x*x-1 then
asin=pi/2
else
asin = Atn(X / (Sqr(Abs(1 - X * X)) + 1E-200))
endif
End Function
(If this comment was disrespectful, please report it.)

 
8/24/2004 4:23:01 PM

U saved my a*s men, have an assignment from school requiring matrices, very impressive
(If this comment was disrespectful, please report it.)

 
12/27/2004 4:40:43 PM

problems with download of Visual Basic Matrix routines - any suggestions. Would like to get a copy of the source code for a project I'm working on.
(If this comment was disrespectful, please report it.)

 
1/11/2005 10:12:04 PM

when I try with this :
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16

and do operation 5*A
I got the result as
Answer 5A =

5.0000 10.0000 15.0000 20.0000
25.0000 30.0000 35.0000 40.0000
45.0000 50.0000 5.0000 60.0000
65.0000 -70.0000 75.0000 80.0000

Why the value 5*14 become -70.000 ?
(If this comment was disrespectful, please report it.)

 
5/17/2006 3:00:02 AMCL Hang

I am self-learner.
Now doing project..
I would like to ask is this class
can perform calculation with unknown
as below :(3x1) x (1x3)


[X] x [1 2 X ] = [ X 2X X^2 ]
[1] [ 1 2 X ]
[2] [ 2 4 2X ]

I really need to know, please help me



Please give help in source code.

Thanks

(If this comment was disrespectful, please report it.)

 
3/29/2007 12:26:49 PMkmza

Just an important question:
Is that code valide to inverse non-symmetrical matrices or just symmetrical one?
(If this comment was disrespectful, please report it.)

 
3/10/2008 1:16:28 PMR.Warwick

Unlike every other atan2 Visual Basic function in the public domain, this one actually appears to work. (if there's one that does work I don't know about, apologies)
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.