Debian Codegraph @

ncl/nxsdiscretematrix.h

raw symbols SCIP
1 // Copyright (C) 1999-2003 Paul O. Lewiscxx . . $ `<file>/ncl/nxsdiscretematrix.h`/
2 //
3 // This file is part of NCL (Nexus Class Library) version 2.0.
4 //
5 // NCL is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // NCL is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with NCL; if not, write to the Free Software Foundation, Inc.,
17 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 //
19
20 #ifndef NCL_NXSDISCRETEMATRIX_H
21 #define NCL_NXSDISCRETEMATRIX_Hcxx . . $ `ncl/nxsdiscretematrix.h:21:9`!
22
23 #include <limits.h>
24
25 /*----------------------------------------------------------------------------------------------------------------------
26 | Class providing storage for the discrete data types (dna, rna, nucleotide, standard, and protein) inside a DATA or
27 | CHARACTERS block. This class is also used to store the data for an ALLELES block. Maintains a matrix in which each
28 | cell is an object of the class NxsDiscreteDatum. NxsDiscreteDatum stores the state for a particular combination of
29 | taxon and character as an integer. Ordinarily, there will be a single state recorded for each taxon-character
30 | combination, but exceptions exist if there is polymorphism for a taxon-character combination, or if there is
31 | uncertainty about the state (e.g., in dna data, the data file might have contained an R or Y entry). Please consult
32 | the documentation for the NxsDiscreteDatum class for the details about how states are stored. For data stored in an
33 | ALLELES block, rows of the matrix correspond to individuals and columns to loci. Each NxsDiscreteDatum must
34 | therefore store information about both genes at a single locus for a single individual in the case of diploid data.
35 | To do this, two macros HIWORD and LOWORD are used to divide up the unsigned value into two words. A maximum of 255
36 | distinct allelic forms can be accommodated by this scheme, assuming at minimum a 32-bit architecture. Because it is
37 | not known in advance how many rows are going to be necessary, The NxsDiscreteMatrix class provides the AddRows
38 | method, which expands the number of rows allocated for the matrix while preserving data already stored.
39 */
40 class NxsDiscreteMatrixcxx . . $ NxsDiscreteMatrix#
41 {
42 friend class NxsCharactersBlockcxx . . $ NxsCharactersBlock#;
43 friend class NxsAllelesBlockcxx . . $ NxsAllelesBlock#;
44
45 public:
46
47 NxsDiscreteMatrixcxx . . $ NxsDiscreteMatrix#NxsDiscreteMatrix(b4d55b1286ff73e8).(unsigned rows, unsigned cols);
48 virtual ~cxx . . $ NxsDiscreteMatrix#`~NxsDiscreteMatrix`(49f6e7a06ebc5aa8).NxsDiscreteMatrixcxx . . $ NxsDiscreteMatrix#();
49
50 void AddRowscxx . . $ NxsDiscreteMatrix#AddRows(cb2f890c2fdad230).(unsigned nAddRows);
51 void AddStatecxx . . $ NxsDiscreteMatrix#AddState(6df00707c193238d).(unsigned i, unsigned j, unsigned value);
52 void CopyStatesFromFirstTaxoncxx . . $ NxsDiscreteMatrix#CopyStatesFromFirstTaxon(b4d55b1286ff73e8).(unsigned i, unsigned j);
53 void DebugSaveMatrixcxx . . $ NxsDiscreteMatrix#DebugSaveMatrix(b425b1d874ebcc47).(ostreamcxx . . $ std/ostream# &out, unsigned colwidth = 12);
54 unsigned DuplicateRowcxx . . $ NxsDiscreteMatrix#DuplicateRow(67243219083b5ecc).(unsigned row, unsigned count, unsigned startCol = 0, unsigned endCol = UINT_MAXcxx . . $ `<external>/67164224788392828/limits.h:124:9`!);
55 void Flushcxx . . $ NxsDiscreteMatrix#Flush(49f6e7a06ebc5aa8).();
56 unsigned GetStatecxx . . $ NxsDiscreteMatrix#GetState(4eebda9b5e4ecc9c).(unsigned i, unsigned j, unsigned k = 0);
57 unsigned GetNumStatescxx . . $ NxsDiscreteMatrix#GetNumStates(83f10ac8959d5577).(unsigned i, unsigned j);
58 unsigned GetObsNumStatescxx . . $ NxsDiscreteMatrix#GetObsNumStates(2141b656ce2cc063).(unsigned j);
59 bool IsGapcxx . . $ NxsDiscreteMatrix#IsGap(8e1b545ea3aecce3).(unsigned i, unsigned j);
60 bool IsMissingcxx . . $ NxsDiscreteMatrix#IsMissing(8e1b545ea3aecce3).(unsigned i, unsigned j);
61 bool IsPolymorphiccxx . . $ NxsDiscreteMatrix#IsPolymorphic(8e1b545ea3aecce3).(unsigned i, unsigned j);
62 void Resetcxx . . $ NxsDiscreteMatrix#Reset(b4d55b1286ff73e8).(unsigned rows, unsigned cols);
63 void SetGapcxx . . $ NxsDiscreteMatrix#SetGap(b4d55b1286ff73e8).(unsigned i, unsigned j);
64 void SetMissingcxx . . $ NxsDiscreteMatrix#SetMissing(b4d55b1286ff73e8).(unsigned i, unsigned j);
65 void SetPolymorphiccxx . . $ NxsDiscreteMatrix#SetPolymorphic(6df00707c193238d).(unsigned i, unsigned j, unsigned value = 1);
66 void SetStatecxx . . $ NxsDiscreteMatrix#SetState(6df00707c193238d).(unsigned i, unsigned j, unsigned value);
67
68 private:
69
70 unsigned nrowscxx . . $ NxsDiscreteMatrix#nrows.; /* number of rows (taxa) in the data matrix */
71 unsigned ncolscxx . . $ NxsDiscreteMatrix#ncols.; /* number of columns (characters) in the data matrix */
72 NxsDiscreteDatumcxx . . $ NxsDiscreteDatum# **datacxx . . $ NxsDiscreteMatrix#data.; /* storage for the data */
73
74 void AddStatecxx . . $ NxsDiscreteMatrix#AddState(6886d22ddf24c82a).(NxsDiscreteDatumcxx . . $ NxsDiscreteDatum# &d, unsigned value);
75 bool IsGapcxx . . $ NxsDiscreteMatrix#IsGap(a6b2b1acfe266bb).(NxsDiscreteDatumcxx . . $ NxsDiscreteDatum# &d);
76 bool IsMissingcxx . . $ NxsDiscreteMatrix#IsMissing(a6b2b1acfe266bb).(NxsDiscreteDatumcxx . . $ NxsDiscreteDatum# &d);
77 bool IsPolymorphiccxx . . $ NxsDiscreteMatrix#IsPolymorphic(a6b2b1acfe266bb).(NxsDiscreteDatumcxx . . $ NxsDiscreteDatum# &d);
78 NxsDiscreteDatumcxx . . $ NxsDiscreteDatum# &GetDiscreteDatumcxx . . $ NxsDiscreteMatrix#GetDiscreteDatum(75a5dab719d5ec).(unsigned i, unsigned j);
79 unsigned GetNumStatescxx . . $ NxsDiscreteMatrix#GetNumStates(6bf80823f482adcb).(NxsDiscreteDatumcxx . . $ NxsDiscreteDatum# &d);
80 unsigned GetStatecxx . . $ NxsDiscreteMatrix#GetState(b287156587b79e53).(NxsDiscreteDatumcxx . . $ NxsDiscreteDatum# &d, unsigned k = 0);
81 void SetGapcxx . . $ NxsDiscreteMatrix#SetGap(c05da021738e1e05).(NxsDiscreteDatumcxx . . $ NxsDiscreteDatum# &d);
82 void SetMissingcxx . . $ NxsDiscreteMatrix#SetMissing(c05da021738e1e05).(NxsDiscreteDatumcxx . . $ NxsDiscreteDatum# &d);
83 void SetPolymorphiccxx . . $ NxsDiscreteMatrix#SetPolymorphic(6886d22ddf24c82a).(NxsDiscreteDatumcxx . . $ NxsDiscreteDatum# &d, unsigned value);
84 void SetStatecxx . . $ NxsDiscreteMatrix#SetState(6886d22ddf24c82a).(NxsDiscreteDatumcxx . . $ NxsDiscreteDatum# &d, unsigned value);
85 };
86
87 typedef NxsDiscreteMatrixcxx . . $ NxsDiscreteMatrix# DiscreteMatrixcxx . . $ DiscreteMatrix#;
88
89
90 #endif