📄 qccdataset.3
字号:
.TH QCCDATASET 3 "QCCPACK" "".SH NAMEQccDataset \- generic vector data structure.SH SYNOPSIS.B #include "libQccPack.h".sp.BI "int QccDatasetInitialize(QccDataset *" dataset );.br.BI "int QccDatasetAlloc(QccDataset *" dataset );.br.BI "void QccDatasetFree(QccDataset *" dataset );.br.BI "int QccDatasetGetBlockSize(const QccDataset *" dataset );.br.BI "int QccDatasetPrint(const QccDataset *" dataset );.br.BI "int QccDatasetCopy(QccDataset *" dataset1 ", const QccDataset *" dataset2 );.SH DESCRIPTIONQccPack provides data structure.B QccDatasetfor representing a generic two-dimensional dataset composed of a list ofvectors of the same vector dimension.This dataset structure can be read from and written to .BR DAT -formatfiles, or a.B QccDatasetstructure can be used without file input or output..LPThe main component of a.B QccDatasetstructure is an array of vectors.For file input and output,this array of vectors is the current block of vectorsbeing written to or read fromthe file.That is,access to.BR DAT -formatfiles is block-based, with a block of vectors being written or readat once.Optionally, the block size can be set to be the same as the file size,so that all vectors in the datasetare accessed simultaneously..B QccDatasetdatasets that do not involve file access typically hold all vectors ofthe dataset in the vector array..SH "DATA STRUCTURE"The.B QccDatasetdata structure is defined as:.RS.nftypedef struct{ QccString filename; FILE *fileptr; QccString magic_num; int major_version; int minor_version; int num_vectors; int vector_dimension; int access_block_size; int num_blocks_accessed; double min_val; double max_val; QccMatrix vectors;} QccDataset;.fi.RE.LPThe fields of.B QccDatasetare as follows:.TP.I filenameFor datasets associated with a file, this is the name of the file..TP.I fileptrFor datasets associated with an open file, this is the.B FILEpointer..TP.IR magic_num ", " major_version ", " minor_versionFor datasets associated with a file, these arethe magic number and version of the file..TP.IR num_vectorsThe total number of vectors contained in the dataset..TP.IR vector_dimensionThe vector dimension of the vectors in the dataset..TP.I access_block_sizeFor datasets associated with a file, this is the number of vectors thatwill be read or written at a time; i.e., the block size forblock-based reading and writing..TP.I num_blocks_accessedFor datasets associated with a file, this is the number of blocks of vectorsthat have already been read or written..TP.IR min_val ", " max_valThese two values give the smallest and largest vector components, respectively,contained in the dataset..TP.I vectorsThe current block of vectors from the dataset. The array contains.I access_block_size vectors each having dimension.IR vector_dimension ..SH "FILE FORMAT"For reading and writing structuresof type.BR QccDataset ,QccPack provides the.B DATfile format.This file format starts with an ASCII header followed bybinary data.The ASCII header consists of magic-number/revisioninformationfollowed by any amount of white space(space, `\\t' (tab), `\\n' (newline), `\\r' (carriage return)) and/orcomments lines (lines starting with `#'). Following this white space,additional ASCIIheader information is given, separated by blanks and newlines.Binary data follows this ASCII header information.Note: one (and only one) newline .B mustimmediately follow the last component of ASCII header information before thestart of the binary data..LPThe.B DATfile format consists of the following information:.RS.sp.BI DAT X.X.br.I "<white space>".br.I "N dim".br.I "min max".br.IR "v11 v12 v13" \|.\|.\|..br.IR "v21 v22 v23" \|.\|.\|..br\|..br\|..br\|..br.sp.REwhere.B DATis the magic number,.I X.Xis the version number,.I "<white space>"is white space and/or comment lines, .I N is the number of vectors the file contains, .I dim is the number of components each vector contains (vector dimension), .I min and .I max give the smallest and largest vector components, respectively,in the file,and .I vij is the jth component of the ith vector..I N and .I dim are integers. .IR vij ", " min ", and " max are doubles..IR N ", " dim ", " min ", and " .I maxare stored in ASCII, .I vij as binary (4 bytes, MSB first,see .BR QccFileWriteDouble (3)).No white space may exist between the .IR vij "'s.".SH "ROUTINES".B QccDatasetInitialize()should be called before any use of a.B QccDatasetstructure..B QccDatasetInitialize()initializes the fields of.I datasetto the following values:.RS.IR filename :.B NULLstring.br.IR magic_num :.B QCCDATASET_MAGICNUM.br.IR major_version ", " minor_version :initialized to output of .BR QccGetQccPackVersion (3).br.IR num_vectors :0.br.IR vector_dimension :0.br.IR access_block_size :.B QCCDATASET_ACCESSWHOLEFILE.br.IR num_blocks_accessed :0.br.IR min_val ", " max_val :0.br.IR vectors :.B NULL.RE.LP.B QccDatasetAlloc()allocates storage space for the.I vectors array of.IR dataset .If .I vectorsis not.BR NULL ,.B QccDatasetAlloc()returns immediately without changing the state of any memory allocation.Otherwise,the .I vectorsarray is allocated.The fields.IR access_block_size ,.IR num_vectors ,and.I vector_dimensionmust be defined prior to calling.BR QccDatasetAlloc() .If.I access_block_sizeequals.BR QCCDATASET_ACCESSWHOLEFILE ,then space for.I num_vectorsvectors is allocated;otherwise, space for.I access_block_sizevectors is allocated..LP.B QccDatasetFree()frees the.I vectorsarray previously allocated by.B QccDatasetAlloc() ..LP.B QccDatasetGetBlockSize()returns the block size of the.I vectorsarray of.IR dataset .If.I access_block_sizeis.BR QCCDATASET_ACCESSWHOLEFILE ,.I num_vectorsis returned; otherwise,.I access_block_sizeis returned..LP.B QccDatasetPrint()prints the contents of.I datasetto stdout..LP.B QccDatasetCopy()copies.I dataset2to.IR dataset1 .If.I dataset1has not been allocated prior to calling.B QccDatasetCopy() (as is evidenced by a.B NULL.IR dataset1 -> vectorspointer), then.B QccDatasetAlloc()is called to allocate space for.I dataset1with the same .I block\_sizeand.I vector\_dimensionas.IR dataset2 .Otherwise.RB (non- NULL.IR dataset1 -> vectorspointer), it is assumed that sufficient space as already beenallocated to.IR dataset1 .In either case,.B QccDatasetCopy()copies the.I vectorsarray of .I dataset2to the .I vectorsarray of .IR dataset1 via.BR QccMatrixCopy (3)..SH "RETURN VALUE"Except for.BR QccDatasetGetBlockSize() ,each of these routines return 0 upon successful completion, 1 on error..SH "SEE ALSO".BR QccGetQccPackVersion (3),.BR QccDatasetRead (3),.BR QccDatasetWrite (3),.BR QccMatrixCopy (3),.BR QccPack (3).SH AUTHORCopyright (C) 1997-2009 James E. Fowler.\" The programs herein are free software; you can redistribute them an.or.\" modify them under the terms of the GNU General Public License.\" as published by the Free Software Foundation; either version 2.\" of the License, or (at your option) any later version..\" .\" These programs are distributed in the hope that they will be useful,.\" but WITHOUT ANY WARRANTY; without even the implied warranty of.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the.\" GNU General Public License for more details..\" .\" You should have received a copy of the GNU General Public License.\" along with these programs; if not, write to the Free Software.\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -