[Gambas-user] Matrices byref

martin p cristia tercoide at ...67...
Mon Jan 20 21:29:34 CET 2014


On 20/01/14 01:28, gambas-user-request at lists.sourceforge.net wrote:
>> 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]
I'm embarrassed on it being that simple  :s
tnx, Martin




More information about the User mailing list