rdkit-headers 2022.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. rdkit_headers/__init__.py +13 -0
  2. rdkit_headers/include/rdkit/CIPLabeler/CIPLabeler.h +59 -0
  3. rdkit_headers/include/rdkit/CIPLabeler/TooManyNodesException.h +28 -0
  4. rdkit_headers/include/rdkit/Catalogs/Catalog.h +461 -0
  5. rdkit_headers/include/rdkit/Catalogs/CatalogEntry.h +48 -0
  6. rdkit_headers/include/rdkit/Catalogs/CatalogParams.h +42 -0
  7. rdkit_headers/include/rdkit/ChemicalFeatures/ChemicalFeature.h +38 -0
  8. rdkit_headers/include/rdkit/ChemicalFeatures/FreeChemicalFeature.h +97 -0
  9. rdkit_headers/include/rdkit/DataManip/MetricMatrixCalc/MetricFuncs.h +54 -0
  10. rdkit_headers/include/rdkit/DataManip/MetricMatrixCalc/MetricMatrixCalc.h +106 -0
  11. rdkit_headers/include/rdkit/DataStructs/BitOps.h +337 -0
  12. rdkit_headers/include/rdkit/DataStructs/BitVect.h +68 -0
  13. rdkit_headers/include/rdkit/DataStructs/BitVectUtils.h +35 -0
  14. rdkit_headers/include/rdkit/DataStructs/BitVects.h +25 -0
  15. rdkit_headers/include/rdkit/DataStructs/DatastructsException.h +31 -0
  16. rdkit_headers/include/rdkit/DataStructs/DatastructsStreamOps.h +72 -0
  17. rdkit_headers/include/rdkit/DataStructs/DiscreteDistMat.h +30 -0
  18. rdkit_headers/include/rdkit/DataStructs/DiscreteValueVect.h +146 -0
  19. rdkit_headers/include/rdkit/DataStructs/ExplicitBitVect.h +96 -0
  20. rdkit_headers/include/rdkit/DataStructs/FPBReader.h +281 -0
  21. rdkit_headers/include/rdkit/DataStructs/MultiFPBReader.h +213 -0
  22. rdkit_headers/include/rdkit/DataStructs/SparseBitVect.h +101 -0
  23. rdkit_headers/include/rdkit/DataStructs/SparseIntVect.h +571 -0
  24. rdkit_headers/include/rdkit/DataStructs/base64.h +41 -0
  25. rdkit_headers/include/rdkit/DistGeom/BoundsMatrix.h +121 -0
  26. rdkit_headers/include/rdkit/DistGeom/ChiralSet.h +58 -0
  27. rdkit_headers/include/rdkit/DistGeom/ChiralViolationContrib.h +96 -0
  28. rdkit_headers/include/rdkit/DistGeom/DistGeomUtils.h +195 -0
  29. rdkit_headers/include/rdkit/DistGeom/DistViolationContrib.h +54 -0
  30. rdkit_headers/include/rdkit/DistGeom/FourthDimContrib.h +65 -0
  31. rdkit_headers/include/rdkit/DistGeom/TriangleSmooth.h +36 -0
  32. rdkit_headers/include/rdkit/Features/Feature.h +96 -0
  33. rdkit_headers/include/rdkit/ForceField/Contrib.h +40 -0
  34. rdkit_headers/include/rdkit/ForceField/ForceField.h +253 -0
  35. rdkit_headers/include/rdkit/ForceField/MMFF/AngleBend.h +78 -0
  36. rdkit_headers/include/rdkit/ForceField/MMFF/AngleConstraint.h +64 -0
  37. rdkit_headers/include/rdkit/ForceField/MMFF/BondStretch.h +67 -0
  38. rdkit_headers/include/rdkit/ForceField/MMFF/Contribs.h +26 -0
  39. rdkit_headers/include/rdkit/ForceField/MMFF/DistanceConstraint.h +61 -0
  40. rdkit_headers/include/rdkit/ForceField/MMFF/Nonbonded.h +105 -0
  41. rdkit_headers/include/rdkit/ForceField/MMFF/OopBend.h +65 -0
  42. rdkit_headers/include/rdkit/ForceField/MMFF/Params.h +1134 -0
  43. rdkit_headers/include/rdkit/ForceField/MMFF/PositionConstraint.h +55 -0
  44. rdkit_headers/include/rdkit/ForceField/MMFF/StretchBend.h +70 -0
  45. rdkit_headers/include/rdkit/ForceField/MMFF/TorsionAngle.h +79 -0
  46. rdkit_headers/include/rdkit/ForceField/MMFF/TorsionConstraint.h +70 -0
  47. rdkit_headers/include/rdkit/ForceField/UFF/AngleBend.h +92 -0
  48. rdkit_headers/include/rdkit/ForceField/UFF/AngleConstraint.h +64 -0
  49. rdkit_headers/include/rdkit/ForceField/UFF/BondStretch.h +83 -0
  50. rdkit_headers/include/rdkit/ForceField/UFF/Contribs.h +23 -0
  51. rdkit_headers/include/rdkit/ForceField/UFF/DistanceConstraint.h +62 -0
  52. rdkit_headers/include/rdkit/ForceField/UFF/Inversion.h +81 -0
  53. rdkit_headers/include/rdkit/ForceField/UFF/Nonbonded.h +87 -0
  54. rdkit_headers/include/rdkit/ForceField/UFF/Params.h +153 -0
  55. rdkit_headers/include/rdkit/ForceField/UFF/PositionConstraint.h +55 -0
  56. rdkit_headers/include/rdkit/ForceField/UFF/TorsionAngle.h +115 -0
  57. rdkit_headers/include/rdkit/ForceField/UFF/TorsionConstraint.h +70 -0
  58. rdkit_headers/include/rdkit/Geometry/Grid3D.h +55 -0
  59. rdkit_headers/include/rdkit/Geometry/GridUtils.h +64 -0
  60. rdkit_headers/include/rdkit/Geometry/Transform.h +19 -0
  61. rdkit_headers/include/rdkit/Geometry/Transform2D.h +85 -0
  62. rdkit_headers/include/rdkit/Geometry/Transform3D.h +101 -0
  63. rdkit_headers/include/rdkit/Geometry/UniformGrid3D.h +217 -0
  64. rdkit_headers/include/rdkit/Geometry/Utils.h +97 -0
  65. rdkit_headers/include/rdkit/Geometry/point.h +585 -0
  66. rdkit_headers/include/rdkit/GraphMol/Abbreviations/Abbreviations.h +132 -0
  67. rdkit_headers/include/rdkit/GraphMol/Atom.h +449 -0
  68. rdkit_headers/include/rdkit/GraphMol/AtomIterators.h +212 -0
  69. rdkit_headers/include/rdkit/GraphMol/Bond.h +393 -0
  70. rdkit_headers/include/rdkit/GraphMol/BondIterators.h +75 -0
  71. rdkit_headers/include/rdkit/GraphMol/Canon.h +130 -0
  72. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/CartesianProduct.h +147 -0
  73. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/Enumerate.h +187 -0
  74. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerateBase.h +200 -0
  75. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerateTypes.h +59 -0
  76. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerationPickler.h +60 -0
  77. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerationStrategyBase.h +227 -0
  78. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/RandomSample.h +163 -0
  79. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/RandomSampleAllBBs.h +184 -0
  80. rdkit_headers/include/rdkit/GraphMol/ChemReactions/PreprocessRxn.h +64 -0
  81. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Reaction.h +491 -0
  82. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionFingerprints.h +147 -0
  83. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionParser.h +274 -0
  84. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionPickler.h +119 -0
  85. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionRunner.h +116 -0
  86. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionUtils.h +74 -0
  87. rdkit_headers/include/rdkit/GraphMol/ChemReactions/SanitizeRxn.h +169 -0
  88. rdkit_headers/include/rdkit/GraphMol/ChemTransforms/ChemTransforms.h +270 -0
  89. rdkit_headers/include/rdkit/GraphMol/ChemTransforms/MolFragmenter.h +120 -0
  90. rdkit_headers/include/rdkit/GraphMol/Chirality.h +137 -0
  91. rdkit_headers/include/rdkit/GraphMol/Conformer.h +183 -0
  92. rdkit_headers/include/rdkit/GraphMol/CoordGen.h +195 -0
  93. rdkit_headers/include/rdkit/GraphMol/Depictor/DepictUtils.h +366 -0
  94. rdkit_headers/include/rdkit/GraphMol/Depictor/EmbeddedFrag.h +544 -0
  95. rdkit_headers/include/rdkit/GraphMol/Depictor/RDDepictor.h +284 -0
  96. rdkit_headers/include/rdkit/GraphMol/Deprotect/Deprotect.h +105 -0
  97. rdkit_headers/include/rdkit/GraphMol/Descriptors/AUTOCORR2D.h +49 -0
  98. rdkit_headers/include/rdkit/GraphMol/Descriptors/AUTOCORR3D.h +51 -0
  99. rdkit_headers/include/rdkit/GraphMol/Descriptors/AtomFeat.h +39 -0
  100. rdkit_headers/include/rdkit/GraphMol/Descriptors/BCUT.h +66 -0
  101. rdkit_headers/include/rdkit/GraphMol/Descriptors/ConnectivityDescriptors.h +211 -0
  102. rdkit_headers/include/rdkit/GraphMol/Descriptors/CoulombMat.h +42 -0
  103. rdkit_headers/include/rdkit/GraphMol/Descriptors/Crippen.h +137 -0
  104. rdkit_headers/include/rdkit/GraphMol/Descriptors/Data3Ddescriptors.h +55 -0
  105. rdkit_headers/include/rdkit/GraphMol/Descriptors/EEM.h +59 -0
  106. rdkit_headers/include/rdkit/GraphMol/Descriptors/GETAWAY.h +51 -0
  107. rdkit_headers/include/rdkit/GraphMol/Descriptors/Lipinski.h +169 -0
  108. rdkit_headers/include/rdkit/GraphMol/Descriptors/MORSE.h +50 -0
  109. rdkit_headers/include/rdkit/GraphMol/Descriptors/MQN.h +47 -0
  110. rdkit_headers/include/rdkit/GraphMol/Descriptors/MolData3Ddescriptors.h +62 -0
  111. rdkit_headers/include/rdkit/GraphMol/Descriptors/MolDescriptors.h +86 -0
  112. rdkit_headers/include/rdkit/GraphMol/Descriptors/MolDescriptors3D.h +25 -0
  113. rdkit_headers/include/rdkit/GraphMol/Descriptors/MolSurf.h +120 -0
  114. rdkit_headers/include/rdkit/GraphMol/Descriptors/PBF.h +60 -0
  115. rdkit_headers/include/rdkit/GraphMol/Descriptors/PMI.h +128 -0
  116. rdkit_headers/include/rdkit/GraphMol/Descriptors/Property.h +123 -0
  117. rdkit_headers/include/rdkit/GraphMol/Descriptors/RDF.h +52 -0
  118. rdkit_headers/include/rdkit/GraphMol/Descriptors/RegisterDescriptor.h +84 -0
  119. rdkit_headers/include/rdkit/GraphMol/Descriptors/USRDescriptor.h +137 -0
  120. rdkit_headers/include/rdkit/GraphMol/Descriptors/WHIM.h +51 -0
  121. rdkit_headers/include/rdkit/GraphMol/DistGeomHelpers/BoundsMatrixBuilder.h +77 -0
  122. rdkit_headers/include/rdkit/GraphMol/DistGeomHelpers/Embedder.h +437 -0
  123. rdkit_headers/include/rdkit/GraphMol/FMCS/FMCS.h +194 -0
  124. rdkit_headers/include/rdkit/GraphMol/FMCS/Graph.h +43 -0
  125. rdkit_headers/include/rdkit/GraphMol/FileParsers/FileParserUtils.h +231 -0
  126. rdkit_headers/include/rdkit/GraphMol/FileParsers/FileParsers.h +399 -0
  127. rdkit_headers/include/rdkit/GraphMol/FileParsers/GeneralFileReader.h +170 -0
  128. rdkit_headers/include/rdkit/GraphMol/FileParsers/MolFileStereochem.h +60 -0
  129. rdkit_headers/include/rdkit/GraphMol/FileParsers/MolSupplier.h +444 -0
  130. rdkit_headers/include/rdkit/GraphMol/FileParsers/MolWriters.h +338 -0
  131. rdkit_headers/include/rdkit/GraphMol/FileParsers/MultithreadedMolSupplier.h +102 -0
  132. rdkit_headers/include/rdkit/GraphMol/FileParsers/MultithreadedSDMolSupplier.h +65 -0
  133. rdkit_headers/include/rdkit/GraphMol/FileParsers/MultithreadedSmilesMolSupplier.h +66 -0
  134. rdkit_headers/include/rdkit/GraphMol/FileParsers/PNGParser.h +203 -0
  135. rdkit_headers/include/rdkit/GraphMol/FileParsers/SequenceParsers.h +117 -0
  136. rdkit_headers/include/rdkit/GraphMol/FileParsers/SequenceWriters.h +47 -0
  137. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterCatalog.h +260 -0
  138. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterCatalogEntry.h +276 -0
  139. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterMatcherBase.h +152 -0
  140. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterMatchers.h +576 -0
  141. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FunctionalGroupHierarchy.h +52 -0
  142. rdkit_headers/include/rdkit/GraphMol/Fingerprints/AtomPairGenerator.h +188 -0
  143. rdkit_headers/include/rdkit/GraphMol/Fingerprints/AtomPairs.h +268 -0
  144. rdkit_headers/include/rdkit/GraphMol/Fingerprints/FingerprintGenerator.h +372 -0
  145. rdkit_headers/include/rdkit/GraphMol/Fingerprints/FingerprintUtil.h +160 -0
  146. rdkit_headers/include/rdkit/GraphMol/Fingerprints/Fingerprints.h +167 -0
  147. rdkit_headers/include/rdkit/GraphMol/Fingerprints/MACCS.h +32 -0
  148. rdkit_headers/include/rdkit/GraphMol/Fingerprints/MHFP.h +285 -0
  149. rdkit_headers/include/rdkit/GraphMol/Fingerprints/MorganFingerprints.h +210 -0
  150. rdkit_headers/include/rdkit/GraphMol/Fingerprints/MorganGenerator.h +251 -0
  151. rdkit_headers/include/rdkit/GraphMol/Fingerprints/RDKitFPGenerator.h +162 -0
  152. rdkit_headers/include/rdkit/GraphMol/Fingerprints/TopologicalTorsionGenerator.h +127 -0
  153. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/CrystalFF/TorsionAngleM6.h +72 -0
  154. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/CrystalFF/TorsionPreferences.h +41 -0
  155. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/FFConvenience.h +130 -0
  156. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h +236 -0
  157. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/MMFF/Builder.h +141 -0
  158. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/MMFF/MMFF.h +105 -0
  159. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/UFF/AtomTyper.h +57 -0
  160. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/UFF/Builder.h +129 -0
  161. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/UFF/UFF.h +82 -0
  162. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatGenerator.h +33 -0
  163. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatParams.h +94 -0
  164. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatalogEntry.h +136 -0
  165. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatalogUtils.h +62 -0
  166. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragFPGenerator.h +38 -0
  167. rdkit_headers/include/rdkit/GraphMol/GenericGroups/GenericGroups.h +301 -0
  168. rdkit_headers/include/rdkit/GraphMol/GraphMol.h +22 -0
  169. rdkit_headers/include/rdkit/GraphMol/MMPA/MMPA.h +81 -0
  170. rdkit_headers/include/rdkit/GraphMol/MolAlign/AlignMolecules.h +183 -0
  171. rdkit_headers/include/rdkit/GraphMol/MolAlign/O3AAlignMolecules.h +354 -0
  172. rdkit_headers/include/rdkit/GraphMol/MolBundle.h +121 -0
  173. rdkit_headers/include/rdkit/GraphMol/MolCatalog/MolCatalog.h +20 -0
  174. rdkit_headers/include/rdkit/GraphMol/MolCatalog/MolCatalogEntry.h +109 -0
  175. rdkit_headers/include/rdkit/GraphMol/MolCatalog/MolCatalogParams.h +40 -0
  176. rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/FeatureParser.h +58 -0
  177. rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/MolChemicalFeature.h +98 -0
  178. rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/MolChemicalFeatureDef.h +68 -0
  179. rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/MolChemicalFeatureFactory.h +78 -0
  180. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2D.h +539 -0
  181. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DHelpers.h +284 -0
  182. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DJS.h +62 -0
  183. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DSVG.h +88 -0
  184. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DUtils.h +179 -0
  185. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2Dwx.h +107 -0
  186. rdkit_headers/include/rdkit/GraphMol/MolEnumerator/LinkNode.h +159 -0
  187. rdkit_headers/include/rdkit/GraphMol/MolEnumerator/MolEnumerator.h +276 -0
  188. rdkit_headers/include/rdkit/GraphMol/MolHash/MolHash.h +12 -0
  189. rdkit_headers/include/rdkit/GraphMol/MolHash/nmmolhash.h +60 -0
  190. rdkit_headers/include/rdkit/GraphMol/MolInterchange/MolInterchange.h +93 -0
  191. rdkit_headers/include/rdkit/GraphMol/MolInterchange/details.h +49 -0
  192. rdkit_headers/include/rdkit/GraphMol/MolOps.h +1016 -0
  193. rdkit_headers/include/rdkit/GraphMol/MolPickler.h +314 -0
  194. rdkit_headers/include/rdkit/GraphMol/MolStandardize/AcidBaseCatalog/AcidBaseCatalogEntry.h +56 -0
  195. rdkit_headers/include/rdkit/GraphMol/MolStandardize/AcidBaseCatalog/AcidBaseCatalogParams.h +65 -0
  196. rdkit_headers/include/rdkit/GraphMol/MolStandardize/AcidBaseCatalog/AcidBaseCatalogUtils.h +37 -0
  197. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Charge.h +145 -0
  198. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Fragment.h +105 -0
  199. rdkit_headers/include/rdkit/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogEntry.h +60 -0
  200. rdkit_headers/include/rdkit/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogParams.h +63 -0
  201. rdkit_headers/include/rdkit/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogUtils.h +35 -0
  202. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Metal.h +73 -0
  203. rdkit_headers/include/rdkit/GraphMol/MolStandardize/MolStandardize.h +178 -0
  204. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Normalize.h +104 -0
  205. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Tautomer.h +428 -0
  206. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogEntry.h +59 -0
  207. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogParams.h +69 -0
  208. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogUtils.h +81 -0
  209. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TransformCatalog/TransformCatalogEntry.h +57 -0
  210. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TransformCatalog/TransformCatalogParams.h +66 -0
  211. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TransformCatalog/TransformCatalogUtils.h +37 -0
  212. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Validate.h +199 -0
  213. rdkit_headers/include/rdkit/GraphMol/MolTransforms/MolTransforms.h +222 -0
  214. rdkit_headers/include/rdkit/GraphMol/MonomerInfo.h +138 -0
  215. rdkit_headers/include/rdkit/GraphMol/PartialCharges/GasteigerCharges.h +27 -0
  216. rdkit_headers/include/rdkit/GraphMol/PartialCharges/GasteigerParams.h +86 -0
  217. rdkit_headers/include/rdkit/GraphMol/PeriodicTable.h +325 -0
  218. rdkit_headers/include/rdkit/GraphMol/QueryAtom.h +161 -0
  219. rdkit_headers/include/rdkit/GraphMol/QueryBond.h +146 -0
  220. rdkit_headers/include/rdkit/GraphMol/QueryOps.h +1110 -0
  221. rdkit_headers/include/rdkit/GraphMol/RDKitBase.h +35 -0
  222. rdkit_headers/include/rdkit/GraphMol/RDKitQueries.h +25 -0
  223. rdkit_headers/include/rdkit/GraphMol/RGroupDecomposition/RGroupDecomp.h +225 -0
  224. rdkit_headers/include/rdkit/GraphMol/ROMol.h +844 -0
  225. rdkit_headers/include/rdkit/GraphMol/RWMol.h +222 -0
  226. rdkit_headers/include/rdkit/GraphMol/ReducedGraphs/ReducedGraphs.h +85 -0
  227. rdkit_headers/include/rdkit/GraphMol/Resonance.h +236 -0
  228. rdkit_headers/include/rdkit/GraphMol/RingInfo.h +274 -0
  229. rdkit_headers/include/rdkit/GraphMol/Rings.h +90 -0
  230. rdkit_headers/include/rdkit/GraphMol/SLNParse/SLNAttribs.h +93 -0
  231. rdkit_headers/include/rdkit/GraphMol/SLNParse/SLNParse.h +70 -0
  232. rdkit_headers/include/rdkit/GraphMol/SLNParse/SLNParseOps.h +328 -0
  233. rdkit_headers/include/rdkit/GraphMol/SanitException.h +120 -0
  234. rdkit_headers/include/rdkit/GraphMol/ScaffoldNetwork/ScaffoldNetwork.h +195 -0
  235. rdkit_headers/include/rdkit/GraphMol/ShapeHelpers/ShapeEncoder.h +73 -0
  236. rdkit_headers/include/rdkit/GraphMol/ShapeHelpers/ShapeUtils.h +279 -0
  237. rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmartsWrite.h +46 -0
  238. rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmilesParse.h +160 -0
  239. rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmilesParseOps.h +53 -0
  240. rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmilesWrite.h +288 -0
  241. rdkit_headers/include/rdkit/GraphMol/SmilesParse/primes.h +18 -0
  242. rdkit_headers/include/rdkit/GraphMol/StereoGroup.h +74 -0
  243. rdkit_headers/include/rdkit/GraphMol/Subgraphs/SubgraphUtils.h +57 -0
  244. rdkit_headers/include/rdkit/GraphMol/Subgraphs/Subgraphs.h +154 -0
  245. rdkit_headers/include/rdkit/GraphMol/SubstanceGroup.h +297 -0
  246. rdkit_headers/include/rdkit/GraphMol/Substruct/SubstructMatch.h +232 -0
  247. rdkit_headers/include/rdkit/GraphMol/Substruct/SubstructUtils.h +44 -0
  248. rdkit_headers/include/rdkit/GraphMol/SubstructLibrary/PatternFactory.h +40 -0
  249. rdkit_headers/include/rdkit/GraphMol/SubstructLibrary/SubstructLibrary.h +951 -0
  250. rdkit_headers/include/rdkit/GraphMol/SubstructLibrary/SubstructLibrarySerialization.h +231 -0
  251. rdkit_headers/include/rdkit/GraphMol/TautomerQuery/TautomerQuery.h +104 -0
  252. rdkit_headers/include/rdkit/GraphMol/Trajectory/Snapshot.h +69 -0
  253. rdkit_headers/include/rdkit/GraphMol/Trajectory/Trajectory.h +105 -0
  254. rdkit_headers/include/rdkit/GraphMol/atomic_data.h +76 -0
  255. rdkit_headers/include/rdkit/GraphMol/details.h +15 -0
  256. rdkit_headers/include/rdkit/GraphMol/new_canon.h +772 -0
  257. rdkit_headers/include/rdkit/Numerics/Alignment/AlignPoints.h +49 -0
  258. rdkit_headers/include/rdkit/Numerics/Conrec.h +203 -0
  259. rdkit_headers/include/rdkit/Numerics/EigenSolvers/PowerEigenSolver.h +68 -0
  260. rdkit_headers/include/rdkit/Numerics/Matrix.h +347 -0
  261. rdkit_headers/include/rdkit/Numerics/Optimizer/BFGSOpt.h +397 -0
  262. rdkit_headers/include/rdkit/Numerics/SquareMatrix.h +89 -0
  263. rdkit_headers/include/rdkit/Numerics/SymmMatrix.h +361 -0
  264. rdkit_headers/include/rdkit/Numerics/Vector.h +327 -0
  265. rdkit_headers/include/rdkit/Query/AndQuery.h +57 -0
  266. rdkit_headers/include/rdkit/Query/EqualityQuery.h +88 -0
  267. rdkit_headers/include/rdkit/Query/GreaterEqualQuery.h +74 -0
  268. rdkit_headers/include/rdkit/Query/GreaterQuery.h +74 -0
  269. rdkit_headers/include/rdkit/Query/LessEqualQuery.h +75 -0
  270. rdkit_headers/include/rdkit/Query/LessQuery.h +74 -0
  271. rdkit_headers/include/rdkit/Query/NullQueryAlgebra.h +86 -0
  272. rdkit_headers/include/rdkit/Query/OrQuery.h +58 -0
  273. rdkit_headers/include/rdkit/Query/Query.h +210 -0
  274. rdkit_headers/include/rdkit/Query/QueryObjects.h +38 -0
  275. rdkit_headers/include/rdkit/Query/RangeQuery.h +116 -0
  276. rdkit_headers/include/rdkit/Query/SetQuery.h +87 -0
  277. rdkit_headers/include/rdkit/Query/XOrQuery.h +63 -0
  278. rdkit_headers/include/rdkit/RDGeneral/BadFileException.h +39 -0
  279. rdkit_headers/include/rdkit/RDGeneral/BoostEndInclude.h +69 -0
  280. rdkit_headers/include/rdkit/RDGeneral/BoostStartInclude.h +95 -0
  281. rdkit_headers/include/rdkit/RDGeneral/ConcurrentQueue.h +132 -0
  282. rdkit_headers/include/rdkit/RDGeneral/Dict.h +350 -0
  283. rdkit_headers/include/rdkit/RDGeneral/Exceptions.h +73 -0
  284. rdkit_headers/include/rdkit/RDGeneral/FileParseException.h +36 -0
  285. rdkit_headers/include/rdkit/RDGeneral/Invariant.h +198 -0
  286. rdkit_headers/include/rdkit/RDGeneral/LocaleSwitcher.h +54 -0
  287. rdkit_headers/include/rdkit/RDGeneral/RDAny.h +217 -0
  288. rdkit_headers/include/rdkit/RDGeneral/RDConfig.h +49 -0
  289. rdkit_headers/include/rdkit/RDGeneral/RDExportMacros.h +40 -0
  290. rdkit_headers/include/rdkit/RDGeneral/RDLog.h +142 -0
  291. rdkit_headers/include/rdkit/RDGeneral/RDProps.h +172 -0
  292. rdkit_headers/include/rdkit/RDGeneral/RDThreads.h +44 -0
  293. rdkit_headers/include/rdkit/RDGeneral/RDValue-doublemagic.h +478 -0
  294. rdkit_headers/include/rdkit/RDGeneral/RDValue-taggedunion.h +518 -0
  295. rdkit_headers/include/rdkit/RDGeneral/RDValue.h +285 -0
  296. rdkit_headers/include/rdkit/RDGeneral/Ranking.h +87 -0
  297. rdkit_headers/include/rdkit/RDGeneral/StreamOps.h +637 -0
  298. rdkit_headers/include/rdkit/RDGeneral/export.h +559 -0
  299. rdkit_headers/include/rdkit/RDGeneral/hanoiSort.h +167 -0
  300. rdkit_headers/include/rdkit/RDGeneral/hash/detail/float_functions.hpp +156 -0
  301. rdkit_headers/include/rdkit/RDGeneral/hash/detail/hash_float.hpp +179 -0
  302. rdkit_headers/include/rdkit/RDGeneral/hash/extensions.hpp +152 -0
  303. rdkit_headers/include/rdkit/RDGeneral/hash/hash.hpp +463 -0
  304. rdkit_headers/include/rdkit/RDGeneral/hash/hash_fwd.hpp +51 -0
  305. rdkit_headers/include/rdkit/RDGeneral/test.h +274 -0
  306. rdkit_headers/include/rdkit/RDGeneral/types.h +401 -0
  307. rdkit_headers/include/rdkit/RDGeneral/utils.h +106 -0
  308. rdkit_headers/include/rdkit/RDGeneral/versions.h +27 -0
  309. rdkit_headers/include/rdkit/RDStreams/streams.h +19 -0
  310. rdkit_headers/include/rdkit/RingDecomposerLib.h +751 -0
  311. rdkit_headers/include/rdkit/SimDivPickers/DistPicker.h +92 -0
  312. rdkit_headers/include/rdkit/SimDivPickers/HierarchicalClusterPicker.h +107 -0
  313. rdkit_headers/include/rdkit/SimDivPickers/LeaderPicker.h +470 -0
  314. rdkit_headers/include/rdkit/SimDivPickers/MaxMinPicker.h +303 -0
  315. rdkit_headers-2022.3.3.dist-info/METADATA +24 -0
  316. rdkit_headers-2022.3.3.dist-info/RECORD +320 -0
  317. rdkit_headers-2022.3.3.dist-info/WHEEL +4 -0
  318. rdkit_headers-2022.3.3.dist-info/entry_points.txt +4 -0
  319. rdkit_headers-2022.3.3.dist-info/licenses/LICENSE +29 -0
  320. rdkit_headers-2022.3.3.dist-info/licenses/NOTICE +5 -0
