[Gambas-user] Matrices byref
Benoît Minisini
gambas at ...1...
Sun Jan 19 23:16:07 CET 2014
Le 17/01/2014 00:15, martin p cristia a écrit :
> I need this global matrix:
>
> Public MatRigGlo[12, 12] As Float
>
> that in some cases it needs to be [3,3] or [6,6]
> I pass that matrix to a C library:
>
> Public Extern M8simetrizarSQ(matriz As Float[], lOrden As Long)
>
> and the call is
>
> M8simetrizarSQ(MatRigGlo, 12)
>
> wich works perfectly. But its ineficient because if matrix is 3x3, the
> routine still need to process it like 12x12, and that matrix it's filled
> like 1M times. Will it work like this?
>
> Public Mat3[3,3] as Float
> Public Mat12[12,12] as Float
> Public MatRigGlo as Float[]
>
> ' Module
> MatrigGlo = Mat3
>
> and the use MatRigGlo like a 3x3 matrix?
> wich other ways to do this?
>
> tnx
>
No, because Mat3 and Mat12 are not normal Float arrays, but embedded
Float arrays.
You must declare them that way:
Public Mat3 As Float[3, 3]
Public Mat12 As Float[12, 12]
Or dynamically:
Public MatRigGlo as Float[]
MatRigGlo = New Float[iSize, iSize]
Regards,
--
Benoît Minisini
More information about the User
mailing list