On Thu, 5 Nov 2015, Marcin Błażejowski wrote:
probably I don't undestand the way of handling bundles but I
wonder why?
1. time1 \approx time2
2. F3 doesn't work at all.
Regards,
Marcin
<hansl>
set echo off
open bjg
scalar N = 100000
bundle Foo
series Foo.new_series = lg
function void F1 (bundle *B)
a = mean(B.new_series)
end function
function void F2 (matrix B)
a = mean(B)
end function
function void F3 (matrix *B)
a = mean(B)
end function
set stopwatch
loop N --quiet
F1(&Foo)
endloop
scalar time1 = $stopwatch
loop N --quiet
F2(Foo.new_series)
endloop
scalar time2 = $stopwatch
printf "Exec time1: %f\nExec time2: %f\n\n\n", time1, time2
F3(&Foo.new_series)
</hansl>
In hansl you cannot "take the address" of something that's not a
variable in its own right. This is not specific to bundles: the same
would go for, e.g., "&m[,1]", where m is a matrix -- not a valid
expression. In this respect hansl differs from C, but that's the way
it is.
Allin