> ... anything greater requires a Gaussian elimination or singular
> value decomposition routine. Does the µM-FPU chip have matrix
> inversion functions for matrices greater than 3x3?
No, I wrote the 2x2 and 3x3 inversions in the example. I suspect you'll
need to put an algorithm together using its native matrix-handling
instructions, about 40 of them, including scalar and elemental
add/subtract, multiply/divide and power, matrix multiply, transpose and
others.
> I looked at FPUTiming.zip and couldn't find the matrix inversion
> example.
I archived the wrong file, you're right. Download again.
http://tech.groups.yahoo.com/group/basicx/files/Datasheets-Appnotes-Examples-Drawings/
FPUTiming.zip . Look in file FPUTiming.FPU for the FPU function code.
> I'm confused as to why one would use the FPU chip with BasicX, as
> BasicX can do 32 bit floating point math...
Yes, Basic-X floats and multitasking are great. I've implemented a
couple of pseudo-Kalman filters with BX-24s, though, and want more
speed; while I'm at it, since I think I'll have the power, I figure I
might as well do proper Kalmans and see what comes of that. The FPU
also has two 12-bit ADCs onboard and a timer, so it might make a smart,
semi-autonomous sensor front end. And, I'm intrigued by the broad
possibilities of relatively-easy-to-use high math with a 24-pin processor.
Tom

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
> ... I'm confused as to why one would use the FPU chip with BasicX,
as BasicX can do 32 bit floating point math...
Here's a comparison of my 3x3 matrix inversion, done in Basic-X, which
takes ~4345µS. The µM-FPU performs a similar function in ~920µS.
'-----------------------------------------------
' µX-24 Function Timer
' Measures execution times
' 2006-12-25 13:09
' Tom Becker G...@RighTime.com
' Insert your global Timed Function vars below this line
dim F0 as single
dim MA3a as single
dim MA3b as single
dim MA3c as single
dim MA3d as single
dim MA3e as single
dim MA3f as single
dim MA3g as single
dim MA3h as single
dim MA3i as single
dim MB3a as single
dim MB3b as single
dim MB3c as single
dim MB3d as single
dim MB3e as single
dim MB3f as single
dim MB3g as single
dim MB3h as single
dim MB3i as single
' Insert your global Timed Function vars above this line
' If the measured period is unstable, increase the execution loop count;
' slower tested code requires fewer iterations:
Const iCnt As Integer = 1000
Dim lTx As Long, lT0 As Long, lT1 As Long, sT1 As Single
Sub Main()
sleep (0.5)
' Insert your global var inits below this line
MA3a = 1.0 'dummy 3x3 matrix
MA3b = -0.1
MA3c = 0.01
MA3d = -0.3
MA3e = 1.0
MA3f = 0.2
MA3g = -0.1
MA3h = 0.001
MA3i = 1.0
' Insert your global var inits above this line
Dim i As Integer
Register.RTCTick = 0 'start at midnight
lTx = Register.RTCTick
For i = 1 To iCnt
Next
lTx = Register.RTCTick - lTx 'measure loop overhead
Register.RTCTick = 0
Do
Debug.Print "Measuring... ";
lT0 = Register.RTCTick
For i = 1 To iCnt
' Insert your Timed Function code (including local var dims) below this
' 3x3 matrix inversion
MB3a = (MA3e*MA3i) - (MA3f*MA3h) 'arrange MA elements in MB
MB3b = (MA3c*MA3h) - (MA3b*MA3i)
MB3c = (MA3b*MA3f) - (MA3e*MA3c)
MB3d = (MA3g*MA3f) - (MA3d*MA3i)
MB3e = (MA3a*MA3i) - (MA3g*MA3c)
MB3f = (MA3d*MA3c) - (MA3a*MA3f)
MB3g = (MA3d*MA3h) - (MA3g*MA3e)
MB3h = (MA3g*MA3b) - (MA3a*MA3h)
MB3i = (MA3a*MA3e) - (MA3b*MA3d)
F0 = 1.0 / ((MA3a*MA3e*MA3i) + (MA3b*MA3f*MA3g) + (MA3c*MA3d*MA3h) _
- (MA3c*MA3e*MA3g) - (MA3b*MA3d*MA3i) - (MA3a*MA3f*MA3h)) 'calc scalar
' #asm
' selectMA, MB3a, 3, 3 '3x3
' MOP, 4 'scalar multiply
MA3a = MB3a * F0
MA3b = MB3b * F0
MA3c = MB3c * F0
MA3d = MB3d * F0
MA3e = MB3e * F0
MA3f = MB3f * F0
MA3g = MB3g * F0
MA3h = MB3h * F0
MA3i = MB3i * F0
' selectMB, MA3a, 3, 3
' MOP, 25 'copy MB3 to MA3
' #endasm
' MA3a = MB3a
' MA3b = MB3b
' MA3c = MB3c
' MA3d = MB3d
' MA3e = MB3e
' MA3f = MB3f
' MA3g = MB3g
' MA3h = MB3h
' MA3i = MB3i
' Insert your Timed Function code (including local var dims) above this
Next
lT1 = Register.RTCTick - lT0 - lTx 'calc elapsed duration
sT1 = CSng(lT1) / 512! / CSng(iCnt) 'measurement duration mean
Debug.Print CStr(FixL(sT1 * 1000000#)) &"uS mean, n="& CStr(iCnt)
Loop
End Sub
'------------------------------------------------

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )