a dedicated type for logical?

28 views
Skip to first unread message

Qianqian Fang

unread,
Aug 22, 2013, 6:51:54 PM8/22/13
to universal-...@googlegroups.com
hi Riyad

There are 'T' and 'F' in the spec for the two logical states, I am wondering if it makes sense to have a dedicated type for logical? For example, if I have the following logical array

[[][T][T][F][F][]]

in the optimized format, what should I use as the type?

[[][$][?][#][4][T][T][F][F]

I can convert logical arrays to int8/uint8, but I think it loses the semantics (in matlab, logical and uint8 are separate classes).

what would you suggest?

Qianqian

Riyad Kalla

unread,
Sep 16, 2013, 1:06:15 PM9/16/13
to universal-...@googlegroups.com
Qianqian,
My initial thought was that you can use either T or F as the Type marker for the optimized format (albeit, not terribly optimized since the type is already so tightly defined).

I was banging around the idea of a hyper-optimized layout for boolean types that would allow:

[$T#4] == [T, T, T, T]

But I think that is horrible because it special-cases so many aspects of the containers specifically for booleans. So for the purposes of boolean storage, it is actually slightly less optimized for write, but still optimized for read and you can use T or F as the marker.


Riyad
Reply all
Reply to author
Forward
0 new messages