![]() |
Blitz Support : |
From: Julian Cummings (cummings_at_[hidden])
Date: 2004-08-25 13:56:48
Hi Tim,
This is not really the appropriate way to interrogate a C++ object such
as a Blitz Array because the internals of the object are meant to be
private and not exposed to the user. Nevertheless, I can explain what
you are seeing below. The Array class inherits from
MemoryBlockReference, which contains a pointer to T for locating the
Array element at (0,0,...,0) and a pointer to a MemoryBlock object that
actually allocates and deallocates the array data storage. These
addresses are the first two numbers you see in the descriptor output.
Next, Array contains a GeneralArrayStorage object that has 1) an array
of dim ints to describe the ordering of array ranks by increasing stride
in memory, 2) an array of dim bools to indicate if each array rank is
stored in memory in ascending index order, and 3) an array of dim ints
that has the first valid index value for each array rank. Here dim is
the dimension or rank of the Array. Note that an array of bools is
stored in a packed fashion, so that 1 bool requires the 4-byte minimum
but 7 bools requires only 8 bytes. These arrays of numbers are what you
see next in the descriptor output. Finally, the Array also contains an
array of dim ints that give the Array length in each dimension, an array
of dim ints that give the stride to the next element for each Array
rank, and a single int that gives the offset from the first element in
the allocated block to the reference element at location (0,0,...,0).
These ints are the remaining items shown in the descriptor output.
Hope this helps,
Julian C.
P.S. If you are looking for the beginning and end of the data storage,
try using the Array method dataFirst(). Mucking around with the
internal Array member data is dangerous.
Tim.Pepper_at_[hidden] wrote:
> Hi there
>
>
>
> We are making use of Blitz in an application that we are writing. We
> are trying to make careful use of memory and need to know what various
> elements of the array descriptor are. We have managed to get some
> output from the descriptor and would like to know what each element is
> please:
>
>
>
> We have created arrays e.g.:
>
>
>
> Array<int, 1> y1d(2);
>
> Array<int, 7> y7d(2,3,4,5,6,7,8);
>
>
>
> And have printed out the descriptors using the following code:
>
>
>
> size = sizeof(y1d);
>
> pUInt = (unsigned int*)&y1d;
>
> cout << "Size of array descriptor: " << size << endl;
>
> for (unsigned int *ptr = pUInt; ptr < pUInt+size/4; ptr++)
>
> cout << *ptr << " ";
>
> cout << endl << endl;
>
>
>
> size = sizeof(y7d);
>
> pUInt = (unsigned int*)&y7d;
>
> cout << "Size of array descriptor: " << size << endl;
>
> for (unsigned int *ptr = pUInt; ptr < pUInt+size/4; ptr++)
>
> cout << *ptr << " ";
>
> cout << endl << endl;
>
>
>
> and get the following output:
>
>
>
> Size of array descriptor: 32
>
> 115288184 115288104 0 1 0 2 1 0
>
>
>
> Size of array descriptor: 132
>
> 120520808 115325664 6 5 4 3 2 1 0 16843009 65793 0 0 0 0 0 0 0 2 3 4 5
> 6 7 8 20160 6720 1680 336 56 8 1 0
>
>
>
> Could you please let us know what each element is? i.e. is 120520808
> the end memory address? Etc
>
>
>
> Many thanks,
>
>
>
> Tim Pepper
>
>
>
>
>
>
>
>
> _________________________________________________________________
>
> Notice of Confidentiality
>
> This transmission contains information that may be confidential and
> that may also be privileged. Unless you are the intended recipient of
> the message (or authorised to receive it for the intended recipient)
> you may not copy, forward, or otherwise use it, or disclose it or its
> contents to anyone else. If you have received this transmission in
> error please notify us immediately and delete it from your system.
> Please contact the sender if you have any problems with this email.
>
> In the UK, Watson Wyatt LLP is authorised and regulated by the
> Financial Services Authority and is a member of the General Insurance
> Standards Council. The services of Watson Wyatt in Ireland are
> provided by Watson Wyatt LLP, a limited liability partnership
> incorporated under English Law, with the exception of services which
> are provided as a Multi-Agency Intermediary, which for regulatory
> purposes, are provided by Watson Wyatt Partners, which is regulated by
> the Irish Financial Services Regulatory Authority, on behalf of Watson
> Wyatt LLP.
>
> _________________________________________________________________
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Blitz-support mailing list
>Blitz-support_at_[hidden]
>http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>
-- Dr. Julian C. Cummings E-mail: cummings_at_[hidden] California Institute of Technology Phone: 626-395-2543 1200 E. California Blvd., Mail Code 158-79 Fax: 626-584-5917 Pasadena, CA 91125