@@ -0,0 +1,49 @@
1
+ //
2
+ // Copyright (C) 2004-2008 Greg Landrum and Rational Discovery LLC
3
+ //
4
+ // @@ All Rights Reserved @@
5
+ // This file is part of the RDKit.
6
+ // The contents are covered by the terms of the BSD license
7
+ // which is included in the file license.txt, found at the root
8
+ // of the RDKit source tree.
9
+ //
10
+ #include <RDGeneral/export.h>
11
+ #ifndef __RD_ALIGN_POINTS_H__
12
+ #define __RD_ALIGN_POINTS_H__
13
+
14
+ #include <Geometry/point.h>
15
+ #include <Geometry/Transform3D.h>
16
+ #include <Numerics/Vector.h>
17
+
18
+ namespace RDNumeric {
19
+
20
+ namespace Alignments {
21
+
22
+ //! \brief Compute an optimal alignment (minimum sum of squared distance)
23
+ /// between
24
+ //! two sets of points in 3D
25
+ /*!
26
+ \param refPoints A vector of pointers to the reference points
27
+ \param probePoints A vector of pointers to the points to be aligned to the
28
+ refPoints
29
+ \param trans A RDGeom::Transform3D object to capture the necessary
30
+ transformation
31
+ \param weights A vector of weights for each of the points
32
+ \param reflect Add reflection is true
33
+ \param maxIterations Maximum number of iterations
34
+
35
+ \return The sum of squared distances between the points
36
+
37
+ <b>Note</b>
38
+ This function returns the sum of squared distance (SSR) not the RMSD
39
+ RMSD = sqrt(SSR/numPoints)
40
+ */
41
+ double RDKIT_ALIGNMENT_EXPORT
42
+ AlignPoints(const RDGeom::Point3DConstPtrVect &refPoints,
43
+ const RDGeom::Point3DConstPtrVect &probePoints,
44
+ RDGeom::Transform3D &trans, const DoubleVector *weights = nullptr,
45
+ bool reflect = false, unsigned int maxIterations = 50);
46
+ } // namespace Alignments
47
+ } // namespace RDNumeric
48
+
49
+ #endif
@@ -0,0 +1,203 @@
1
+ //
2
+ // Copyright (C) 2019 Greg Landrum
3
+ //
4
+ // @@ All Rights Reserved @@
5
+ // This file is part of the RDKit.
6
+ // The contents are covered by the terms of the BSD license
7
+ // which is included in the file license.txt, found at the root
8
+ // of the RDKit source tree.
9
+ //
10
+ #include <vector>
11
+ #include <Geometry/point.h>
12
+
13
+ namespace conrec {
14
+ struct ConrecSegment {
15
+ RDGeom::Point2D p1;
16
+ RDGeom::Point2D p2;
17
+ double isoVal;
18
+ ConrecSegment(double x1, double y1, double x2, double y2, double isoVal)
19
+ : p1(x1, y1), p2(x2, y2), isoVal(isoVal) {}
20
+ ConrecSegment(const RDGeom::Point2D &p1, const RDGeom::Point2D &p2,
21
+ double isoVal)
22
+ : p1(p1), p2(p2), isoVal(isoVal) {}
23
+ };
24
+ // adapted from conrec.c by Paul Bourke:
25
+ // http://paulbourke.net/papers/conrec/conrec.c
26
+ /*
27
+ Derivation from the fortran version of CONREC by Paul Bourke
28
+ d ! matrix of data to contour
29
+ ilb,iub,jlb,jub ! index bounds of data matrix
30
+ x ! data matrix column coordinates
31
+ y ! data matrix row coordinates
32
+ nc ! number of contour levels
33
+ z ! contour levels in increasing order
34
+ */
35
+ inline void Contour(const double *d, size_t ilb, size_t iub, size_t jlb,
36
+ size_t jub, const double *x, const double *y, size_t nc,
37
+ double *z, std::vector<ConrecSegment> &res) {
38
+ PRECONDITION(d, "no data");
39
+ PRECONDITION(x, "no data");
40
+ PRECONDITION(y, "no data");
41
+ PRECONDITION(z, "no data");
42
+ PRECONDITION(nc > 0, "no contours");
43
+ PRECONDITION(iub > ilb, "bad bounds");
44
+ PRECONDITION(jub > jlb, "bad bounds");
45
+
46
+ int m1, m2, m3, case_value;
47
+ double dmin, dmax, x1 = 0, x2 = 0, y1 = 0, y2 = 0;
48
+ int i, j, m;
49
+ size_t k;
50
+ double h[5];
51
+ int sh[5];
52
+ double xh[5], yh[5];
53
+ int im[4] = {0, 1, 1, 0}, jm[4] = {0, 0, 1, 1};
54
+ int castab[3][3][3] = {{{0, 0, 8}, {0, 2, 5}, {7, 6, 9}},
55
+ {{0, 3, 4}, {1, 3, 1}, {4, 3, 0}},
56
+ {{9, 6, 7}, {5, 2, 0}, {8, 0, 0}}};
57
+ double temp1, temp2;
58
+ size_t ny = jub - jlb + 1;
59
+
60
+ auto xsect = [&](int p1, int p2) {
61
+ return (h[p2] * xh[p1] - h[p1] * xh[p2]) / (h[p2] - h[p1]);
62
+ };
63
+ auto ysect = [&](int p1, int p2) {
64
+ return (h[p2] * yh[p1] - h[p1] * yh[p2]) / (h[p2] - h[p1]);
65
+ };
66
+
67
+ for (j = (jub - 1); j >= (int)jlb; j--) {
68
+ for (i = ilb; i <= (int)iub - 1; i++) {
69
+ temp1 = std::min(d[i * ny + j], d[i * ny + j + 1]);
70
+ temp2 = std::min(d[(i + 1) * ny + j], d[(i + 1) * ny + j + 1]);
71
+ dmin = std::min(temp1, temp2);
72
+ temp1 = std::max(d[i * ny + j], d[i * ny + j + 1]);
73
+ temp2 = std::max(d[(i + 1) * ny + j], d[(i + 1) * ny + j + 1]);
74
+ dmax = std::max(temp1, temp2);
75
+ if (dmax < z[0] || dmin > z[nc - 1]) {
76
+ continue;
77
+ }
78
+ for (k = 0; k < nc; k++) {
79
+ if (z[k] < dmin || z[k] > dmax) {
80
+ continue;
81
+ }
82
+ for (m = 4; m >= 0; m--) {
83
+ if (m > 0) {
84
+ h[m] = d[(i + im[m - 1]) * ny + j + jm[m - 1]] - z[k];
85
+ xh[m] = x[i + im[m - 1]];
86
+ yh[m] = y[j + jm[m - 1]];
87
+ } else {
88
+ h[0] = 0.25 * (h[1] + h[2] + h[3] + h[4]);
89
+ xh[0] = 0.50 * (x[i] + x[i + 1]);
90
+ yh[0] = 0.50 * (y[j] + y[j + 1]);
91
+ }
92
+ if (h[m] > 0.0) {
93
+ sh[m] = 1;
94
+ } else if (h[m] < 0.0) {
95
+ sh[m] = -1;
96
+ } else {
97
+ sh[m] = 0;
98
+ }
99
+ }
100
+
101
+ /*
102
+ Note: at this stage the relative heights of the corners and the
103
+ centre are in the h array, and the corresponding coordinates are
104
+ in the xh and yh arrays. The centre of the box is indexed by 0
105
+ and the 4 corners by 1 to 4 as shown below.
106
+ Each triangle is then indexed by the parameter m, and the 3
107
+ vertices of each triangle are indexed by parameters m1,m2,and m3.
108
+ It is assumed that the centre of the box is always vertex 2
109
+ though this isimportant only when all 3 vertices lie exactly on
110
+ the same contour level, in which case only the side of the box
111
+ is drawn.
112
+ vertex 4 +-------------------+ vertex 3
113
+ | \ / |
114
+ | \ m-3 / |
115
+ | \ / |
116
+ | \ / |
117
+ | m=2 X m=2 | the centre is vertex 0
118
+ | / \ |
119
+ | / \ |
120
+ | / m=1 \ |
121
+ | / \ |
122
+ vertex 1 +-------------------+ vertex 2
123
+ */
124
+ /* Scan each triangle in the box */
125
+ for (m = 1; m <= 4; m++) {
126
+ m1 = m;
127
+ m2 = 0;
128
+ if (m != 4) {
129
+ m3 = m + 1;
130
+ } else {
131
+ m3 = 1;
132
+ }
133
+ if ((case_value = castab[sh[m1] + 1][sh[m2] + 1][sh[m3] + 1]) == 0) {
134
+ continue;
135
+ }
136
+ switch (case_value) {
137
+ case 1: /* Line between vertices 1 and 2 */
138
+ x1 = xh[m1];
139
+ y1 = yh[m1];
140
+ x2 = xh[m2];
141
+ y2 = yh[m2];
142
+ break;
143
+ case 2: /* Line between vertices 2 and 3 */
144
+ x1 = xh[m2];
145
+ y1 = yh[m2];
146
+ x2 = xh[m3];
147
+ y2 = yh[m3];
148
+ break;
149
+ case 3: /* Line between vertices 3 and 1 */
150
+ x1 = xh[m3];
151
+ y1 = yh[m3];
152
+ x2 = xh[m1];
153
+ y2 = yh[m1];
154
+ break;
155
+ case 4: /* Line between vertex 1 and side 2-3 */
156
+ x1 = xh[m1];
157
+ y1 = yh[m1];
158
+ x2 = xsect(m2, m3);
159
+ y2 = ysect(m2, m3);
160
+ break;
161
+ case 5: /* Line between vertex 2 and side 3-1 */
162
+ x1 = xh[m2];
163
+ y1 = yh[m2];
164
+ x2 = xsect(m3, m1);
165
+ y2 = ysect(m3, m1);
166
+ break;
167
+ case 6: /* Line between vertex 3 and side 1-2 */
168
+ x1 = xh[m3];
169
+ y1 = yh[m3];
170
+ x2 = xsect(m1, m2);
171
+ y2 = ysect(m1, m2);
172
+ break;
173
+ case 7: /* Line between sides 1-2 and 2-3 */
174
+ x1 = xsect(m1, m2);
175
+ y1 = ysect(m1, m2);
176
+ x2 = xsect(m2, m3);
177
+ y2 = ysect(m2, m3);
178
+ break;
179
+ case 8: /* Line between sides 2-3 and 3-1 */
180
+ x1 = xsect(m2, m3);
181
+ y1 = ysect(m2, m3);
182
+ x2 = xsect(m3, m1);
183
+ y2 = ysect(m3, m1);
184
+ break;
185
+ case 9: /* Line between sides 3-1 and 1-2 */
186
+ x1 = xsect(m3, m1);
187
+ y1 = ysect(m3, m1);
188
+ x2 = xsect(m1, m2);
189
+ y2 = ysect(m1, m2);
190
+ break;
191
+ default:
192
+ break;
193
+ }
194
+
195
+ /* Finally draw the line */
196
+ res.emplace_back(RDGeom::Point2D(x1, y1), RDGeom::Point2D(x2, y2),
197
+ z[k]);
198
+ } /* m */
199
+ } /* k - contour */
200
+ } /* i */
201
+ } /* j */
202
+ }
203
+ } // namespace conrec
@@ -0,0 +1,68 @@
1
+ //
2
+ // Copyright (C) 2004-2006 Rational Discovery LLC
3
+ //
4
+ // @@ All Rights Reserved @@
5
+ // This file is part of the RDKit.
6
+ // The contents are covered by the terms of the BSD license
7
+ // which is included in the file license.txt, found at the root
8
+ // of the RDKit source tree.
9
+ //
10
+
11
+ #include <RDGeneral/export.h>
12
+ #ifndef _RD_POWER_EIGENSOLVER_H
13
+ #define _RD_POWER_EIGENSOLVER_H
14
+
15
+ #include <Numerics/Vector.h>
16
+ #include <Numerics/Matrix.h>
17
+ #include <Numerics/SymmMatrix.h>
18
+
19
+ namespace RDNumeric {
20
+ namespace EigenSolvers {
21
+ //! Compute the \c numEig largest eigenvalues and, optionally, the
22
+ /// corresponding
23
+ //! eigenvectors.
24
+ /*!
25
+
26
+ \param numEig the number of eigenvalues we are interested in
27
+ \param mat symmetric input matrix of dimension N*N
28
+ \param eigenValues Vector used to return the eigenvalues (size = numEig)
29
+ \param eigenVectors Optional matrix used to return the eigenvectors (size =
30
+ N*numEig)
31
+ \param seed Optional values to seed the random value generator used to
32
+ initialize the eigen vectors
33
+ \return a boolean indicating whether or not the calculation converged.
34
+
35
+ <b>Notes:</b>
36
+ - The matrix, \c mat, is changed in this function
37
+
38
+ <b>Algorithm:</b>
39
+
40
+ We use the iterative power method, which works like this:
41
+
42
+ \verbatim
43
+ u = arbitrary unit vector
44
+ tol = 0.001
45
+ currEigVal = 0.0;
46
+ prevEigVal = -1.0e100
47
+ while (abs(currEigVal - prevEigVal) > tol) :
48
+ v = Au
49
+ prevEigVal = currEigVal
50
+ currEigVal = v[i] // where i is the id of the largest absolute component
51
+ u = c*v
52
+ \endverbatim
53
+
54
+
55
+ */
56
+ bool RDKIT_EIGENSOLVERS_EXPORT powerEigenSolver(
57
+ unsigned int numEig, DoubleSymmMatrix &mat, DoubleVector &eigenValues,
58
+ DoubleMatrix *eigenVectors = nullptr, int seed = -1);
59
+ //! \overload
60
+ static inline bool powerEigenSolver(unsigned int numEig, DoubleSymmMatrix &mat,
61
+ DoubleVector &eigenValues,
62
+ DoubleMatrix &eigenVectors, int seed = -1) {
63
+ return powerEigenSolver(numEig, mat, eigenValues, &eigenVectors, seed);
64
+ }
65
+ }; // namespace EigenSolvers
66
+ }; // namespace RDNumeric
67
+
68
+ #endif
@@ -0,0 +1,347 @@
1
+ //
2
+ // Copyright (C) 2004-2006 Rational Discovery LLC
3
+ //
4
+ // @@ All Rights Reserved @@
5
+ // This file is part of the RDKit.
6
+ // The contents are covered by the terms of the BSD license
7
+ // which is included in the file license.txt, found at the root
8
+ // of the RDKit source tree.
9
+ //
10
+ #include <RDGeneral/export.h>
11
+ #ifndef __RD_MATRIX_H__
12
+ #define __RD_MATRIX_H__
13
+
14
+ #include <RDGeneral/Invariant.h>
15
+ #include "Vector.h"
16
+ #include <iostream>
17
+ #include <iomanip>
18
+ #include <cstring>
19
+ #include <boost/smart_ptr.hpp>
20
+
21
+ //#ifndef INVARIANT_SILENT_METHOD
22
+ //#define INVARIANT_SILENT_METHOD
23
+ //#endif
24
+
25
+ namespace RDNumeric {
26
+
27
+ //! A matrix class for general, non-square matrices
28
+ template <class TYPE>
29
+ class Matrix {
30
+ public:
31
+ typedef boost::shared_array<TYPE> DATA_SPTR;
32
+
33
+ //! Initialize with a size.
34
+ Matrix(unsigned int nRows, unsigned int nCols)
35
+ : d_nRows(nRows), d_nCols(nCols), d_dataSize(nRows * nCols) {
36
+ TYPE *data = new TYPE[d_dataSize];
37
+ memset(static_cast<void *>(data), 0, d_dataSize * sizeof(TYPE));
38
+ d_data.reset(data);
39
+ }
40
+
41
+ //! Initialize with a size and default value.
42
+ Matrix(unsigned int nRows, unsigned int nCols, TYPE val)
43
+ : d_nRows(nRows), d_nCols(nCols), d_dataSize(nRows * nCols) {
44
+ TYPE *data = new TYPE[d_dataSize];
45
+ unsigned int i;
46
+ for (i = 0; i < d_dataSize; i++) {
47
+ data[i] = val;
48
+ }
49
+ d_data.reset(data);
50
+ }
51
+
52
+ //! Initialize from a pointer.
53
+ /*!
54
+ <b>NOTE:</b> this does not take ownership of the data,
55
+ if you delete the data externally, this Matrix will be sad.
56
+ */
57
+ Matrix(unsigned int nRows, unsigned int nCols, DATA_SPTR data)
58
+ : d_nRows(nRows), d_nCols(nCols), d_dataSize(nRows * nCols) {
59
+ d_data = data;
60
+ }
61
+
62
+ //! copy constructor
63
+ /*! We make a copy of the other vector's data.
64
+ */
65
+ Matrix(const Matrix<TYPE> &other)
66
+ : d_nRows(other.numRows()),
67
+ d_nCols(other.numCols()),
68
+ d_dataSize(d_nRows * d_nCols) {
69
+ TYPE *data = new TYPE[d_dataSize];
70
+ const TYPE *otherData = other.getData();
71
+ memcpy(static_cast<void *>(data), static_cast<const void *>(otherData),
72
+ d_dataSize * sizeof(TYPE));
73
+ d_data.reset(data);
74
+ }
75
+
76
+ virtual ~Matrix() {}
77
+
78
+ //! returns the number of rows
79
+ inline unsigned int numRows() const { return d_nRows; }
80
+
81
+ //! returns the number of columns
82
+ inline unsigned int numCols() const { return d_nCols; }
83
+
84
+ inline unsigned int getDataSize() const { return d_dataSize; }
85
+
86
+ //! returns a particular element of the matrix
87
+ inline virtual TYPE getVal(unsigned int i, unsigned int j) const {
88
+ PRECONDITION(i < d_nRows, "bad index");
89
+ PRECONDITION(j < d_nCols, "bad index");
90
+ unsigned int id = i * d_nCols + j;
91
+ return d_data[id];
92
+ }
93
+
94
+ //! sets a particular element of the matrix
95
+ inline virtual void setVal(unsigned int i, unsigned int j, TYPE val) {
96
+ PRECONDITION(i < d_nRows, "bad index");
97
+ PRECONDITION(j < d_nCols, "bad index");
98
+ unsigned int id = i * d_nCols + j;
99
+
100
+ d_data[id] = val;
101
+ }
102
+
103
+ //! returns a copy of a row of the matrix
104
+ inline virtual void getRow(unsigned int i, Vector<TYPE> &row) const {
105
+ PRECONDITION(i < d_nRows, "bad index");
106
+ PRECONDITION(d_nCols == row.size(), "");
107
+ unsigned int id = i * d_nCols;
108
+ TYPE *rData = row.getData();
109
+ TYPE *data = d_data.get();
110
+ memcpy(static_cast<void *>(rData), static_cast<void *>(&data[id]),
111
+ d_nCols * sizeof(TYPE));
112
+ }
113
+
114
+ //! returns a copy of a column of the matrix
115
+ inline virtual void getCol(unsigned int i, Vector<TYPE> &col) const {
116
+ PRECONDITION(i < d_nCols, "bad index");
117
+ PRECONDITION(d_nRows == col.size(), "");
118
+ unsigned int j, id;
119
+ TYPE *rData = col.getData();
120
+ TYPE *data = d_data.get();
121
+ for (j = 0; j < d_nRows; j++) {
122
+ id = j * d_nCols + i;
123
+ rData[j] = data[id];
124
+ }
125
+ }
126
+
127
+ //! returns a pointer to our data array
128
+ inline TYPE *getData() { return d_data.get(); }
129
+
130
+ //! returns a const pointer to our data array
131
+ inline const TYPE *getData() const { return d_data.get(); }
132
+
133
+ //! Copy operator.
134
+ /*! We make a copy of the other Matrix's data.
135
+ */
136
+
137
+ Matrix<TYPE> &assign(const Matrix<TYPE> &other) {
138
+ PRECONDITION(d_nRows == other.numRows(),
139
+ "Num rows mismatch in matrix copying");
140
+ PRECONDITION(d_nCols == other.numCols(),
141
+ "Num cols mismatch in matrix copying");
142
+ const TYPE *otherData = other.getData();
143
+ TYPE *data = d_data.get();
144
+ memcpy(static_cast<void *>(data), static_cast<const void *>(otherData),
145
+ d_dataSize * sizeof(TYPE));
146
+ return *this;
147
+ }
148
+
149
+ //! Matrix addition.
150
+ /*! Perform a element by element addition of other Matrix to this Matrix
151
+ */
152
+ virtual Matrix<TYPE> &operator+=(const Matrix<TYPE> &other) {
153
+ PRECONDITION(d_nRows == other.numRows(),
154
+ "Num rows mismatch in matrix addition");
155
+ PRECONDITION(d_nCols == other.numCols(),
156
+ "Num cols mismatch in matrix addition");
157
+ const TYPE *oData = other.getData();
158
+ unsigned int i;
159
+ TYPE *data = d_data.get();
160
+ for (i = 0; i < d_dataSize; i++) {
161
+ data[i] += oData[i];
162
+ }
163
+ return *this;
164
+ }
165
+
166
+ //! Matrix subtraction.
167
+ /*! Perform a element by element subtraction of other Matrix from this Matrix
168
+ */
169
+ virtual Matrix<TYPE> &operator-=(const Matrix<TYPE> &other) {
170
+ PRECONDITION(d_nRows == other.numRows(),
171
+ "Num rows mismatch in matrix addition");
172
+ PRECONDITION(d_nCols == other.numCols(),
173
+ "Num cols mismatch in matrix addition");
174
+ const TYPE *oData = other.getData();
175
+ unsigned int i;
176
+ TYPE *data = d_data.get();
177
+ for (i = 0; i < d_dataSize; i++) {
178
+ data[i] -= oData[i];
179
+ }
180
+ return *this;
181
+ }
182
+
183
+ //! Multiplication by a scalar
184
+ virtual Matrix<TYPE> &operator*=(TYPE scale) {
185
+ unsigned int i;
186
+ TYPE *data = d_data.get();
187
+ for (i = 0; i < d_dataSize; i++) {
188
+ data[i] *= scale;
189
+ }
190
+ return *this;
191
+ }
192
+
193
+ //! division by a scalar
194
+ virtual Matrix<TYPE> &operator/=(TYPE scale) {
195
+ unsigned int i;
196
+ TYPE *data = d_data.get();
197
+ for (i = 0; i < d_dataSize; i++) {
198
+ data[i] /= scale;
199
+ }
200
+ return *this;
201
+ }
202
+
203
+ //! copies the transpose of this Matrix into another, returns the result
204
+ /*!
205
+ \param transpose the Matrix to store the results
206
+
207
+ \return the transpose of this matrix.
208
+ This is just a reference to the argument.
209
+
210
+ */
211
+ virtual Matrix<TYPE> &transpose(Matrix<TYPE> &transpose) const {
212
+ unsigned int tRows = transpose.numRows();
213
+ unsigned int tCols = transpose.numCols();
214
+ PRECONDITION(d_nCols == tRows, "Size mismatch during transposing");
215
+ PRECONDITION(d_nRows == tCols, "Size mismatch during transposing");
216
+ unsigned int i, j;
217
+ unsigned int idA, idAt, idT;
218
+ TYPE *tData = transpose.getData();
219
+ TYPE *data = d_data.get();
220
+ for (i = 0; i < d_nRows; i++) {
221
+ idA = i * d_nCols;
222
+ for (j = 0; j < d_nCols; j++) {
223
+ idAt = idA + j;
224
+ idT = j * tCols + i;
225
+ tData[idT] = data[idAt];
226
+ }
227
+ }
228
+ return transpose;
229
+ }
230
+
231
+ protected:
232
+ Matrix() : d_data() {}
233
+ unsigned int d_nRows{0};
234
+ unsigned int d_nCols{0};
235
+ unsigned int d_dataSize{0};
236
+ DATA_SPTR d_data;
237
+
238
+ private:
239
+ Matrix<TYPE> &operator=(const Matrix<TYPE> &other);
240
+ };
241
+
242
+ //! Matrix multiplication
243
+ /*!
244
+ Multiply a Matrix A with a second Matrix B
245
+ so the result is C = A*B
246
+
247
+ \param A the first Matrix used in the multiplication
248
+ \param B the Matrix by which to multiply
249
+ \param C Matrix to use for the results
250
+
251
+ \return the results of multiplying A by B.
252
+ This is just a reference to C.
253
+ */
254
+ template <class TYPE>
255
+ Matrix<TYPE> &multiply(const Matrix<TYPE> &A, const Matrix<TYPE> &B,
256
+ Matrix<TYPE> &C) {
257
+ unsigned int aRows = A.numRows();
258
+ unsigned int aCols = A.numCols();
259
+ unsigned int cRows = C.numRows();
260
+ unsigned int cCols = C.numCols();
261
+ unsigned int bRows = B.numRows();
262
+ unsigned int bCols = B.numCols();
263
+ CHECK_INVARIANT(aCols == bRows, "Size mismatch during multiplication");
264
+ CHECK_INVARIANT(aRows == cRows, "Size mismatch during multiplication");
265
+ CHECK_INVARIANT(bCols == cCols, "Size mismatch during multiplication");
266
+
267
+ // we have the sizes check do do the multiplication
268
+ TYPE *cData = C.getData();
269
+ const TYPE *bData = B.getData();
270
+ const TYPE *aData = A.getData();
271
+ unsigned int i, j, k;
272
+ unsigned int idA, idAt, idB, idC, idCt;
273
+ for (i = 0; i < aRows; i++) {
274
+ idC = i * cCols;
275
+ idA = i * aCols;
276
+ for (j = 0; j < cCols; j++) {
277
+ idCt = idC + j;
278
+ cData[idCt] = (TYPE)0.0;
279
+ for (k = 0; k < aCols; k++) {
280
+ idAt = idA + k;
281
+ idB = k * bCols + j;
282
+ cData[idCt] += (aData[idAt] * bData[idB]);
283
+ }
284
+ }
285
+ }
286
+ return C;
287
+ };
288
+
289
+ //! Matrix-Vector multiplication
290
+ /*!
291
+ Multiply a Matrix A with a Vector x
292
+ so the result is y = A*x
293
+
294
+ \param A the matrix used in the multiplication
295
+ \param x the Vector by which to multiply
296
+ \param y Vector to use for the results
297
+
298
+ \return the results of multiplying x by this
299
+ This is just a reference to y.
300
+ */
301
+ template <class TYPE>
302
+ Vector<TYPE> &multiply(const Matrix<TYPE> &A, const Vector<TYPE> &x,
303
+ Vector<TYPE> &y) {
304
+ unsigned int aRows = A.numRows();
305
+ unsigned int aCols = A.numCols();
306
+ unsigned int xSiz = x.size();
307
+ unsigned int ySiz = y.size();
308
+ CHECK_INVARIANT(aCols == xSiz, "Size mismatch during multiplication");
309
+ CHECK_INVARIANT(aRows == ySiz, "Size mismatch during multiplication");
310
+ unsigned int i, j;
311
+ unsigned int idA, idAt;
312
+ const TYPE *xData = x.getData();
313
+ const TYPE *aData = A.getData();
314
+ TYPE *yData = y.getData();
315
+ for (i = 0; i < aRows; i++) {
316
+ idA = i * aCols;
317
+ yData[i] = (TYPE)(0.0);
318
+ for (j = 0; j < aCols; j++) {
319
+ idAt = idA + j;
320
+ yData[i] += (aData[idAt] * xData[j]);
321
+ }
322
+ }
323
+ return y;
324
+ };
325
+
326
+ typedef Matrix<double> DoubleMatrix;
327
+ }; // namespace RDNumeric
328
+
329
+ //! ostream operator for Matrix's
330
+ template <class TYPE>
331
+ std::ostream &operator<<(std::ostream &target,
332
+ const RDNumeric::Matrix<TYPE> &mat) {
333
+ unsigned int nr = mat.numRows();
334
+ unsigned int nc = mat.numCols();
335
+ target << "Rows: " << mat.numRows() << " Columns: " << mat.numCols() << "\n";
336
+
337
+ unsigned int i, j;
338
+ for (i = 0; i < nr; i++) {
339
+ for (j = 0; j < nc; j++) {
340
+ target << std::setw(7) << std::setprecision(3) << mat.getVal(i, j);
341
+ }
342
+ target << "\n";
343
+ }
344
+ return target;
345
+ }
346
+
347
+ #endif