|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Best Way to Use Variable Dimension Array Multiplier
Hi guys,
New to the forum, but have a few issues at the moment with Delphi Pascal. Start off with one which probably has an easy answer. I want to create just one proceudre to handle variously sized arrays and multiply them. The arrays are currently variables within a record and of user defined type i.e. d46_mat : array[1..4,1..6] of double; matrices = record G : d46_mat; H : d38_mat; end; I tried to use dynamic arrays of pass pointers but i'm either doing something wrong or i need a different approach. Thanks. |
|
#2
|
|||
|
|||
|
Can you be a bit more specific?
What are you trying to do and what are the error messages? Can you post the code you have written so that we can see the issues? Clive |
|
#3
|
|||
|
|||
|
I'm more concerned with the view of programmers that understand Delphi Pascal (maybe this is more of a pascal question) as to what is the advised way to write a 2D array (matrix) multiplier procedure.
This is a standard procedure for any language, the question is not really what i'm doing wrong but more what expert programmers would use to write a flexible procedure which accepts two matrices of arbitary dimensions and computes their product. I could write a procedure for each possible matrix combination but this would be extremely inefficient. Thanks |
|
#4
|
|||
|
|||
|
Quote:
Some would say that might include me ![]() However, I am not familiar with what you mean by a "2D array (matrix) multiplier" or what it is suppose to do. I will assume it is suppose to create a third array where: C[0,0] := A[0,0] * B[0,0]; etc. I suspect the piece you are missing is that you can loop from "low" to "high" in an array without knowing what low and high represent. Other things to bear in mind are that array access is more efficient traversing the elements in each row rather than each column and dynamic arrays are generally faster than static arrays. Again though, if you posted your code attempts, it would be much easier to see what you are doing wrong. Clive |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Delphi Programming > Best Way to Use Variable Dimension Array Multiplier |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|