[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[task #15109] Size of dataset as an Arithmetic operator
From: |
Mohammad Akhlaghi |
Subject: |
[task #15109] Size of dataset as an Arithmetic operator |
Date: |
Sat, 7 Mar 2020 10:44:18 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0 |
Follow-up Comment #14, task #15109 (project gnuastro):
I recommend reading through the data.h documentation
<http://www.gnu.org/software/gnuastro/manual/html_node/Library-data-container.html>,
with its subsections. All Gnuastro programs use this structure for
reading/writing datasets of any type and size, with some basic metadata.
The `gal_data_alloc' function does the allocation of the necessary space in
memory (for the given type and number of elements it has). You just have to
write into it.
A simple/readable way to read/write to the datasets' arrays is similar to what
we discussed before about the `arg' dataset: once you know the dataset's size,
you define a pointer of that type, then set the pointer to point to the
dataset's allocated space for data. For example, if you want it to be `size_t'
(the type for "size"-related things that can never be negative), you can do
this:
size_t *out_arr;
out_arr=out->array;
out_arr[0]=in->dsize[arg_val-1];
But please read the data.h documentation first to avoid future confusions ;-).
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/task/?15109>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [task #15109] Size of dataset as an Arithmetic operator, Sachin Kumar Singh, 2020/03/04
- [task #15109] Size of dataset as an Arithmetic operator, Mohammad Akhlaghi, 2020/03/05
- [task #15109] Size of dataset as an Arithmetic operator, Mohammad Akhlaghi, 2020/03/05
- [task #15109] Size of dataset as an Arithmetic operator, Sachin Kumar Singh, 2020/03/06
- Message not available
- [task #15109] Size of dataset as an Arithmetic operator, Mohammad Akhlaghi, 2020/03/06
- [task #15109] Size of dataset as an Arithmetic operator, Sachin Kumar Singh, 2020/03/07
- [task #15109] Size of dataset as an Arithmetic operator,
Mohammad Akhlaghi <=
- [task #15109] Size of dataset as an Arithmetic operator, Mohammad Akhlaghi, 2020/03/07
- [task #15109] Size of dataset as an Arithmetic operator, Sachin Kumar Singh, 2020/03/08
- [task #15109] Arithmetic not reading data when metadata requested, Mohammad Akhlaghi, 2020/03/08