Index: mkjer/Damkjer_Research.sln
===================================================================
--- Damkjer/Damkjer_Research.sln	(revision 13)
+++ 	(revision )
@@ -1,204 +1,0 @@
-﻿
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Util", "Util", "{27DB8DBD-623B-4593-80F3-9F25F07BBA1A}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SpatialIndexing", "SpatialIndexing", "{3411130C-FC3A-47AD-9277-EEA9BDA15D28}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3093F2E8-7C3B-4B90-8E92-C0C235FB979A}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{CE6D9671-3679-4D3C-9665-ED738338CEDD}"
-	ProjectSection(SolutionItems) = preProject
-		config\doxyfile.txt = config\doxyfile.txt
-		config\doxyfilter.pl = config\doxyfilter.pl
-		config\m2cpp.pl = config\m2cpp.pl
-	EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{5A0EE001-12C0-444E-9DEE-7C546B3C7256}"
-	ProjectSection(SolutionItems) = preProject
-		Top.dox = Top.dox
-	EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{A1B0D6A4-C217-4E4D-8832-EB81D59F2283}"
-	ProjectSection(SolutionItems) = preProject
-		Util.bib = Util.bib
-		Util\Util.dox = Util\Util.dox
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_Exception", "Util\Exception\test\TestException.vcxproj", "{75486221-5693-30A9-18E4-ECC307F92A68}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_Metrics", "Util\SpatialIndexing\Metrics\test\TestMetrics.vcxproj", "{FF08AA20-7D15-AEAB-9915-1FA343E8C993}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_TestCase", "Util\UnitTest\test\TestUnitTest.vcxproj", "{72785A79-5BD2-AAE4-6386-93F74C7E248D}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_VpTree", "Util\SpatialIndexing\VpTree\test\TestVpTree.vcxproj", "{84624C89-966E-4948-1393-64F0D0965AC0}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Util", "Util\Util.vcxproj", "{20FE2624-C64F-D61A-BD8F-1725A8E68A42}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VpTreeAPI", "Util\MATLAB\VpTreeAPI\VpTreeAPI.vcxproj", "{60D16805-4012-4602-742C-4578A6C2DE6E}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_SplayTree", "Util\Dictionaries\test\TestSplayTree.vcxproj", "{344E49A2-518C-23E5-9358-09928FD326E3}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SplayTreeAPI", "Util\MATLAB\SplayTreeAPI\SplayTreeAPI.vcxproj", "{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}"
-EndProject
-Global
-	GlobalSection(TestCaseManagementSettings) = postSolution
-		CategoryFile = Damkjer_Research.vsmdi
-	EndGlobalSection
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Win32 = Debug|Win32
-		Debug|x64 = Debug|x64
-		DebugOMP|Win32 = DebugOMP|Win32
-		DebugOMP|x64 = DebugOMP|x64
-		OpenMP|Win32 = OpenMP|Win32
-		OpenMP|x64 = OpenMP|x64
-		Release|Win32 = Release|Win32
-		Release|x64 = Release|x64
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{75486221-5693-30A9-18E4-ECC307F92A68}.Debug|Win32.ActiveCfg = Debug|Win32
-		{75486221-5693-30A9-18E4-ECC307F92A68}.Debug|Win32.Build.0 = Debug|Win32
-		{75486221-5693-30A9-18E4-ECC307F92A68}.Debug|x64.ActiveCfg = Debug|x64
-		{75486221-5693-30A9-18E4-ECC307F92A68}.Debug|x64.Build.0 = Debug|x64
-		{75486221-5693-30A9-18E4-ECC307F92A68}.DebugOMP|Win32.ActiveCfg = DebugOMP|Win32
-		{75486221-5693-30A9-18E4-ECC307F92A68}.DebugOMP|Win32.Build.0 = DebugOMP|Win32
-		{75486221-5693-30A9-18E4-ECC307F92A68}.DebugOMP|x64.ActiveCfg = DebugOMP|x64
-		{75486221-5693-30A9-18E4-ECC307F92A68}.DebugOMP|x64.Build.0 = DebugOMP|x64
-		{75486221-5693-30A9-18E4-ECC307F92A68}.OpenMP|Win32.ActiveCfg = OpenMP|Win32
-		{75486221-5693-30A9-18E4-ECC307F92A68}.OpenMP|Win32.Build.0 = OpenMP|Win32
-		{75486221-5693-30A9-18E4-ECC307F92A68}.OpenMP|x64.ActiveCfg = OpenMP|x64
-		{75486221-5693-30A9-18E4-ECC307F92A68}.OpenMP|x64.Build.0 = OpenMP|x64
-		{75486221-5693-30A9-18E4-ECC307F92A68}.Release|Win32.ActiveCfg = Release|Win32
-		{75486221-5693-30A9-18E4-ECC307F92A68}.Release|Win32.Build.0 = Release|Win32
-		{75486221-5693-30A9-18E4-ECC307F92A68}.Release|x64.ActiveCfg = Release|x64
-		{75486221-5693-30A9-18E4-ECC307F92A68}.Release|x64.Build.0 = Release|x64
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.Debug|Win32.ActiveCfg = Debug|Win32
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.Debug|Win32.Build.0 = Debug|Win32
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.Debug|x64.ActiveCfg = Debug|x64
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.Debug|x64.Build.0 = Debug|x64
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.DebugOMP|Win32.ActiveCfg = DebugOMP|Win32
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.DebugOMP|Win32.Build.0 = DebugOMP|Win32
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.DebugOMP|x64.ActiveCfg = DebugOMP|x64
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.DebugOMP|x64.Build.0 = DebugOMP|x64
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.OpenMP|Win32.ActiveCfg = OpenMP|Win32
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.OpenMP|Win32.Build.0 = OpenMP|Win32
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.OpenMP|x64.ActiveCfg = OpenMP|x64
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.OpenMP|x64.Build.0 = OpenMP|x64
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.Release|Win32.ActiveCfg = Release|Win32
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.Release|Win32.Build.0 = Release|Win32
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.Release|x64.ActiveCfg = Release|x64
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.Release|x64.Build.0 = Release|x64
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.Debug|Win32.ActiveCfg = Debug|Win32
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.Debug|Win32.Build.0 = Debug|Win32
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.Debug|x64.ActiveCfg = Debug|x64
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.Debug|x64.Build.0 = Debug|x64
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.DebugOMP|Win32.ActiveCfg = DebugOMP|Win32
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.DebugOMP|Win32.Build.0 = DebugOMP|Win32
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.DebugOMP|x64.ActiveCfg = DebugOMP|x64
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.DebugOMP|x64.Build.0 = DebugOMP|x64
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.OpenMP|Win32.ActiveCfg = OpenMP|Win32
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.OpenMP|Win32.Build.0 = OpenMP|Win32
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.OpenMP|x64.ActiveCfg = OpenMP|x64
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.OpenMP|x64.Build.0 = OpenMP|x64
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.Release|Win32.ActiveCfg = Release|Win32
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.Release|Win32.Build.0 = Release|Win32
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.Release|x64.ActiveCfg = Release|x64
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D}.Release|x64.Build.0 = Release|x64
-		{84624C89-966E-4948-1393-64F0D0965AC0}.Debug|Win32.ActiveCfg = Debug|Win32
-		{84624C89-966E-4948-1393-64F0D0965AC0}.Debug|Win32.Build.0 = Debug|Win32
-		{84624C89-966E-4948-1393-64F0D0965AC0}.Debug|x64.ActiveCfg = Debug|x64
-		{84624C89-966E-4948-1393-64F0D0965AC0}.Debug|x64.Build.0 = Debug|x64
-		{84624C89-966E-4948-1393-64F0D0965AC0}.DebugOMP|Win32.ActiveCfg = DebugOMP|Win32
-		{84624C89-966E-4948-1393-64F0D0965AC0}.DebugOMP|Win32.Build.0 = DebugOMP|Win32
-		{84624C89-966E-4948-1393-64F0D0965AC0}.DebugOMP|x64.ActiveCfg = DebugOMP|x64
-		{84624C89-966E-4948-1393-64F0D0965AC0}.DebugOMP|x64.Build.0 = DebugOMP|x64
-		{84624C89-966E-4948-1393-64F0D0965AC0}.OpenMP|Win32.ActiveCfg = OpenMP|Win32
-		{84624C89-966E-4948-1393-64F0D0965AC0}.OpenMP|Win32.Build.0 = OpenMP|Win32
-		{84624C89-966E-4948-1393-64F0D0965AC0}.OpenMP|x64.ActiveCfg = OpenMP|x64
-		{84624C89-966E-4948-1393-64F0D0965AC0}.OpenMP|x64.Build.0 = OpenMP|x64
-		{84624C89-966E-4948-1393-64F0D0965AC0}.Release|Win32.ActiveCfg = Release|Win32
-		{84624C89-966E-4948-1393-64F0D0965AC0}.Release|Win32.Build.0 = Release|Win32
-		{84624C89-966E-4948-1393-64F0D0965AC0}.Release|x64.ActiveCfg = Release|x64
-		{84624C89-966E-4948-1393-64F0D0965AC0}.Release|x64.Build.0 = Release|x64
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.Debug|Win32.ActiveCfg = Debug|Win32
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.Debug|Win32.Build.0 = Debug|Win32
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.Debug|x64.ActiveCfg = Debug|x64
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.Debug|x64.Build.0 = Debug|x64
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.DebugOMP|Win32.ActiveCfg = DebugOMP|Win32
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.DebugOMP|Win32.Build.0 = DebugOMP|Win32
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.DebugOMP|x64.ActiveCfg = DebugOMP|x64
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.DebugOMP|x64.Build.0 = DebugOMP|x64
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.OpenMP|Win32.ActiveCfg = OpenMP|Win32
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.OpenMP|Win32.Build.0 = OpenMP|Win32
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.OpenMP|x64.ActiveCfg = OpenMP|x64
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.OpenMP|x64.Build.0 = OpenMP|x64
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.Release|Win32.ActiveCfg = Release|Win32
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.Release|Win32.Build.0 = Release|Win32
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.Release|x64.ActiveCfg = Release|x64
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42}.Release|x64.Build.0 = Release|x64
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.Debug|Win32.ActiveCfg = Debug|Win32
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.Debug|Win32.Build.0 = Debug|Win32
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.Debug|x64.ActiveCfg = Debug|x64
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.Debug|x64.Build.0 = Debug|x64
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.DebugOMP|Win32.ActiveCfg = DebugOMP|Win32
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.DebugOMP|Win32.Build.0 = DebugOMP|Win32
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.DebugOMP|x64.ActiveCfg = DebugOMP|x64
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.DebugOMP|x64.Build.0 = DebugOMP|x64
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.OpenMP|Win32.ActiveCfg = OpenMP|Win32
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.OpenMP|Win32.Build.0 = OpenMP|Win32
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.OpenMP|x64.ActiveCfg = OpenMP|x64
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.OpenMP|x64.Build.0 = OpenMP|x64
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.Release|Win32.ActiveCfg = Release|Win32
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.Release|Win32.Build.0 = Release|Win32
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.Release|x64.ActiveCfg = Release|x64
-		{60D16805-4012-4602-742C-4578A6C2DE6E}.Release|x64.Build.0 = Release|x64
-		{344E49A2-518C-23E5-9358-09928FD326E3}.Debug|Win32.ActiveCfg = Debug|Win32
-		{344E49A2-518C-23E5-9358-09928FD326E3}.Debug|Win32.Build.0 = Debug|Win32
-		{344E49A2-518C-23E5-9358-09928FD326E3}.Debug|x64.ActiveCfg = Debug|x64
-		{344E49A2-518C-23E5-9358-09928FD326E3}.Debug|x64.Build.0 = Debug|x64
-		{344E49A2-518C-23E5-9358-09928FD326E3}.DebugOMP|Win32.ActiveCfg = DebugOMP|Win32
-		{344E49A2-518C-23E5-9358-09928FD326E3}.DebugOMP|Win32.Build.0 = DebugOMP|Win32
-		{344E49A2-518C-23E5-9358-09928FD326E3}.DebugOMP|x64.ActiveCfg = DebugOMP|x64
-		{344E49A2-518C-23E5-9358-09928FD326E3}.DebugOMP|x64.Build.0 = DebugOMP|x64
-		{344E49A2-518C-23E5-9358-09928FD326E3}.OpenMP|Win32.ActiveCfg = OpenMP|Win32
-		{344E49A2-518C-23E5-9358-09928FD326E3}.OpenMP|Win32.Build.0 = OpenMP|Win32
-		{344E49A2-518C-23E5-9358-09928FD326E3}.OpenMP|x64.ActiveCfg = OpenMP|x64
-		{344E49A2-518C-23E5-9358-09928FD326E3}.OpenMP|x64.Build.0 = OpenMP|x64
-		{344E49A2-518C-23E5-9358-09928FD326E3}.Release|Win32.ActiveCfg = Release|Win32
-		{344E49A2-518C-23E5-9358-09928FD326E3}.Release|Win32.Build.0 = Release|Win32
-		{344E49A2-518C-23E5-9358-09928FD326E3}.Release|x64.ActiveCfg = Release|x64
-		{344E49A2-518C-23E5-9358-09928FD326E3}.Release|x64.Build.0 = Release|x64
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.Debug|Win32.ActiveCfg = Debug|Win32
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.Debug|Win32.Build.0 = Debug|Win32
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.Debug|x64.ActiveCfg = Debug|x64
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.Debug|x64.Build.0 = Debug|x64
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.DebugOMP|Win32.ActiveCfg = DebugOMP|Win32
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.DebugOMP|Win32.Build.0 = DebugOMP|Win32
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.DebugOMP|x64.ActiveCfg = DebugOMP|x64
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.DebugOMP|x64.Build.0 = DebugOMP|x64
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.OpenMP|Win32.ActiveCfg = OpenMP|Win32
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.OpenMP|Win32.Build.0 = OpenMP|Win32
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.OpenMP|x64.ActiveCfg = OpenMP|x64
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.OpenMP|x64.Build.0 = OpenMP|x64
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.Release|Win32.ActiveCfg = Release|Win32
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.Release|Win32.Build.0 = Release|Win32
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.Release|x64.ActiveCfg = Release|x64
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2}.Release|x64.Build.0 = Release|x64
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-	GlobalSection(NestedProjects) = preSolution
-		{3411130C-FC3A-47AD-9277-EEA9BDA15D28} = {27DB8DBD-623B-4593-80F3-9F25F07BBA1A}
-		{3093F2E8-7C3B-4B90-8E92-C0C235FB979A} = {27DB8DBD-623B-4593-80F3-9F25F07BBA1A}
-		{A1B0D6A4-C217-4E4D-8832-EB81D59F2283} = {27DB8DBD-623B-4593-80F3-9F25F07BBA1A}
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42} = {27DB8DBD-623B-4593-80F3-9F25F07BBA1A}
-		{60D16805-4012-4602-742C-4578A6C2DE6E} = {3411130C-FC3A-47AD-9277-EEA9BDA15D28}
-		{3C2B4717-4B1D-6843-E0DD-80DFD7B0ECD2} = {3411130C-FC3A-47AD-9277-EEA9BDA15D28}
-		{75486221-5693-30A9-18E4-ECC307F92A68} = {3093F2E8-7C3B-4B90-8E92-C0C235FB979A}
-		{FF08AA20-7D15-AEAB-9915-1FA343E8C993} = {3093F2E8-7C3B-4B90-8E92-C0C235FB979A}
-		{72785A79-5BD2-AAE4-6386-93F74C7E248D} = {3093F2E8-7C3B-4B90-8E92-C0C235FB979A}
-		{84624C89-966E-4948-1393-64F0D0965AC0} = {3093F2E8-7C3B-4B90-8E92-C0C235FB979A}
-		{344E49A2-518C-23E5-9358-09928FD326E3} = {3093F2E8-7C3B-4B90-8E92-C0C235FB979A}
-	EndGlobalSection
-EndGlobal
Index: Damkjer/ImageProcessing/BB_Inpainting/bb_diffuse.m
===================================================================
--- Damkjer/ImageProcessing/BB_Inpainting/bb_diffuse.m	(revision 4)
+++ Damkjer/ImageProcessing/BB_Inpainting/bb_diffuse.m	(revision 0)
@@ -1,24 +1,23 @@
-function O=bb_diffuse(I,R,k,t,idxs,mask)
+function O=bb_diffuse(I,R,k,t,idxs)
 
 H=fspecial('gaussian');
 I=imfilter(I,H,'replicate');
+[Ix, Iy] = grad(I);
+[Ixx,Ixy,Iyy] = fdiff2(I);
+Ix2 = Ix.^2;
+Iy2 = Iy.^2;
+norm2 = Ix2+Iy2+1e-10;
 
-   [Ix, Iy] = grad(I);
-   [Ixx,Ixy,Iyy] = fdiff2(I);
-   Ix2 = Ix.^2;
-   Iy2 = Iy.^2;
-   norm2 = Ix2+Iy2+1e-10;
-   
-   g=(1./(1+k.*norm2));
-   
-   num=(Ix2.*Iyy-2.*Ix.*Iy.*Ixy+Iy2.*Ixx);
-   sub=(1-g).*(I-R);
-   
-   diff = (g).*(num./norm2)-sub;
-   
-   O=min(max(0,I+t.*diff),1);
-   
+g=(1./(1+k.*norm2));
+
+num=(Ix2.*Iyy-2.*Ix.*Iy.*Ixy+Iy2.*Ixx);
+sub=(1-g).*(I-R);
+
+diff = (g).*(num./norm2)-sub;
+
+O=min(max(0,I+t.*diff),1);
+
 if (nargin<5)
-   return
+    return
 end
 
@@ -28,10 +27,4 @@
 Iy2 = Iy.^2;
 norm2 = Ix2 + Iy2 + 1e-10;
-
-O=I;
-
-%diff=Ix2.*Iyy-2.*Ix.*Iy.*Ixy+Iy2.*Ixx./norm2;
-%O(mask)=I(mask) + t * diff;
-
 for idx=1:size(idxs,1)
     x=idxs(idx,2);
Index: Damkjer/ImageProcessing/BB_Inpainting/bb_inpaint.m
===================================================================
--- Damkjer/ImageProcessing/BB_Inpainting/bb_inpaint.m	(revision 4)
+++ Damkjer/ImageProcessing/BB_Inpainting/bb_inpaint.m	(revision 0)
@@ -5,6 +5,6 @@
 % Parse inputs
 p = inputParser;
-defaultPaintSteps = 15;%10
-defaultSmoothSteps = 2;%10
+defaultPaintSteps = 10;
+defaultSmoothSteps = 10;
 defaultPaintTimeSlice = 0.02;
 defaultSmoothTimeSlice = 0.2;
@@ -32,42 +32,29 @@
 %Determine Omega (the inpaint region)
 mask=zeros(size(I));
-mask=isnan(I);
+mask(:)=isnan(I(:));
 
-%P=I/255;
-%P=I;
-%P(mask)=0.5;
-P=bscb_preproc(I);
+P=I/255;
+P(isnan(I))=0.5;
 
 J=P;
 R=P;
 
-[r,c]=ind2sub(size(I),find(mask(:)));
-mask2=[r,c];
-
-size(mask2)
-
-h = waitbar(0,'Pre-Processing...');
+[r,c]=ind2sub(size(I),find(mask));
+mask=[r,c];
 
 % Pre-processing: the whole image undergoes anisotropic diffusion smoothing
 P=bb_diffuse(P,R,k,ts);
 
-close(h);
-
 h = waitbar(0,'In Painting...');
 
 for pass=1:T;
-
-   for i=1:A
-      % Equation (8)
-        [Ix,Iy] = grad(P, mask2);
-        [Ixxx,Ixxy,Ixyy,Iyyy]=fdiff3(P,mask2);
-
-%        It=Ix.*(Ixxy+Iyyy)-Iy.*(Ixxx+Ixyy);
-%        P(mask)=min(max(0,P(mask)+ti.*It),1);
-
+    for i=1:A
+        % Equation (8)
+        [Ix,Iy] = grad(P, mask);
+        [Ixxx,Ixxy,Ixyy,Iyyy]=fdiff3(P,mask);
         
-        for idx=1:size(mask2,1)
-            x=mask2(idx,2);
-            y=mask2(idx,1);
+        for idx=1:size(mask,1)
+            x=mask(idx,2);
+            y=mask(idx,1);
 
             It=Ix(idx)*(Ixxy(idx)+Iyyy(idx))-Iy(idx)*(Ixxx(idx)+Ixyy(idx));
@@ -78,8 +65,8 @@
     
     for j = 1:B
-       P=bb_diffuse(P,R,k,ts,mask2,mask);
+        P=bb_diffuse(P,R,k,ts,mask);
     end
     
-    J(mask)=P(mask);
+    J(isnan(I))=P(isnan(I));
     
     if (mod(pass,10) == 0||pass==1||pass==T)
Index: Damkjer/ImageProcessing/BSCB_Inpainting/bscb_inpaint.m
===================================================================
--- Damkjer/ImageProcessing/BSCB_Inpainting/bscb_inpaint.m	(revision 4)
+++ Damkjer/ImageProcessing/BSCB_Inpainting/bscb_inpaint.m	(revision 0)
@@ -1,16 +1,5 @@
-% [OUT]=BSCB_INPAINT(IN,...) Bartalmio et al image inpainting.
-%   Performs image in-painting as described by Bertlamio, Sapiro, Caselles, and 
-%   Ballester (2000).
-%
-%   Copyright 2012 Kristian L. Damkjer
-%
-%   Software History:
-%      2012-AUG-29   K. Damkjer
-%         Initial Coding.
-%      2013-FEB-04   K. Damkjer
-%         Updated to remove mis-interprestation of paper and add pre-processing
-%         step.
-%
 function J=bscb_inpaint(I,varargin)
+% BSCB_INPAINT: in-paints over nans in an matrix
+% usage: B=BSCB_INPAINT(A)          % default method
 
 % Parse inputs
@@ -18,6 +7,6 @@
 defaultPaintSteps = 15;
 defaultSmoothSteps = 2;
-defaultTimeSlice = 0.2;
-defaultIters = 300;
+defaultTimeSlice = 0.1;
+defaultIters = 3000;
 
 addRequired(p, 'I', @isfloat);
@@ -39,8 +28,6 @@
 mask(:)=isnan(I(:));
 
-%P=I;
-%P(isnan(I))=0.5;
-
-P=bscb_preproc(I);
+P=I/255;
+P(isnan(I))=0.5;
 
 J=P;
@@ -109,10 +96,10 @@
                 It = beta*sqrt(mxb^2+mxf^2+myb^2+myf^2);
 
-%                mxb = max(0,Ixb(idx));
-%                mxf = min(0,Ixf(idx));
-%                myb = max(0,Iyb(idx));
-%                myf = min(0,Iyf(idx));
+                mxb = max(0,Ixb(idx));
+                mxf = min(0,Ixf(idx));
+                myb = max(0,Iyb(idx));
+                myf = min(0,Iyf(idx));
                 
-%                It = 0.5*(It + (-beta)*sqrt(mxb^2+mxf^2+myb^2+myf^2));
+                It = 0.5*(It + (-beta)*sqrt(mxb^2+mxf^2+myb^2+myf^2));
             else
                 mxb = max(0,Ixb(idx));
@@ -123,10 +110,10 @@
                 It = beta*sqrt(mxb^2+mxf^2+myb^2+myf^2);
 
-%                mxb = min(0,Ixb(idx));
-%                mxf = max(0,Ixf(idx));
-%                myb = min(0,Iyb(idx));
-%                myf = max(0,Iyf(idx));
+                mxb = min(0,Ixb(idx));
+                mxf = max(0,Ixf(idx));
+                myb = min(0,Iyb(idx));
+                myf = max(0,Iyf(idx));
 
-%                It = 0.5*(It + (-beta)*sqrt(mxb^2+mxf^2+myb^2+myf^2));
+                It = 0.5*(It + (-beta)*sqrt(mxb^2+mxf^2+myb^2+myf^2));
 
             end
@@ -146,4 +133,5 @@
 %             end
             
+%             P(y,x)=min(max(0,P(y,x)+t*si*sqrt(si*It)),1);
             P(y,x)=min(max(0,P(y,x)+t*si*sqrt(sqrt(si*It))),1);
             
@@ -151,5 +139,5 @@
             % often it failed to propagate information into the inpainting
             % domain.
-%             P(y,x)=min(max(0,P(y,x)+t*It),1);
+%             P(y,x)=min(max(0,P(y,x)+t*0.5*It),1);
         end
     end
Index: mkjer/ImageProcessing/BSCB_Inpainting/bscb_preproc.m
===================================================================
--- Damkjer/ImageProcessing/BSCB_Inpainting/bscb_preproc.m	(revision 4)
+++ 	(revision )
@@ -1,35 +1,0 @@
-% [OUT]=BSCB_PREPROC(IN,...) Pre-processing for BSCB in-painting.
-%
-%   Copyright 2012 Kristian L. Damkjer
-%
-%   Software History:
-%      2013-FEB-04   K. Damkjer
-%         Initial Coding.
-%
-function J=bscb_preproc(Image,varargin)
-
-% Parse inputs
-p = inputParser;
-
-addRequired(p, 'Image', @isfloat);
-
-% Establish default parameters
-parse(p,Image,varargin{:});
-Image=p.Results.Image;
-
-J=Image;
-
-%Determine Omega (the inpaint region)
-mask=zeros(size(J));
-mask(isnan(J))=1;
-labels=bwlabel(mask,8);
-
-regions=max(max(labels));
-
-for region=1:regions
-   roi=(labels==region);
-   del=bwmorph(roi,'dilate',1);
-   avg=nanmean(Image(del==1));
-   std=nanstd(Image(del==1));
-   J(roi==1)=avg+std.*randn(size(J(roi==1)));
-end
Index: Damkjer/ImageProcessing/Common/fdiff2.m
===================================================================
--- Damkjer/ImageProcessing/Common/fdiff2.m	(revision 4)
+++ Damkjer/ImageProcessing/Common/fdiff2.m	(revision 0)
@@ -1,20 +1,5 @@
-%FDIFF3 Numerical Second Differential.
-%   [FXX,FXY,FYY] = FDIFF2(F) returns the numerical second partial derivative of
-%   the matrix F. The spacing between points in each direction is assumed to be
-%   one.
-%
-%   [FXX,FXY,FYY] = FDIFF3(F,IDXS), where IDXS is a 2-D array, computes
-%   numerical third partial derivative at the locations specified by IDXS.
-%
-%   Copyright 2012 Kristian L. Damkjer
-%
-%   Software History:
-%      2012-AUG-29   K. Damkjer
-%         Initial Coding.
-%      2013-FEB-04   K. Damkjer
-%         Updated output sizes or indexed case.
-%
-
 function [Oxx,Oxy,Oyy] = fdiff2( I,idxs )
+%FDIFF2 Summary of this function goes here
+%   Detailed explanation goes here
 
 if (nargin<2)
@@ -49,7 +34,7 @@
     Oyy=(Icp-2*I+Icn);
 else
-    Oxx = zeros(size(idxs,1),1);
-    Oxy = zeros(size(idxs,1),1);
-    Oyy = zeros(size(idxs,1),1);
+    Oxx = zeros(size(idxs));
+    Oxy = zeros(size(idxs));
+    Oyy = zeros(size(idxs));
 
     for idx=1:size(idxs,1)
Index: Damkjer/ImageProcessing/Common/fdiff3.m
===================================================================
--- Damkjer/ImageProcessing/Common/fdiff3.m	(revision 4)
+++ Damkjer/ImageProcessing/Common/fdiff3.m	(revision 0)
@@ -1,20 +1,5 @@
-%FDIFF3 Numerical Third Partial.
-%   [FXXX,FXXY,FXYY,FYYY] = FDIFF3(F) returns the numerical third partial
-%   derivative of the matrix F. The spacing between points in each direction is
-%   assumed to be one.
-%
-%   [FXXX,FXXY,FXYY,FYYY] = FDIFF3(F,IDXS), where IDXS is a 2-D array, computes
-%   numerical third partial derivative at the locations specified by IDXS.
-%
-%   Copyright 2012 Kristian L. Damkjer
-%
-%   Software History:
-%      2012-AUG-29   K. Damkjer
-%         Initial Coding.
-%      2013-FEB-04   K. Damkjer
-%         Updated output sizes or indexed case.
-%
-
 function [Oxxx,Oxxy,Oxyy,Oyyy] = fdiff3( I,idxs )
+%FDIFF3 Summary of this function goes here
+%   Detailed explanation goes here
 
 if (nargin<2)
@@ -51,8 +36,8 @@
     Oyyy=0.5.*(-IcP+2.*Icp-2.*Icn+IcN);
 else
-    Oxxx = zeros(size(idxs,1),1);
-    Oxxy = zeros(size(idxs,1),1);
-    Oxyy = zeros(size(idxs,1),1);
-    Oyyy = zeros(size(idxs,1),1);
+    Oxxx = zeros(size(idxs));
+    Oxxy = zeros(size(idxs));
+    Oxyy = zeros(size(idxs));
+    Oyyy = zeros(size(idxs));
 
     for idx=1:size(idxs,1)
Index: Damkjer/ImageProcessing/Common/grad.m
===================================================================
--- Damkjer/ImageProcessing/Common/grad.m	(revision 4)
+++ Damkjer/ImageProcessing/Common/grad.m	(revision 0)
@@ -1,3 +1,4 @@
-%GRAD Numerical Gradient.
+function [Ox,Oy]=grad(I,idxs)
+%GRAD Gradient.
 %   [FX,FY] = GRAD(F) returns the numerical central gradient of the
 %   matrix F. FX corresponds to dF/dx, the differences in x (horizontal) 
@@ -12,21 +13,12 @@
 %   dimension of F, going across columns.  The second output FY is always
 %   the gradient along the 1st dimension of F, going across rows.
-%
+
 %   Copyright 2012 Kristian L. Damkjer
-%
-%   Software History:
-%      2012-AUG-29   K. Damkjer
-%         Initial Coding.
-%      2013-FEB-04   K. Damkjer
-%         Updated output sizes or indexed case.
-%
-
-function [Ox,Oy]=grad(I,idxs)
 
 if (nargin<2)
     [Ox,Oy]=gradient(I);
 else
-    Ox=zeros(size(idxs,1),1);
-    Oy=zeros(size(idxs,1),1);
+    Ox=zeros(size(idxs));
+    Oy=zeros(size(idxs));
 
     for idx=1:size(idxs,1)
Index: Damkjer/ImageProcessing/Common/isophote.m
===================================================================
--- Damkjer/ImageProcessing/Common/isophote.m	(revision 4)
+++ Damkjer/ImageProcessing/Common/isophote.m	(revision 0)
@@ -1,17 +1,2 @@
-%ISOPHOTE Compute isophote directions.
-%   [NX,NY] = ISOPHOTE(F) returns the estimate of the isophote direction as the
-%   direction perpendicular to gradient. Orientation arbitrarily selected as CW
-%   rotation of gradient (alternative would be CCW rotation of gradient).
-%
-%   Copyright 2012 Kristian L. Damkjer
-%
-%   Software History:
-%      2012-AUG-29   K. Damkjer
-%         Initial Coding.
-%      2013-FEB-04   K. Damkjer
-%         Updated to remove normalization to improve convergence and stability.
-%         Should add an option to enable and disable normalizing.
-%
-
 function [Ox,Oy]=isophote(Ix,Iy)
 
@@ -20,6 +5,5 @@
 
 for idx=1:length(Ix)
-%    M=sqrt(Ix(idx)^2+Iy(idx)^2+1e-6);
-    M=1;
+    M=sqrt(Ix(idx)^2+Iy(idx)^2+1e-6);
 
     Ox(idx) = -Iy(idx) / M;
Index: Damkjer/PointProcessing/Colorize/normcolor.m
===================================================================
--- Damkjer/PointProcessing/Colorize/normcolor.m	(revision 3)
+++ Damkjer/PointProcessing/Colorize/normcolor.m	(revision 0)
@@ -3,9 +3,4 @@
 %
 % Color points by surface normal estimate orientation.
-%
-% Software History:
-%    2013-JAN-29  Damkjer, K.
-%       Updated Error Statement to reflect appropriate package.
-%
 function colors=normcolor(QUERIES, DATABASE, varargin)
 
@@ -63,5 +58,7 @@
 
       [V,D]=eig(covs{nbr});
+      
       [~,index]=min(abs(diag(D)));
+
       norms(:,elem+nbr-1)=abs(V(:,index));
 %       norms(:,elem+nbr-1)=abs(V(:,dimensions));
@@ -121,7 +118,7 @@
 
    if isempty(iProperty)
-      error('Damkjer:InvalidProperty', 'Invalid Property');
+      error('psfConv:InvalidProperty', 'Invalid Property');
    elseif length(iProperty) > 1
-      error('Damkjer:AmbiguousProperty', ...
+      error('psfConv:AmbiguousProperty', ...
             'Supplied shortened property name is ambiguous');
    end
@@ -147,5 +144,5 @@
             userParams.radius = value;
          else
-            error('Damkjer:InvalidPointWeights', ...
+            error('psfConv:InvalidPointWeights', ...
                   'Radius must be a real valued positive scalar');
          end
Index: mkjer/PointProcessing/SpatialAnalyzer/nbrspanalyze.m
===================================================================
--- Damkjer/PointProcessing/SpatialAnalyzer/nbrspanalyze.m	(revision 14)
+++ 	(revision )
@@ -1,336 +1,0 @@
-% NbrSpAnalyze   Point Cloud Spatial Analysis
-%
-% File: spanalize.m
-%
-% Description:
-%    Perform local feature attribution via eigenspace analysis.
-%
-% Limitations:
-%    No known limitations.
-%
-% Synopsis:
-%    [classes] = spanalyse(queries, database, ...)
-%
-% Inputs:
-%    queries  - .
-%    database - .
-%
-%    Option strings may be provided as abbreviations as long as they resolve to
-%    a unique option.
-%
-%    'neighbors' - .
-%    'radius'    - .
-%    'counts'    - .
-%    'steps'     - .
-%
-% Outputs:
-%    classes - Structure containing the spatial analysis classifications.
-%
-% Toolbox requirements:
-%    None.
-%
-% Code requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    None.
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2013 Kristian L. Damkjer.
-%
-%   Software History:
-%      2013-JAN-28   K. Damkjer
-%         Initial Coding.
-%      2013-FEB-04   K. Damkjer
-%         Change output to a struct for easier referencing.
-%
-
-%******************************************************************************
-% spanalyze
-%******************************************************************************
-function [ classes ] = nbrspanalyze( points, neighborhoods, varargin )
-   % Perform local feature attribution via eigenspace analysis.
-   %
-   % Parameters:
-   %    queries  - .
-   %
-   %    database - .
-   %
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    classes - Structure containing the spatial analysis classifications.
-   %
-
-   userParams = parseInputs(varargin{:}); % Parse Inputs
-
-%   maketimebar = false;
-%   
-%   if (~isempty(varargin) && strcmp('timebar',varargin{1}))
-%      maketimebar = true;
-%   end
-   
-   % Sizing metrics
-   dimensions=size(points, 1);
-   elements=size(neighborhoods, 2);
-
-   % Pre-allocate classes
-   norms=zeros(dimensions, elements);
-   feats=zeros(dimensions, elements);
-   dists2means=zeros(1,elements);
-   ints=zeros(1,elements);
-
-   if (~isempty(userParams.test))
-      if (length(neighborhoods) ~= length(userParams.test))
-         error('Damkjer:nbrspanalyze:size',                                 ...
-               ['When test sets are provided, '                             ...
-                'there must be one for each point set.']);
-      end
-      
-      neighborhoods=cellfun(@(x,y) [x;y], userParams.test, neighborhoods,   ...
-                            'UniformOutput', false);
-%      neighborhoods=cellfun(@(x,y) [x(1);y], userParams.test, neighborhoods,   ...
-%                            'UniformOutput', false);
-   end
-
-   % This process may take a while. Display time bar while processing.
-   if (userParams.maketimebar)
-      msg='Analyzing Neighborhoods...';
-      tstart=tic;
-      h = timebar(1, elements, msg, tstart);
-   end
-   
-   % Step through the queries in chunks.
-   step=1000;
-
-   if (userParams.maketimebar)
-      tic;
-   end
-
-   for elem=1:step:elements
-
-      last=min(elem+step-1,elements);
-
-      NN=neighborhoods(elem:last);
-      
-      cells=cell(1,length(NN));
-
-      for n=1:length(NN)
-         cells{n}=points(:,NN{n})';
-      end
-      
-      [covs,dist2mean,inty]=fastcov(cells);
-
-%       points(:,1:10)
-%       NN{1:10}
-%       cells{1:10}
-%       covs{1:10}
-%       dist2mean{1:10}
-%       inty{1:10}
-%          
-%       error('stop');
-         
-      % Compute the neighborhood covariance eigenvalues.
-      [V,D]=par_eig(covs);
-      
-      for nbr=1:length(NN)
-
-         % skip underconstrained neighborhoods (possible with radius searches)
-         if (length(NN{nbr})<5 || any(any(isnan(covs{nbr}))))
-            continue;
-         end
-
-         [~,index]=min(abs(D{nbr}));
-         A=V{nbr};
-         norms(:,elem+nbr-1)=abs(A(:,index));
-         
-         % Option 1: Define features as eigenvalues
-         % feats(:,elem+nbr-1)=sort(D{nbr},'descend');
-         
-         % Option 2: Define features as singular values. Eigenvalues are not
-         % guaranteed to be in any order. We want them in descending order.
-         %
-         % max is to get rid of pesky negative zeros.
-         feats(:,elem+nbr-1)=sqrt(max(sort(D{nbr},'descend'),0));
-
-         dists2means(elem+nbr-1)=dist2mean{nbr};
-         ints(elem+nbr-1)=inty{nbr};
-      end
-
-      % Update the time bar.
-      if (userParams.maketimebar && toc > 1)
-         tic;
-         h = timebar(elem, elements, msg, tstart, h);
-      end
-   end
-
-   % Close the time bar, if still open.
-   if (userParams.maketimebar && all(ishghandle(h, 'figure')))
-      close(h);
-   end
-
-   % Compute Normalized Features
-   energy=sum(feats,1);
-   nfeats=bsxfun(@times,feats.',1./energy.').';
-   nfeats(isnan(nfeats))=1;
-   nfeats(nfeats==0)=1;
-   
-   % Compute Omnivariance
-%   omnivar=prod(feats,1).^(1/dimensions);
-   omnivar=prod(feats.*feats,1).^(1/dimensions);
-%   omnivar=prod(nfeats,1).^(1/dimensions);
-   
-   % Compute Eigen Entropy
-   entropy=-sum(nfeats.*log(nfeats))./log(dimensions);
-%   entropy(entropy==1)=0;
-   entropy(isnan(entropy))=0;
-   
-   % Compute Eigen Structure
-   structure=1-entropy;
-   
-   % Compute Fractional Anisotropy
-   evmeans=mean(feats,1);
-   evdevs=feats-repmat(evmeans,dimensions,1);
-   numer=dimensions.*sum(evdevs.^2,1);
-   denom=(dimensions-1).*sum(feats.^2,1);
-   fa=(numer./denom).^(1/2);
-   
-   % Compute Anisotropy
-   ani=(feats(1,:)-feats(dimensions,:))./(feats(1,:));
-   
-   % Compute Isotropy
-   iso=1-ani;
-   
-   % Compute dimensional degree
-   dims=zeros(size(feats));
-   dims(1:dimensions-1,:)=(feats(1:dimensions-1,:)-feats(2:dimensions,:))./...
-                           repmat(feats(1,:),dimensions-1,1);
-   dims(dimensions,:)=iso;
-   
-   % Compute Dimensional Embedding
-   [~,label]=max(dims,[],1);
-
-   % Compute dimensional entropy
-%   alpha=[dims;iso];
-   alpha=dims;
-   alpha(isnan(alpha))=1;
-   alpha(alpha==0)=1;
-   de=-sum(alpha.*log(alpha))./log(dimensions);
-   
-%    if (~isreal(de))
-%       disp('de...');
-%       disp(de);
-%       disp('feats...');
-%       disp(feats);
-%       disp('eigs...');
-%       disp(feats.*feats);
-%    end
-   
-   % Populate feature classes
-   classes.features=feats;
-   classes.normals=norms;
-   classes.dimensionality=dims;
-   classes.isotropy=iso;
-   classes.anisotropy=ani;
-   classes.FA=fa;
-   classes.entropy=entropy;
-   classes.structure=structure;
-   classes.omnivariance=omnivar;
-   classes.labeling=label;
-   classes.dists2means=dists2means;
-   classes.intensity=ints;
-   classes.de=de;
-
-end
-
-%******************************************************************************
-% parseInputs
-%******************************************************************************
-function [userParams] = parseInputs(varargin)
-   % Support function to parse inputs into userParams structure
-   %
-   % Parameters:
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    userParams - .
-
-   userParams = struct('maketimebar', false, 'test', []);
-   
-   % Parse the Property/Value pairs
-%   if rem(length(varargin), 2) ~= 0
-%      error('Damkjer:PropertyValueNotPair', ...
-%            ['Additional arguments must take the form of Property/Value '...
-%             'pairs']);
-%   end
-   
-   propertyNames = {'timebar', 'test'};
-
-   while ~isempty(varargin)
-      
-      if islogical(varargin{1})
-         userParams.maketimebar = varargin{1};
-         varargin(1) = [];
-      elseif iscell(varargin{1})
-         userParams.test = varargin{1};
-         varargin(1) = [];
-      elseif (ischar(varargin{1}) &&                                        ...
-              (length(varargin) < 2 || ischar(varargin{2})) &&              ...
-              strcmp('timebar',varargin{1}))
-         userParams.maketimebar = true;
-         varargin(1) = [];
-      else
-         property = varargin{1};
-         value    = varargin{2};
-
-         % If the property has been supplied in a shortened form, lengthen it
-         iProperty = find(strncmpi(property, propertyNames, length(property)));
-
-         if isempty(iProperty)
-            error('Damkjer:InvalidProperty', 'Invalid Property');
-         elseif length(iProperty) > 1
-            error('Damkjer:AmbiguousProperty',                              ...
-                  'Supplied shortened property name is ambiguous');
-         end
-
-         property = propertyNames{iProperty};
-      
-         switch property
-         case 'timebar'
-            if (islogical(value))
-             userParams.maketimebar = value;
-            else
-               error('Damkjer:InvalidCount',                                ...
-                     'Timebar must be called with a logical parameter');
-            end
-         case 'test'
-            if (isnumeric(value))
-               userParams.test = fix(value);
-            else
-               error('Damkjer:InvalidRadius',                               ...
-                     'Test must be called with a set of indices');
-            end
-         end
-
-         varargin(1:2) = [];
-      end
-   end
-end
Index: mkjer/PointProcessing/SpatialAnalyzer/spanalyze.m
===================================================================
--- Damkjer/PointProcessing/SpatialAnalyzer/spanalyze.m	(revision 14)
+++ 	(revision )
@@ -1,610 +1,0 @@
-% SpAnalyze   Point Cloud Spatial Analysis
-%
-% File: spanalize.m
-%
-% Description:
-%    Perform local feature attribution via eigenspace analysis.
-%
-% Limitations:
-%    No known limitations.
-%
-% Synopsis:
-%    [classes] = spanalyse(queries, database, ...)
-%
-% Inputs:
-%    queries  - .
-%    database - .
-%
-%    Option strings may be provided as abbreviations as long as they resolve to
-%    a unique option.
-%
-%    'neighbors' - .
-%    'radius'    - .
-%    'counts'    - .
-%    'steps'     - .
-%
-% Outputs:
-%    classes - Structure containing the spatial analysis classifications.
-%
-% Toolbox requirements:
-%    None.
-%
-% Code requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    None.
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2013 Kristian L. Damkjer.
-%
-%   Software History:
-%      2013-JAN-28   K. Damkjer
-%         Initial Coding.
-%      2013-FEB-04   K. Damkjer
-%         Change output to a struct for easier referencing.
-%
-
-%******************************************************************************
-% spanalyze
-%******************************************************************************
-function [ classes ] = spanalyze( queries, points, varargin )
-   % Perform local feature attribution via eigenspace analysis.
-   %
-   % Parameters:
-   %    queries  - .
-   %
-   %    database - .
-   %
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    classes - Structure containing the spatial analysis classifications.
-   %
-   
-   userParams = parseInputs(varargin{:}); % Parse Inputs
-   
-   % Sizing metrics
-   dimensions=size(queries, 1);
-%   dimensions=3;
-   elements=size(queries, 2);
-
-   % Pre-allocate classes
-   norms=zeros(size(queries));
-   feats=zeros(size(queries));
-%   norms=zeros(3,length(queries));
-%   feats=zeros(3, length(queries));
-   biases=zeros(1,elements);
-   ints=zeros(1,elements);
-
-   % Build database
-%   database=VpTree(points);
-   database=VpTree(points(1:3,:));
-   
-   % This process may take a while. Display time bar while processing.
-   msg='Computing Structure Tensors...';
-   tstart=tic;
-   h = timebar(1, elements, msg, tstart);
-   
-   % Step through the queries in chunks.
-   step=1000;
-
-   tic;
-
-   for elem=1:step:elements
-
-      % The last available element may be closer than elem + step.
-      last=min(elem+step-1,elements);
-      
-      % Get the nearest neighbors of elem
-      if (userParams.radius > 0 && userParams.neighbors <= 0)
-         % Perform a fixed radius search
-         NN=database.rnn(queries(1:3,elem:last),...
-                         userParams.radius);
-      elseif (userParams.radius <= 0 && userParams.neighbors > 0)
-         % Search unconstrained neighbors
-         NN=database.knn(queries(1:3,elem:last),...
-                         userParams.neighbors);
-      elseif (userParams.radius > 0 && userParams.neighbors > 0)
-         % Search constrained to radius
-         NN=database.knn(queries(1:3,elem:last),...
-                         userParams.neighbors,...
-                         'lim',userParams.radius);
-      elseif (~isempty(userParams.counts) && userParams.radius <= 0)
-         % Search unconstrained neighbors
-         NN=database.knn(queries(1:3,elem:last),...
-                         max(userParams.counts));
-      elseif (~isempty(userParams.counts) && userParams.radius > 0)
-         % Search constrained to radius
-         NN=database.knn(queries(1:3,elem:last),...
-                         max(userParams.counts),...
-                         'lim',userParams.radius);
-      elseif (~isempty(userParams.steps))
-         % Perform a fixed radius search
-         [NN,DISTS]=database.rnn(queries(1:3,elem:last),...
-                                 max(userParams.steps));
-      end
-      
-%       % Compute neighborhood covariance, intensity and bias values.
-%       if (isempty(userParams.counts) && isempty(userParams.steps))
-         % Not using adaptive neighborhoods.
-         cells=cell(1,length(NN));
-         
-         for n=1:length(NN)
-            cells{n}=points(:,NN{n})';
-%            cells{n}=points(4:6,NN{n})';
-         end
-         
-         [covs,bias,inty]=fastcov(cells);
-      
-%          points(:,1:10)
-%          NN{1:10}
-%          cells{1:10}
-%          covs{1:10}
-%          bias{1:10}
-%          inty{1:10}
-%          
-%          error('stop');
-         
-%       elseif (~isempty(userParams.counts))
-%          
-%          % Using variable neighbor count based adaptive neighborhoods.
-% 
-%          % TODO: Conoslidate the common functionality in adaptive methods into
-%          % a single function.
-% 
-%          tempfeats=zeros(dimensions,size(NN,1));
-%          tempde=zeros(length(userParams.counts),size(NN,1));
-%          
-%          tempcovs=cell(length(userParams.counts),1);
-%          tempbias=cell(length(userParams.counts),1);
-%          tempinty=cell(length(userParams.counts),1);
-% 
-%          % Compute candidiate values (HACKY)
-%          for c=1:length(userParams.counts)
-%             cells=cell(1,length(NN));
-%             
-%             for n=1:length(NN)
-%                cells{n}=points(:,NN{n}(1:userParams.counts(c)))';
-%             end
-%             
-%             [tempcovs{c},tempbias{c},tempinty{c}]=fastcov(cells);
-%             
-%             for nbr=1:size(NN,1)
-%                [~,D]=par_eig(tempcovs{c}{nbr});
-%                tempfeats(:,nbr)=sort(diag(D),'descend');
-%             end
-%             
-%             % Compute dimensional degree
-%             % Do not use the following definition based on singular values:
-%             % tempdims=(sqrt(tempfeats(1:dimensions-1,:))-...
-%             %           sqrt(tempfeats(2:dimensions,:)))./...
-%             %           repmat(sqrt(tempfeats(1,:)),dimensions-1,1);
-%             tempdims=(tempfeats(1:dimensions-1,:)-...
-%                       tempfeats(2:dimensions,:))./...
-%                       repmat(tempfeats(1,:),dimensions-1,1);
-%                    
-%             % Compute isotropy
-%             tempiso=(tempfeats(dimensions,:))./(tempfeats(1,:));
-% 
-%             % Compute dimensional entropy
-%             tempalpha=[tempdims;tempiso];
-%             tempde(c,:)=-sum(tempalpha.*log(tempalpha))./log(dimensions);
-%          end
-%          
-%          % Minimize on dimensional entropy (HACKY)
-%          [~,ind]=min(tempde);
-%          
-%          covs=tempcovs{ind};
-%          bias=tempbias{ind};
-%          inty=tempinty{ind};
-%       elseif (~isempty(userParams.steps))
-%       
-%          % Using variable neighborhood radii based adaptive neighborhoods.
-%          
-%          % TODO: Conoslidate the common functionality in adaptive methods into
-%          % a single function.
-%          
-%          tempfeats=zeros(dimensions,size(NN,1));
-%          tempde=zeros(length(userParams.steps),size(NN,1));
-%          
-%          tempcovs=cell(length(userParams.steps),1);
-%          tempbias=cell(length(userParams.steps),1);
-%          tempinty=cell(length(userParams.steps),1);
-% 
-%          % Compute candidiate values (HACKY)
-%          for c=1:length(userParams.steps)
-%             
-%             nbrs=cell(1,length(DISTS));
-%             
-%             for n=1:length(DISTS)
-%                nbrs{n}=sum(DISTS{n} <= userParams.steps(c))';
-%             end
-%             
-%             cells=cell(1,length(NN));
-%             
-%             for n=1:length(NN)
-%                cells{n}=points(:,NN{n}(DISTS{n} <= userParams.steps(c)))';
-%             end
-%             
-%             [tempcovs{c},tempbias{c},tempinty{c}]=fastcov(cells);
-%             
-%             for nbr=1:size(NN,1)
-%                if (nbrs{nbr}<5)
-%                   continue;
-%                end
-%                
-%                [~,D]=par_eig(tempcovs{c}{nbr});
-%                tempfeats(:,nbr)=sort(diag(D),'descend');
-%             end
-%             
-%             % Compute dimensional degree
-%             % Do not use the following definition based on singular values:
-%             % tempdims=(sqrt(tempfeats(1:dimensions-1,:))-...
-%             %           sqrt(tempfeats(2:dimensions,:)))./...
-%             %           repmat(sqrt(tempfeats(1,:)),dimensions-1,1);
-%             tempdims=(tempfeats(1:dimensions-1,:)-...
-%                       tempfeats(2:dimensions,:))./...
-%                       repmat(tempfeats(1,:),dimensions-1,1);
-%                    
-%             % Compute isotropy
-%             tempiso=(tempfeats(dimensions,:))./(tempfeats(1,:));
-%             
-%             % Compute dimensional entropy
-%             tempalpha=[tempdims;tempiso];
-%             tempde(c,:)=-sum(tempalpha.*log(tempalpha))./log(dimensions);
-%          end
-%          
-%          % Minimize on dimensional entropy (HACKY)
-%          [~,ind]=nanmin(tempde);
-%          
-%          covs=tempcovs{ind};
-%          bias=tempbias{ind};
-%          inty=tempinty{ind};
-%       else
-%          error('Unhandled Condition');
-%       end
-
-      % Compute the neighborhood covariance eigenvalues.
-      [V,D]=par_eig(covs);
-      
-      for nbr=1:length(NN)
-
-         % skip underconstrained neighborhoods (possible with radius searches)
-         if (userParams.radius > 0 && (length(NN{nbr})<5 ||...
-             any(any(isnan(covs{nbr})))))
-            continue;
-         end
-
-         [~,index]=min(abs(D{nbr}));
-         A=V{nbr};
-         norms(:,elem+nbr-1)=abs(A(:,index));
-         
-         % Option 1: Define features as eigenvalues
-         % feats(:,elem+nbr-1)=sort(D{nbr},'descend');
-         
-         % Option 2: Define features as singular values. Eigenvalues are not
-         % guaranteed to be in any order. We want them in descending order.
-         feats(:,elem+nbr-1)=sqrt(max(sort(D{nbr},'descend'),0));
-
-         biases(elem+nbr-1)=bias{nbr};
-         ints(elem+nbr-1)=inty{nbr};
-      end
-
-      % Update the time bar.
-      if (toc > 1)
-         tic;
-         h = timebar(elem, elements, msg, tstart, h);
-      end
-   end
-
-   % Close the time bar, if still open.
-   if (all(ishghandle(h, 'figure')))
-      close(h);
-   end
-
-   % Compute Normalized Features
-   energy=sum(feats,1);
-   
-   nfeats=bsxfun(@times,feats.',1./energy.').';
-   nfeats(isnan(nfeats))=1;
-   nfeats(nfeats==0)=1;
-
-%   max(energy)
-%   gnfeats=feats./max(energy);
-
-%   error('Stop');
-   
-   % Compute Omnivariance
-%   omnivar=prod(feats,1).^(1/dimensions);
-   omnivar=prod(feats.*feats,1).^(1/dimensions);
-%   omnivar=prod(nfeats,1).^(1/dimensions);
-   
-   % Compute Eigen Entropy
-   entropy=-sum(nfeats.*log(nfeats))./log(dimensions);
-%   entropy(entropy==1)=0;
-   entropy(isnan(entropy))=0;
-   
-%   global_entropy=-sum(gnfeats.*log(gnfeats))./log(dimensions);
-   
-   % Compute Eigen Structure
-   structure=1-entropy;
-   
-   % Compute Fractional Anisotropy
-   evmeans=mean(feats,1);
-   evdevs=feats-repmat(evmeans,dimensions,1);
-   numer=dimensions.*sum(evdevs.^2,1);
-   denom=(dimensions-1).*sum(feats.^2,1);
-   fa=(numer./denom).^(1/2);
-   
-   % Compute Anisotropy
-   ani=(feats(1,:)-feats(dimensions,:))./(feats(1,:));
-   
-   % Compute Isotropy
-   iso=1-ani;
-   
-   % Compute dimensional degree
-   dims=zeros(size(feats));
-   dims(1:dimensions-1,:)=(feats(1:dimensions-1,:)-feats(2:dimensions,:))./...
-                           repmat(feats(1,:),dimensions-1,1);
-   dims(dimensions,:)=iso;
-   
-   % Compute Dimensional Embedding
-   [~,label]=max(dims,[],1);
-
-   % Compute dimensional entropy
-%   alpha=[dims;iso];
-   alpha=dims;
-   alpha(isnan(alpha))=1;
-   alpha(alpha==0)=1;
-   de=-sum(alpha.*log(alpha))./log(dimensions);
-
-   % Compute dimensional degree
-%   gdims=zeros(size(feats));
-   
-%   max(feats(1,:))
-   
-%   gdims(1:dimensions-1,:)=(gnfeats(1:dimensions-1,:)-gnfeats(2:dimensions,:))./...
-%                           repmat(gnfeats(1,:),dimensions-1,1);
-%   gdims(dimensions,:)=gnfeats(dimensions,:)./(gnfeats(1,:));
-   
-%   global_de=-sum(gdims.*log(gdims))./log(dimensions);
-   
-   % Populate feature classes
-   classes.features=feats;
-   classes.normals=norms;
-   classes.dimensionality=dims;
-   classes.isotropy=iso;
-   classes.anisotropy=ani;
-   classes.FA=fa;
-   classes.energy=energy;
-   classes.entropy=entropy;
-   classes.structure=structure;
-   classes.omnivariance=omnivar;
-   classes.labeling=label;
-   classes.biases=biases;
-   classes.intensity=ints;
-   classes.de=de;
-%   classes.global_dimensionality=gdims;
-%   classes.global_entropy=global_entropy;
-%   classes.global_de=global_de;
-
-% TODO: Add curvature analysis back into spatial analyzer. Will require
-% re-work.
-%
-%    st=zeros(size(QUERIES));
-% 
-%    msg='Computing Normal Structure Tensors...';
-%    tstart=tic;
-%    h = timebar(1, elements, msg, tstart);
-% 
-%    for elem=1:step:elements
-%     
-%       last=min(elem+step-1,elements);
-%     
-%       % Get the nearest neighbors of elem
-%       if (userParams.neighbors <= 0)
-%           % Perform a fixed radius search
-%           NN=DATABASE.rnn(QUERIES(:,elem:last),...
-%                           userParams.radius);
-%       else
-%           if (userParams.radius <= 0)
-%               % Search unconstrained
-%               NN=DATABASE.knn(QUERIES(:,elem:last),...
-%                               userParams.neighbors);
-%           else
-%               % Search constrained to radius
-%               NN=DATABASE.knn(QUERIES(:,elem:last),...
-%                               userParams.neighbors,...
-%                               'lim',userParams.radius);
-%           end
-%       end
-% 
-%       for nbr=1:size(NN,1)
-%          normals=norms(:,NN{nbr});
-% 
-%          S=svd(normals',0);
-%          st(:,elem+nbr-1)=S.*S./(length(NN{nbr})-1);
-% 
-% %          D=eig(1/(length(NN{nbr})-1)*(normals*normals'));
-% %          st(:,elem+nbr-1)=sort(D,'descend');
-% 
-% %          ST=normals*normals';
-% 
-% %          if (nbr == 1)
-% %              D=eig(1/(length(NN{nbr})-1)*(normals*normals'));
-% %              disp('EIG:');
-% %              disp(sqrt(D));
-% %           
-% %              S=svd(normals',0);
-% %              S = S ./ sqrt(length(NN{nbr})-1);
-% %              disp('SVD:');
-% %              disp(abs(S));
-% % 
-% %          end
-% 
-%       end
-% 
-%       if(toc > 1)
-%          tic;
-%          h = timebar(elem, elements, msg, tstart, h);
-%       end
-%    end
-% 
-%    if (all(ishghandle(h, 'figure')))
-%       close(h);
-%    end
-
-end
-
-%******************************************************************************
-% parseInputs
-%******************************************************************************
-function [userParams] = parseInputs(varargin)
-   % Support function to parse inputs into userParams structure
-   %
-   % Parameters:
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    userParams - .
-
-   userParams = struct('radius', 0, 'neighbors', 0, 'counts', [], 'steps', []);
-   
-   if isempty(varargin)
-      error('Damkjer:InvalidOptions', ...
-            ['A neighborhood size must be specified, either directly or '...
-             'via optional parameters.']);
-   end
-   
-   if length(varargin) == 1 || ~isnumeric(varargin{2})
-      value = varargin{1};
-      
-      if (isscalar(value)  && ...
-          isreal(value)    && ...
-          value >= 5)
-         userParams.neighbors = fix(value);
-      else
-         error('Damkjer:InvalidCount', ...
-               ['Number of Neighbors must be a real valued positive '...
-                'integer greater or equal to 5: ' num2str(value)]);
-      end
-      
-      varargin(1) = [];
-   end
-   
-   % Parse the Property/Value pairs
-   if rem(length(varargin), 2) ~= 0
-      error('Damkjer:PropertyValueNotPair', ...
-            ['Additional arguments must take the form of Property/Value '...
-             'pairs']);
-   end
-   
-   propertyNames = {'neighbors', 'radius', 'counts', 'steps'};
-
-   while ~isempty(varargin)
-      property = varargin{1};
-      value    = varargin{2};
-      
-      % If the property has been supplied in a shortened form, lengthen it
-      iProperty = find(strncmpi(property, propertyNames, length(property)));
-      
-      if isempty(iProperty)
-         error('Damkjer:InvalidProperty', 'Invalid Property');
-      elseif length(iProperty) > 1
-         error('Damkjer:AmbiguousProperty', ...
-               'Supplied shortened property name is ambiguous');
-      end
-      
-      property = propertyNames{iProperty};
-      
-      switch property
-      case 'neighbors'
-         if (isscalar(value)  && ...
-             isreal(value)    && ...
-             value >= 5)
-          userParams.neighbors = fix(value);
-         else
-            error('Damkjer:InvalidCount', ...
-                  ['Number of Neighbors must be a real valued positive '...
-                   'integer greater or equal to 5']);
-         end
-      case 'radius'
-         if (isscalar(value) && ...
-             isnumeric(value) && ...
-             isreal(value) && ...
-             value > 0)
-            userParams.radius = value;
-         else
-            error('Damkjer:InvalidRadius', ...
-                  'Radius must be a real valued positive scalar');
-         end
-      case 'counts'
-         if (isvector(value)  && ...
-             isreal(value)    && ...
-             issorted(value)  && ...
-             all(value >= 5))
-            userParams.counts = fix(value);
-         else
-            error('Damkjer:InvalidCount', ...
-                  ['Counts must be a sorted vector of real valued positive '...
-                   'integers greater or equal to 5']);
-         end
-      case 'steps'
-         if (isvector(value)  && ...
-             isreal(value)    && ...
-             issorted(value)  && ...
-             all(value > 0))
-            userParams.steps = value;
-         else
-            error('Damkjer:InvalidSteps', ...
-                  ['Steps must be a sorted vector of real valued positive '...
-                   'values']);
-         end
-      end
-      
-      varargin(1:2) = [];
-   end
-
-   % Check for mutually exclusive options.
-   if (~isempty(userParams.counts) && userParams.neighbors >= 5)
-      error('Damkjer:MutExOpts', ...
-            '''neighbors'' and ''counts'' options are mutually exclusive');
-   end
-   
-   if (~isempty(userParams.steps) && userParams.radius > 0)
-      error('Damkjer:MutExOpts', ...
-            '''steps'' and ''radius'' options are mutually exclusive');
-   end
-   
-   if (~isempty(userParams.counts) && ~isempty(userParams.steps))
-      error('Damkjer:MutExOpts', ...
-            '''steps'' and ''counts'' options are mutually exclusive');
-   end
-
-   % Default, if necessary.
-   if (userParams.neighbors <= 0 && ...
-       userParams.radius <= 0 && ...
-       isempty(userParams.counts) && ...
-       isempty(userParams.steps))
-      userParams.radius = 1;
-   end
-end
Index: mkjer/PointProcessing/Thinning_Damkjer/stochastic_thin.m
===================================================================
--- Damkjer/PointProcessing/Thinning_Damkjer/stochastic_thin.m	(revision 16)
+++ 	(revision )
@@ -1,633 +1,0 @@
-% stochastic_thin   Point Cloud Thinning (Dyn et al)
-%
-% File: thin_Dyn.m
-%
-% Description:
-%    Perform thinning according to Dyn 2004.
-%
-% Limitations:
-%    No known limitations.
-%
-% Synopsis:
-%    [results] = spanalyse(points, threshold, ...)
-%
-% Inputs:
-%    points - .
-%    threshold - must be positive. between 0-1, treated as percentage, > 1
-%                points.
-%
-%    Option strings may be provided as abbreviations as long as they resolve to
-%    a unique option.
-%
-%    'neighbors' - .
-%    'radius'    - .
-%    'counts'    - .
-%    'steps'     - .
-%
-% Outputs:
-%    results - Thinned point cloud.
-%
-% Toolbox requirements:
-%    None.
-%
-% Code requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    Dyn reference.
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2013 Kristian L. Damkjer.
-%
-%   Software History:
-%      2013-DEC-28  Initial coding.
-%
-
-%******************************************************************************
-% thin_Dyn
-%******************************************************************************
-function [ results ] = stochastic_thin( points, threshold, varargin )
-   % Perform local feature attribution via eigenspace analysis.
-   %
-   % Parameters:
-   %    points  - .
-   %
-   %    threshold - .
-   %
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    classes - Structure containing the spatial analysis classifications.
-   %
-   
-   userParams = parseInputs(varargin{:}); % Parse Inputs
-
-   %***
-   % CONFIRM UNIQUENESS
-   %***
-   
-   % Make sure that all points in the set are unique...
-   disp('Culling duplicate points...');
-   tstart=tic;
-   points = unique(points.','rows').';
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-   %***
-   % INDEX POINT SET
-   %***
-   disp('Indexing points...');
-   tstart=tic;
-   database = VpTree(points);
-   queries = points;
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-   %***
-   % CREATE NEIGHBORHOODS
-   %***
-
-%   database.excludeWithin(0.000001); % Set um precision on searches.
-   
-   % Sizing metrics
-   dimensions=size(queries, 1);
-   elements=size(queries, 2);
-   
-   nbrs  = cell(1,elements);
-   dists = cell(1,elements);
-   test  = num2cell(1:elements, 1);
-
-   % This process may take a while. Display time bar while processing.
-   msg='Creating Neigborhoods...';
-   tstart=tic;
-   h = timebar(1, elements, msg, tstart);
-
-   disp(msg);
-
-   % Step through the queries in chunks.
-   step=1000;
-
-   tic;
-
-   for elem=1:step:elements
-
-      % The last available element may be closer than elem + step.
-      last=min(elem+step-1,elements);
-      
-      % Get the nearest neighbors of elem
-      if (userParams.radius > 0 && userParams.neighbors <= 0)
-         % Perform a fixed radius search
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.rnn(queries(:,elem:last),            ...
-                                           userParams.radius);
-      elseif (userParams.radius <= 0 && userParams.neighbors > 0)
-         % Search unconstrained neighbors
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(:,elem:last),            ...
-                                           userParams.neighbors);
-      elseif (userParams.radius > 0 && userParams.neighbors > 0)
-         % Search constrained to radius
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(:,elem:last),            ...
-                                           userParams.neighbors,            ...
-                                           'lim', userParams.radius);
-      elseif (~isempty(userParams.counts) && userParams.radius <= 0)
-         % Search unconstrained neighbors
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(:,elem:last),            ...
-                                           max(userParams.counts));
-      elseif (~isempty(userParams.counts) && userParams.radius > 0)
-         % Search constrained to radius
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(:,elem:last),            ...
-                                           max(userParams.counts),          ...
-                                           'lim', userParams.radius);
-      elseif (~isempty(userParams.steps))
-         % Perform a fixed radius search
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.rnn(queries(:,elem:last),            ...
-                                           max(userParams.steps));
-      end
-
-      % Update the time bar.
-      if (toc > 1)
-         tic;
-         h = timebar(elem, elements, msg, tstart, h);
-      end
-   end
-
-   % Close the time bar, if still open.
-   if (all(ishghandle(h, 'figure')))
-      close(h);
-   end
-
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-%% Obsolete code   
-%  %***
-%  % COMPUTE DUAL NEIGHBORHOODS (THIS IS SLOW. LET'S MEX IT)
-%  %***
-%
-%  % This process may take a while. Display time bar while processing.
-%  msg='Computing Dual Neigborhoods...';
-%  tstart=tic;
-%  h = timebar(1, elements, msg, tstart);
-%    
-%  disp(msg);
-% 
-%  tic;
-%  for elem=1:elements
-%       
-%     % Build up dual set
-%     for nbr=1:length(nbrs{elem})
-%        n = nbrs{elem}(nbr);
-%        duals{n}=[duals{n}(:); elem];
-%     end
-% 
-%     % Update the time bar.
-%     if (toc > 1)
-%        tic;
-%        h = timebar(elem, elements, msg, tstart, h);
-%     end
-%  end
-% 
-%  % Close the time bar, if still open.
-%  if (all(ishghandle(h, 'figure')))
-%     close(h);
-%  end
-% 
-%  disp(['...done in ' num2str(toc(tstart)) 's']);
-%%
-   
-   %***
-   % COMPUTE DUAL NEIGHBORHOODS
-   %***
-
-   disp('Computing Dual Neigborhoods...');
-   tstart=tic;
-   duals=fastsetdual(nbrs);
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-   %***
-   % COMPUTE SIGNIFICANCES
-   %***
-   disp('Computing Initial Significances...');
-   tstart=tic;
-
-%   feats = nbrspanalyze(points, nbrs, 'timebar');
-
-   feats = nbrspanalyze(points, nbrs, test, 'timebar');
-
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-%   error('Stop');
-   
-   radii=cellfun(@max,dists);
-   biases=feats.dists2means./radii;
-   tdist = zeros(1,elements);
-   
-   sigs = feats.de;
-%   sigs = sqrt(biases.*feats.de);
-%   sigs = 0.5 * (biases + feats.de);
-%   sigs = max(biases, feats.de);
-%   sigs = min(biases, feats.de);
-%   sigs = biases;
-
-   %***
-   % PARTITION THE DATA SET
-   %***
-
-%   disp('Partition by Label...');
-%   tstart=tic;
-%
-%   parts = cell(1,dimensions);
-%
-%   for dim=1:dimensions
-%      parts{dim}=sort(uint64(find(feats.labeling==dim)),'ascend');
-%   end
-%
-%   [~,idx]=sort(cellfun('length',parts),'descend');
-%   parts=parts(idx);
-%   
-%   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-   %***
-   % THIN BY LABEL
-   %***
-
-%   fraction=0;
-
-   removed=zeros(1,elements-threshold);
-   dual_size=zeros(1,elements-threshold);
-   current=1;
-
-%   removed_wgts=cell(1,3);
-   fellback = 0;
-
-%   for dim=1:dimensions
-%      desired  = threshold * length(parts{dim}) / elements + fraction;
-%      tau      = floor(desired);
-%      fraction = desired-tau;
-%      heap     = SplayTree(sigs(parts{dim}),parts{dim});
-%      n        = length(parts{dim})-tau;
-      
-%      removed_wgts{dim}=zeros(1,n);
-
-      tau=threshold;
-      heap = SplayTree(sigs,1:length(sigs));
-      n = length(sigs) - tau;
-      removed_wgts=zeros(1,n);
-
-%      msg=['Thin Dimension ' num2str(dim) '(' num2str(length(parts{dim})) ...
-%                                          '->' num2str(tau) ')...'];
-      msg='Thin...';
-      tstart=tic;
-      h = timebar(1, n, msg, tstart);
-
-      disp(msg);
-      tic;
-
-      removed=sigs;
-%       for x=1:n
-% 
-%          % Locate the least significant point to remove
-%          [wgt, idx]=heap.pop_head();
-% 
-%          % Mark the point as removed
-%          removed(current)=idx;
-% %         removed_wgts{dim}(x)=wgt;
-%          removed_wgts(x)=wgt;
-% 
-% 
-%          % Distribute the points in the test set to the neighbor's test sets.
-%          neighbors = nbrs{idx};
-%          samples   = test{idx};
-%          
-%          for samp=1:length(samples)
-%             % Find the closest
-%             [dsq,new_idx]=min(sum((bsxfun(@minus, points(:,neighbors), ...
-%                                           points(:,samples(samp)))).^2, 1));
-% 
-%             % Update the test set
-%             test{neighbors(new_idx)}(end + 1,1) = samples(samp);
-%             
-%             tdist(neighbors(new_idx)) = max(tdist(neighbors(new_idx)),...
-%                                             sqrt(dsq));
-%          end
-%          
-%          % The removed element neighborhood is eliminated, so it no longer
-%          % contains the neighbors. Update the neighbor duals appropriately.
-%          for nbr=1:length(neighbors)
-%             duals{neighbors(nbr)}=duals{neighbors(nbr)}(duals{neighbors(nbr)}~=idx);
-%          end
-% 
-%          % Find neighborhoods that contain removed element
-%          neighborhoods=duals{idx};
-%          dual_size(current)=length(neighborhoods);
-%          neighborhoods=sort(neighborhoods(neighborhoods~=idx), 'ascend');
-% 
-%          % The fallback neighborhood is identical for all neighborhoods, but
-%          % may be expensive to compute. Allow it to be lazily instantiated.
-%          fallback_pool = [];
-%          
-%          % Replace removed element in each neighborhood with nearest neighbor's
-%          % neighbor
-%          for hood=1:length(neighborhoods)
-% 
-%             % Build up the list of potential new neighbors
-% %            disp('building candidates...');
-% 
-% %% Obsolete code
-% %            nbr_pool=unique(vertcat(nbrs{nbrs{neighborhoods(hood)}}));
-% %            nbr_pool=setdiff(nbr_pool, idx);
-% %            nbr_pool=setdiff(nbr_pool, nbrs{neighborhoods(hood)});
-% %%
-%             nbr_pool=fastsetunion({nbrs{nbrs{neighborhoods(hood)}}});
-%             non_nbrs=fastsetunion({nbrs{neighborhoods(hood)},idx,neighborhoods(hood)});
-%             nbr_pool=nbr_pool(~ismembc(nbr_pool(:), non_nbrs(:)));
-% 
-%             if (isempty(nbr_pool))
-%                if (isempty(fallback_pool))
-%                   fallback_pool = uint64(find(~ismember(1:size(points,2),removed)));
-%                end
-%                fellback = fellback + 1;
-%                nbr_pool = fallback_pool;
-%                nbr_pool=nbr_pool(~ismembc(nbr_pool(:), non_nbrs(:)));
-%             end
-% 
-%             % Find the closest
-% %            disp('finding closest...');
-% 
-% %% Obsolete code
-% %            % Don't use VP Tree for single nearest neighbor... overhead not
-% %            % worth it.
-% %            locdb = VpTree(points(:,nbr_pool));
-% %            nn=locdb.knn(points(:,idx),1);
-% %            new_idx=nn{1}
-% %%
-%             [dsq,new_idx]=min(sum((bsxfun(@minus, points(:,nbr_pool), ...
-%                                           points(:,neighborhoods(hood)))).^2, 1));
-% 
-%             % Update the neighborhood
-% %            disp('updating neighborhood...'); 
-% 
-%             new_dist = sqrt(dsq);
-% 
-%             % Maintain a partially sorted list of indices by max distance.
-%             if (new_dist > dists{neighborhoods(hood)}(end))
-%                dists{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) = ...
-%                   dists{neighborhoods(hood)}(end);
-%                
-%                nbrs{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) =  ...
-%                   nbrs{neighborhoods(hood)}(end);
-% 
-%                dists{neighborhoods(hood)}(end) = sqrt(dsq);
-%                
-%                nbrs{neighborhoods(hood)}(end)  = nbr_pool(new_idx);
-%             else
-%                dists{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) = ...
-%                   sqrt(dsq);
-%                
-%                nbrs{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) =  ...
-%                   nbr_pool(new_idx);
-%             end
-%             
-%             % Update the dual
-% %            disp('updating dual...');
-%             duals{nbr_pool(new_idx)}(end + 1,1) = neighborhoods(hood);
-%             
-% %             disp(nbrs{neighborhoods(hood)});
-% %             disp(duals{nbr_pool(new_idx)});
-%          end
-%          
-%          nbrs{idx}=[];
-%          duals{idx}=[];
-%          test{idx}=[];
-%          
-%          % Update analysis for elements
-% %         disp('updating analysis...');
-% 
-%          neighborhoods=fastsetunion({neighborhoods, neighbors});
-%          
-% %         nbrs{neighborhoods}
-% %         test{neighborhoods}
-%          
-% %         error('Stop');
-% 
-%          if (~isempty(neighborhoods))
-%             locfeats = nbrspanalyze(points,                                 ...
-%                                     nbrs(neighborhoods),                    ...
-%                                     test(neighborhoods));
-%             
-%             radii(neighborhoods)=cellfun(@max,dists(neighborhoods));
-%             radii(neighborhoods)=max(radii(neighborhoods), tdist(neighborhoods));
-%             biases(neighborhoods)=(locfeats.dists2means)./(radii(neighborhoods));
-%             
-%             locsigs = locfeats.de;
-% %            locsigs = sqrt(biases(neighborhoods).*locfeats.de);
-% %            locsigs = 0.5 * (biases(neighborhoods) + locfeats.de);
-% %            locsigs = max(biases(neighborhoods), locfeats.de);
-% %            locsigs = min(biases(neighborhoods), locfeats.de);
-% %            locsigs = biases(neighborhoods);
-% 
-%          % Update heap, where required
-% %            updates=neighborhoods(ismembc(neighborhoods,parts{dim})).';
-% %            sig_upd=locsigs(ismembc(neighborhoods,updates));
-%             updates=neighborhoods';
-%             sig_upd=locsigs;
-% 
-%             heap.erase(sigs(updates),updates);
-%             heap.insert(sig_upd,updates);
-%             sigs(neighborhoods)=locsigs;
-%             feats.de(neighborhoods)=locfeats.de;
-%             feats.dists2means(neighborhoods)=locfeats.dists2means;
-% %            feats.biases(neighborhoods)=locfeats.biases;
-%          end
-%          
-%          current = current + 1;
-%          
-%          % Update the time bar.
-%          if (toc > 1)
-%             tic;
-%             h = timebar(x, n, msg, tstart, h);
-%          end
-%       end
-      
-      % Close the time bar, if still open.
-      if (all(ishghandle(h, 'figure')))
-         close(h);
-      end
-      
-      disp(['...done in ' num2str(toc(tstart)) 's']);   
-%   end
-
-   disp(['Generated fallback neighborhood pool ' num2str(fellback) ' time(s).']);
-   
-%   x_max=max(cellfun(@length, removed_wgts));
-%   y=nan(length(removed_wgts),x_max);
-   
-%   for dim=1:dimensions
-%      y(dim,1:length(removed_wgts{dim}))=removed_wgts{dim};
-%   end
-
-   x_max=length(removed_wgts);
-   y = removed_wgts;
-
-   figure, plot(1:x_max,y);
-   figure, plot(1:length(dual_size),dual_size);
-
-%   results = points(:,~ismember(1:size(points,2),removed));
-%   results = removed;
-   results = sigs;
-
-end
-
-%******************************************************************************
-% parseInputs
-%******************************************************************************
-function [userParams] = parseInputs(varargin)
-   % Support function to parse inputs into userParams structure
-   %
-   % Parameters:
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    userParams - .
-
-   userParams = struct('radius', 0, 'neighbors', 0, 'counts', [], 'steps', []);
-   
-   if isempty(varargin)
-      error('Damkjer:InvalidOptions', ...
-            ['A neighborhood size must be specified, either directly or '...
-             'via optional parameters.']);
-   end
-   
-   if length(varargin) == 1 || ~isnumeric(varargin{2})
-      value = varargin{1};
-      
-      if (isscalar(value)  && ...
-          isreal(value)    && ...
-          value >= 5)
-         userParams.neighbors = fix(value);
-      else
-         error('Damkjer:InvalidCount', ...
-               ['Number of Neighbors must be a real valued positive '...
-                'integer greater or equal to 5: ' num2str(value)]);
-      end
-      
-      varargin(1) = [];
-   end
-   
-   % Parse the Property/Value pairs
-   if rem(length(varargin), 2) ~= 0
-      error('Damkjer:PropertyValueNotPair', ...
-            ['Additional arguments must take the form of Property/Value '...
-             'pairs']);
-   end
-   
-   propertyNames = {'neighbors', 'radius', 'counts', 'steps'};
-
-   while ~isempty(varargin)
-      property = varargin{1};
-      value    = varargin{2};
-      
-      % If the property has been supplied in a shortened form, lengthen it
-      iProperty = find(strncmpi(property, propertyNames, length(property)));
-      
-      if isempty(iProperty)
-         error('Damkjer:InvalidProperty', 'Invalid Property');
-      elseif length(iProperty) > 1
-         error('Damkjer:AmbiguousProperty', ...
-               'Supplied shortened property name is ambiguous');
-      end
-      
-      property = propertyNames{iProperty};
-      
-      switch property
-      case 'neighbors'
-         if (isscalar(value)  && ...
-             isreal(value)    && ...
-             value >= 5)
-          userParams.neighbors = fix(value);
-         else
-            error('Damkjer:InvalidCount', ...
-                  ['Number of Neighbors must be a real valued positive '...
-                   'integer greater or equal to 5']);
-         end
-      case 'radius'
-         if (isscalar(value) && ...
-             isnumeric(value) && ...
-             isreal(value) && ...
-             value > 0)
-            userParams.radius = value;
-         else
-            error('Damkjer:InvalidRadius', ...
-                  'Radius must be a real valued positive scalar');
-         end
-      case 'counts'
-         if (isvector(value)  && ...
-             isreal(value)    && ...
-             issorted(value)  && ...
-             all(value >= 5))
-            userParams.counts = fix(value);
-         else
-            error('Damkjer:InvalidCount', ...
-                  ['Counts must be a sorted vector of real valued positive '...
-                   'integers greater or equal to 5']);
-         end
-      case 'steps'
-         if (isvector(value)  && ...
-             isreal(value)    && ...
-             issorted(value)  && ...
-             all(value > 0))
-            userParams.steps = value;
-         else
-            error('Damkjer:InvalidSteps', ...
-                  ['Steps must be a sorted vector of real valued positive '...
-                   'values']);
-         end
-      end
-      
-      varargin(1:2) = [];
-   end
-
-   % Check for mutually exclusive options.
-   if (~isempty(userParams.counts) && userParams.neighbors >= 5)
-      error('Damkjer:MutExOpts', ...
-            '''neighbors'' and ''counts'' options are mutually exclusive');
-   end
-   
-   if (~isempty(userParams.steps) && userParams.radius > 0)
-      error('Damkjer:MutExOpts', ...
-            '''steps'' and ''radius'' options are mutually exclusive');
-   end
-   
-   if (~isempty(userParams.counts) && ~isempty(userParams.steps))
-      error('Damkjer:MutExOpts', ...
-            '''steps'' and ''counts'' options are mutually exclusive');
-   end
-
-   % Default, if necessary.
-   if (userParams.neighbors <= 0 && ...
-       userParams.radius <= 0 && ...
-       isempty(userParams.counts) && ...
-       isempty(userParams.steps))
-      userParams.radius = 1;
-   end
-end
Index: mkjer/PointProcessing/Thinning_Damkjer/thin_Damkjer.m
===================================================================
--- Damkjer/PointProcessing/Thinning_Damkjer/thin_Damkjer.m	(revision 15)
+++ 	(revision )
@@ -1,610 +1,0 @@
-% Thin_Dyn   Point Cloud Thinning (Dyn et al)
-%
-% File: thin_Dyn.m
-%
-% Description:
-%    Perform thinning according to Dyn 2004.
-%
-% Limitations:
-%    No known limitations.
-%
-% Synopsis:
-%    [results] = spanalyse(points, threshold, ...)
-%
-% Inputs:
-%    points - .
-%    threshold - must be positive. between 0-1, treated as percentage, > 1
-%                points.
-%
-%    Option strings may be provided as abbreviations as long as they resolve to
-%    a unique option.
-%
-%    'neighbors' - .
-%    'radius'    - .
-%    'counts'    - .
-%    'steps'     - .
-%
-% Outputs:
-%    results - Thinned point cloud.
-%
-% Toolbox requirements:
-%    None.
-%
-% Code requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    Dyn reference.
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2013 Kristian L. Damkjer.
-%
-%   Software History:
-%      2013-DEC-28  Initial coding.
-%
-
-%******************************************************************************
-% thin_Dyn
-%******************************************************************************
-function [ results, removed_wgts, impact ] = thin_Damkjer( points, threshold, varargin )
-   % Perform local feature attribution via eigenspace analysis.
-   %
-   % Parameters:
-   %    points  - .
-   %
-   %    threshold - .
-   %
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    classes - Structure containing the spatial analysis classifications.
-   %
-   
-   userParams = parseInputs(varargin{:}); % Parse Inputs
-
-   %***
-   % CONFIRM UNIQUENESS
-   %***
-   
-   % Make sure that all points in the set are unique...
-   disp('Culling duplicate points...');
-   tstart=tic;
-   check = unique(points.','rows').';
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-%    size(check)
-%    size(points)
-%    
-   if (any(size(check) ~= size(points)))
-      error('Points must be unique. Try: unique(X.'',''rows'',''stable'').''');
-   end
-   
-   %***
-   % INDEX POINT SET
-   %***
-   disp('Indexing points...');
-   tstart=tic;
-   database = VpTree(points(1:3,:));
-   queries = points;
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-   %***
-   % CREATE NEIGHBORHOODS
-   %***
-
-   database.excludeWithin(0.000000001); % Set um precision on searches.
-   
-   % Sizing metrics
-   dimensions=size(queries, 1);
-   elements=size(queries, 2);
-   
-   nbrs  = cell(1,elements);
-   dists = cell(1,elements);
-   test  = num2cell(1:elements, 1);
-
-   % This process may take a while. Display time bar while processing.
-   msg='Creating Neigborhoods...';
-   tstart=tic;
-   h = timebar(1, elements, msg, tstart);
-
-   disp(msg);
-
-   % Step through the queries in chunks.
-   step=1000;
-
-   tic;
-
-   for elem=1:step:elements
-
-      % The last available element may be closer than elem + step.
-      last=min(elem+step-1,elements);
-      
-      % Get the nearest neighbors of elem
-      if (userParams.radius > 0 && userParams.neighbors <= 0)
-         % Perform a fixed radius search
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.rnn(queries(1:3,elem:last),          ...
-                                           userParams.radius);
-      elseif (userParams.radius <= 0 && userParams.neighbors > 0)
-         % Search unconstrained neighbors
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(1:3,elem:last),          ...
-                                           userParams.neighbors);
-      elseif (userParams.radius > 0 && userParams.neighbors > 0)
-         % Search constrained to radius
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(1:3,elem:last),          ...
-                                           userParams.neighbors,            ...
-                                           'lim', userParams.radius);
-      elseif (~isempty(userParams.counts) && userParams.radius <= 0)
-         % Search unconstrained neighbors
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(1:3,elem:last),          ...
-                                           max(userParams.counts));
-      elseif (~isempty(userParams.counts) && userParams.radius > 0)
-         % Search constrained to radius
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(1:3,elem:last),          ...
-                                           max(userParams.counts),          ...
-                                           'lim', userParams.radius);
-      elseif (~isempty(userParams.steps))
-         % Perform a fixed radius search
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.rnn(queries(1:3,elem:last),          ...
-                                           max(userParams.steps));
-      end
-
-      % Update the time bar.
-      if (toc > 1)
-         tic;
-         h = timebar(elem, elements, msg, tstart, h);
-      end
-   end
-
-   % Close the time bar, if still open.
-   if (all(ishghandle(h, 'figure')))
-      close(h);
-   end
-
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-   %***
-   % COMPUTE DUAL NEIGHBORHOODS
-   %***
-
-   disp('Computing Dual Neigborhoods...');
-   tstart=tic;
-   duals=fastsetdual(nbrs);
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-   %***
-   % COMPUTE NATIVE ATTRIBUTES
-   %***
-   disp('Computing Native Attributes...');
-   tstart=tic;
-
-   natives = nbrspanalyze(points, nbrs, test, 'timebar');
-
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-   %***
-   % COMPUTE NEIGHBORHOOD ATTRIBUTES
-   %***
-   disp('Computing Neighborhood Attributes...');
-   tstart=tic;
-   
-   feats = nbrspanalyze(points, nbrs, 'timebar');
-
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-   %***
-   % COMPUTE SIGNIFICANCES
-   %***
-   sigs=zeros(1,elements);
-
-   msg='Computing Significances...';
-   
-   disp(msg);
-   
-   tstart=tic;
-   h = timebar(1, elements, msg, tstart);
-
-   tic;
-
-   for elem=1:elements
-      sigs(elem)=abs(feats.entropy(elem)-natives.entropy(elem));
-
-      % Update the time bar.
-      if (toc > 1)
-         tic;
-         h = timebar(elem, elements, msg, tstart, h);
-      end
-   end
-
-   % Close the time bar, if still open.
-   if (all(ishghandle(h, 'figure')))
-      close(h);
-   end
-   
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-   %***
-   % PARTITION THE DATA SET
-   %***
-
-%   disp('Partition by Label...');
-%   tstart=tic;
-%
-%   parts = cell(1,dimensions);
-%
-%   for dim=1:dimensions
-%      parts{dim}=sort(uint64(find(feats.labeling==dim)),'ascend');
-%   end
-%
-%   [~,idx]=sort(cellfun('length',parts),'descend');
-%   parts=parts(idx);
-%   
-%   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-   %***
-   % THIN BY LABEL
-   %***
-
-%   fraction=0;
-
-   removed=zeros(1,elements-threshold);
-%   dual_size=zeros(1,elements-threshold);
-   current=1;
-
-%   removed_wgts=cell(1,3);
-   fellback = 0;
-
-%   for dim=1:dimensions
-%      desired  = threshold * length(parts{dim}) / elements + fraction;
-%      tau      = floor(desired);
-%      fraction = desired-tau;
-%      heap     = SplayTree(sigs(parts{dim}),parts{dim});
-%      n        = length(parts{dim})-tau;
-      
-%      removed_wgts{dim}=zeros(1,n);
-
-      tau=threshold;
-      heap = SplayTree(sigs,1:length(sigs));
-      n = length(sigs) - tau;
-      removed_wgts=zeros(1,n);
-      baseline=natives.entropy;
-
-      impact=zeros(1,n+1);
-      impact(1) = mean(natives.entropy);
-      
-%      msg=['Thin Dimension ' num2str(dim) '(' num2str(length(parts{dim}))  ...
-%                                          '->' num2str(tau) ')...'];
-      msg='Thin...';
-      tstart=tic;
-      h = timebar(1, n, msg, tstart);
-
-      disp(msg);
-      tic;
-
-      max_sig=0;
-      
-      for x=1:n
-         
-         % Locate the least significant point to remove
-         [wgt, idx]=heap.pop_head();
-
-         % Mark the point as removed
-         removed(current)=idx;
-%         removed_wgts{dim}(x)=wgt;
-         max_sig=max(max_sig, wgt);
-%         removed_wgts(x)=wgt;
-         removed_wgts(x)=max_sig;
-
-         impact(1 + x) = ((elements - x + 1) * impact(x) - natives.entropy(idx)) / ...
-                         (elements - x);
-%          impact(1 + x)
-
-         % Distribute the points in the test set to the neighbor's test sets.
-         neighbors = nbrs{idx};
-         samples   = test{idx};
-         
-         for samp=1:length(samples)
-            % Find the closest
-%            [dsq,new_idx]=min(sum((bsxfun(@minus, points(:,neighbors),     ...
-%                                          points(:,samples(samp)))).^2, 1));
-
-            [dsq,new_idx]=min(sum((bsxfun(@minus, points(1:3,neighbors),    ...
-                                          points(1:3,samples(samp)))).^2, 1));
-
-            % Update the test set
-            test{neighbors(new_idx)}(end + 1,1) = samples(samp);
-
-%            tdist(neighbors(new_idx)) = max(tdist(neighbors(new_idx)),     ...
-%                                            sqrt(dsq));
-         end
-
-         % The removed element neighborhood is eliminated, so it no longer
-         % contains the neighbors. Update the neighbor duals appropriately.
-         for nbr=1:length(neighbors)
-            duals{neighbors(nbr)}=duals{neighbors(nbr)}(duals{neighbors(nbr)}~=idx);
-         end
-
-         % Find neighborhoods that contain removed element
-         neighborhoods=duals{idx};
-%         dual_size(current)=length(neighborhoods);
-         neighborhoods=sort(neighborhoods(neighborhoods~=idx), 'ascend');
-
-         % The fallback neighborhood is identical for all neighborhoods, but
-         % may be expensive to compute. Allow it to be lazily instantiated.
-         fallback_pool = [];
-         
-         % Replace removed element in each neighborhood with nearest neighbor's
-         % neighbor
-         for hood=1:length(neighborhoods)
-
-            % Build up the list of potential new neighbors
-            nbr_pool=fastsetunion({nbrs{nbrs{neighborhoods(hood)}}});
-            non_nbrs=fastsetunion({nbrs{neighborhoods(hood)},idx,neighborhoods(hood)});
-            nbr_pool=nbr_pool(~ismembc(nbr_pool(:), non_nbrs(:)));
-
-            if (isempty(nbr_pool))
-               if (isempty(fallback_pool))
-                  fallback_pool = uint64(find(~ismember(1:size(points,2),removed)));
-               end
-               fellback = fellback + 1;
-               nbr_pool = fallback_pool;
-               nbr_pool=nbr_pool(~ismembc(nbr_pool(:), non_nbrs(:)));
-            end
-
-            [dsq,new_idx]=min(sum((bsxfun(@minus, points(1:3,nbr_pool),     ...
-                                          points(1:3,neighborhoods(hood)))).^2, 1));
-
-            % Update the neighborhood
-            new_dist = sqrt(dsq);
-
-            % Maintain a partially sorted list of indices by max distance.
-            if (new_dist > dists{neighborhoods(hood)}(end))
-               dists{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) = ...
-                  dists{neighborhoods(hood)}(end);
-               
-               nbrs{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) =  ...
-                  nbrs{neighborhoods(hood)}(end);
-
-               dists{neighborhoods(hood)}(end) = sqrt(dsq);
-               
-               nbrs{neighborhoods(hood)}(end)  = nbr_pool(new_idx);
-            else
-               dists{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) = ...
-                  sqrt(dsq);
-               
-               nbrs{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) =  ...
-                  nbr_pool(new_idx);
-            end
-            
-            if (isempty(nbrs{neighborhoods(hood)}))
-               disp(neighborhoods(hood));
-            end
-            
-            % Update the dual
-            duals{nbr_pool(new_idx)}(end + 1,1) = neighborhoods(hood);
-         end
-         
-         nbrs{idx}=[];
-         duals{idx}=[];
-         test{idx}=[];
-         
-         % Update analysis for elements
-         if (isempty(neighborhoods))
-            neighborhoods=neighbors;
-         end
-         
-         neighborhoods=fastsetunion({neighborhoods, neighbors});
-
-         if (~isempty(neighborhoods))
-            locfeats = nbrspanalyze(points,                                 ...
-                                    nbrs(neighborhoods));
-
-            locsigs=zeros(1,length(neighborhoods));
-
-            for hood=1:length(neighborhoods)
-                locsigs(hood)=max(abs(natives.entropy(test{neighborhoods(hood)})-locfeats.entropy(hood)));
-            end
-
-         % Update heap, where required
-%            updates=neighborhoods(ismembc(neighborhoods,parts{dim})).';
-%            sig_upd=locsigs(ismembc(neighborhoods,updates));
-            updates=neighborhoods';
-            sig_upd=locsigs;
-
-            heap.update(sig_upd,updates);
-            sigs(neighborhoods)=locsigs;
-         end
-         
-         current = current + 1;
-         
-         % Update the time bar.
-         if (toc > 1)
-            tic;
-            h = timebar(x, n, msg, tstart, h);
-         end
-      end
-      
-      % Close the time bar, if still open.
-      if (all(ishghandle(h, 'figure')))
-         close(h);
-      end
-      
-      disp(['...done in ' num2str(toc(tstart)) 's']);
-%   end
-
-   disp(['Generated fallback neighborhood pool ' num2str(fellback) ' time(s).']);
-   
-%   x_max=max(cellfun(@length, removed_wgts));
-%   y=nan(length(removed_wgts),x_max);
-   
-%   for dim=1:dimensions
-%      y(dim,1:length(removed_wgts{dim}))=removed_wgts{dim};
-%   end
-
-   x_max=length(removed_wgts);
-   y = removed_wgts;
-
-   figure, plot(1:x_max,y);
-   figure, plot(1:length(impact),impact);
-   
-%   results = points(:,~ismember(1:size(points,2),removed));
-   results = removed;
-
-end
-
-%******************************************************************************
-% parseInputs
-%******************************************************************************
-function [userParams] = parseInputs(varargin)
-   % Support function to parse inputs into userParams structure
-   %
-   % Parameters:
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    userParams - .
-
-   userParams = struct('radius', 0, 'neighbors', 0, 'counts', [], 'steps', []);
-   
-   if isempty(varargin)
-      error('Damkjer:InvalidOptions',                                       ...
-            ['A neighborhood size must be specified, either directly or '   ...
-             'via optional parameters.']);
-   end
-   
-   if length(varargin) == 1 || ~isnumeric(varargin{2})
-      value = varargin{1};
-      
-      if (isscalar(value)  &&                                               ...
-          isreal(value)    &&                                               ...
-          value >= 5)
-         userParams.neighbors = fix(value);
-      else
-         error('Damkjer:InvalidCount',                                      ...
-               ['Number of Neighbors must be a real valued positive '       ...
-                'integer greater or equal to 5: ' num2str(value)]);
-      end
-      
-      varargin(1) = [];
-   end
-   
-   % Parse the Property/Value pairs
-   if rem(length(varargin), 2) ~= 0
-      error('Damkjer:PropertyValueNotPair',                                 ...
-            ['Additional arguments must take the form of Property/Value '   ...
-             'pairs']);
-   end
-   
-   propertyNames = {'neighbors', 'radius', 'counts', 'steps'};
-
-   while ~isempty(varargin)
-      property = varargin{1};
-      value    = varargin{2};
-      
-      % If the property has been supplied in a shortened form, lengthen it
-      iProperty = find(strncmpi(property, propertyNames, length(property)));
-      
-      if isempty(iProperty)
-         error('Damkjer:InvalidProperty', 'Invalid Property');
-      elseif length(iProperty) > 1
-         error('Damkjer:AmbiguousProperty',                                 ...
-               'Supplied shortened property name is ambiguous');
-      end
-      
-      property = propertyNames{iProperty};
-      
-      switch property
-      case 'neighbors'
-         if (isscalar(value)  &&                                            ...
-             isreal(value)    &&                                            ...
-             value >= 5)
-          userParams.neighbors = fix(value);
-         else
-            error('Damkjer:InvalidCount',                                   ...
-                  ['Number of Neighbors must be a real valued positive '    ...
-                   'integer greater or equal to 5']);
-         end
-      case 'radius'
-         if (isscalar(value) &&                                             ...
-             isnumeric(value) &&                                            ...
-             isreal(value) &&                                               ...
-             value > 0)
-            userParams.radius = value;
-         else
-            error('Damkjer:InvalidRadius',                                  ...
-                  'Radius must be a real valued positive scalar');
-         end
-      case 'counts'
-         if (isvector(value)  &&                                            ...
-             isreal(value)    &&                                            ...
-             issorted(value)  &&                                            ...
-             all(value >= 5))
-            userParams.counts = fix(value);
-         else
-            error('Damkjer:InvalidCount',                                   ...
-                  ['Counts must be a sorted vector of real valued positive '...
-                   'integers greater or equal to 5']);
-         end
-      case 'steps'
-         if (isvector(value)  &&                                            ...
-             isreal(value)    &&                                            ...
-             issorted(value)  &&                                            ...
-             all(value > 0))
-            userParams.steps = value;
-         else
-            error('Damkjer:InvalidSteps',                                   ...
-                  ['Steps must be a sorted vector of real valued positive ' ...
-                   'values']);
-         end
-      end
-      
-      varargin(1:2) = [];
-   end
-
-   % Check for mutually exclusive options.
-   if (~isempty(userParams.counts) && userParams.neighbors >= 5)
-      error('Damkjer:MutExOpts',                                            ...
-            '''neighbors'' and ''counts'' options are mutually exclusive');
-   end
-   
-   if (~isempty(userParams.steps) && userParams.radius > 0)
-      error('Damkjer:MutExOpts',                                            ...
-            '''steps'' and ''radius'' options are mutually exclusive');
-   end
-   
-   if (~isempty(userParams.counts) && ~isempty(userParams.steps))
-      error('Damkjer:MutExOpts',                                            ...
-            '''steps'' and ''counts'' options are mutually exclusive');
-   end
-
-   % Default, if necessary.
-   if (userParams.neighbors <= 0 &&                                         ...
-       userParams.radius <= 0 &&                                            ...
-       isempty(userParams.counts) &&                                        ...
-       isempty(userParams.steps))
-      userParams.radius = 1;
-   end
-end
Index: mkjer/PointProcessing/Thinning_Damkjer/thin_Damkjer_old.m
===================================================================
--- Damkjer/PointProcessing/Thinning_Damkjer/thin_Damkjer_old.m	(revision 14)
+++ 	(revision )
@@ -1,812 +1,0 @@
-% Thin_Dyn   Point Cloud Thinning (Dyn et al)
-%
-% File: thin_Dyn.m
-%
-% Description:
-%    Perform thinning according to Dyn 2004.
-%
-% Limitations:
-%    No known limitations.
-%
-% Synopsis:
-%    [results] = spanalyse(points, threshold, ...)
-%
-% Inputs:
-%    points - .
-%    threshold - must be positive. between 0-1, treated as percentage, > 1
-%                points.
-%
-%    Option strings may be provided as abbreviations as long as they resolve to
-%    a unique option.
-%
-%    'neighbors' - .
-%    'radius'    - .
-%    'counts'    - .
-%    'steps'     - .
-%
-% Outputs:
-%    results - Thinned point cloud.
-%
-% Toolbox requirements:
-%    None.
-%
-% Code requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    Dyn reference.
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2013 Kristian L. Damkjer.
-%
-%   Software History:
-%      2013-DEC-28  Initial coding.
-%
-
-%******************************************************************************
-% thin_Dyn
-%******************************************************************************
-function [ results ] = thin_Damkjer( points, threshold, varargin )
-   % Perform local feature attribution via eigenspace analysis.
-   %
-   % Parameters:
-   %    points  - .
-   %
-   %    threshold - .
-   %
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    classes - Structure containing the spatial analysis classifications.
-   %
-   
-   userParams = parseInputs(varargin{:}); % Parse Inputs
-
-   %***
-   % CONFIRM UNIQUENESS
-   %***
-   
-   % Make sure that all points in the set are unique...
-   disp('Culling duplicate points...');
-   tstart=tic;
-   points = unique(points.','rows').';
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-   %***
-   % INDEX POINT SET
-   %***
-   disp('Indexing points...');
-   tstart=tic;
-   database = VpTree(points(1:3,:));
-   queries = points;
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-   %***
-   % CREATE NEIGHBORHOODS
-   %***
-
-   database.excludeWithin(0.000001); % Set um precision on searches.
-   
-   % Sizing metrics
-   dimensions=size(queries, 1);
-   elements=size(queries, 2);
-   
-   nbrs  = cell(1,elements);
-   dists = cell(1,elements);
-   test  = num2cell(1:elements, 1);
-
-%   sigfeats=zeros(dimensions, elements);
-
-   % This process may take a while. Display time bar while processing.
-   msg='Creating Neigborhoods...';
-   tstart=tic;
-   h = timebar(1, elements, msg, tstart);
-
-   disp(msg);
-
-   % Step through the queries in chunks.
-   step=1000;
-
-   tic;
-
-   for elem=1:step:elements
-
-      % The last available element may be closer than elem + step.
-      last=min(elem+step-1,elements);
-      
-      % Get the nearest neighbors of elem
-      if (userParams.radius > 0 && userParams.neighbors <= 0)
-         % Perform a fixed radius search
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.rnn(queries(1:3,elem:last),            ...
-                                           userParams.radius);
-      elseif (userParams.radius <= 0 && userParams.neighbors > 0)
-         % Search unconstrained neighbors
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(1:3,elem:last),            ...
-                                           userParams.neighbors);
-      elseif (userParams.radius > 0 && userParams.neighbors > 0)
-         % Search constrained to radius
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(1:3,elem:last),            ...
-                                           userParams.neighbors,            ...
-                                           'lim', userParams.radius);
-      elseif (~isempty(userParams.counts) && userParams.radius <= 0)
-         % Search unconstrained neighbors
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(1:3,elem:last),            ...
-                                           max(userParams.counts));
-      elseif (~isempty(userParams.counts) && userParams.radius > 0)
-         % Search constrained to radius
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(1:3,elem:last),            ...
-                                           max(userParams.counts),          ...
-                                           'lim', userParams.radius);
-      elseif (~isempty(userParams.steps))
-         % Perform a fixed radius search
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.rnn(queries(1:3,elem:last),            ...
-                                           max(userParams.steps));
-      end
-
-      % Update the time bar.
-      if (toc > 1)
-         tic;
-         h = timebar(elem, elements, msg, tstart, h);
-      end
-   end
-
-   % Close the time bar, if still open.
-   if (all(ishghandle(h, 'figure')))
-      close(h);
-   end
-
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-%% Obsolete code   
-%  %***
-%  % COMPUTE DUAL NEIGHBORHOODS (THIS IS SLOW. LET'S MEX IT)
-%  %***
-%
-%  % This process may take a while. Display time bar while processing.
-%  msg='Computing Dual Neigborhoods...';
-%  tstart=tic;
-%  h = timebar(1, elements, msg, tstart);
-%    
-%  disp(msg);
-% 
-%  tic;
-%  for elem=1:elements
-%       
-%     % Build up dual set
-%     for nbr=1:length(nbrs{elem})
-%        n = nbrs{elem}(nbr);
-%        duals{n}=[duals{n}(:); elem];
-%     end
-% 
-%     % Update the time bar.
-%     if (toc > 1)
-%        tic;
-%        h = timebar(elem, elements, msg, tstart, h);
-%     end
-%  end
-% 
-%  % Close the time bar, if still open.
-%  if (all(ishghandle(h, 'figure')))
-%     close(h);
-%  end
-% 
-%  disp(['...done in ' num2str(toc(tstart)) 's']);
-%%
-   
-   %***
-   % COMPUTE DUAL NEIGHBORHOODS
-   %***
-
-   disp('Computing Dual Neigborhoods...');
-   tstart=tic;
-   duals=fastsetdual(nbrs);
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-   %***
-   % COMPUTE NATIVE ATTRIBUTES
-   %***
-   disp('Computing Native Attributes...');
-   tstart=tic;
-
-   natives = nbrspanalyze(points, nbrs, test, 'timebar');
-
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-%   error('Stop');
-   
-%   radii=cellfun(@max,dists);
-%   biases=feats.dists2means./radii;
-%   tdist = zeros(1,elements);
-
-   %***
-   % COMPUTE NEIGHBORHOOD ATTRIBUTES
-   %***
-   disp('Computing Neighborhood Attributes...');
-   tstart=tic;
-   
-   feats = nbrspanalyze(points, nbrs, 'timebar');
-
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-   %***
-   % COMPUTE SIGNIFICANCES
-   %***
-   sigs=zeros(1,elements);
-
-   msg='Computing Significances...';
-   
-   disp(msg);
-   
-   tstart=tic;
-   h = timebar(1, elements, msg, tstart);
-
-   tic;
-
-%   nbrdims=zeros(dimensions,1);
-   
-   for elem=1:elements
-      
-% %      last=min(elem+step-1,elements);
-% 
-% %      feats.features(:,nbrs{elem})
-% %      feats.features(:,nbrs{elem}).^2
-% %      feats.features(:,nbrs{elem}).^2./length(nbrs{elem})
-% %      sum(feats.features(:,nbrs{elem}).^2./length(nbrs{elem}), 2)
-% %      rss=sqrt(sum(feats.features(:,nbrs{elem}).^2./length(nbrs{elem}), 2));
-% 
-% %      nbrdims(1:dimensions-1)=(rss(1:dimensions-1)-rss(2:dimensions))./...
-% %                               repmat(rss(1),dimensions-1,1);
-% %      nbrdims(dimensions)=rss(dimensions)./rss(1);
-% 
-% %      de=-sum(nbrdims.*log(nbrdims))./log(dimensions);
-% 
-%       natives.de(elem)
-%       feats.de(elem)
-%       feats.de(elem)-natives.de(elem)
-%       abs(feats.de(elem)-natives.de(elem))
-      
-%      sigs(elem)=abs(feats.de(elem)-natives.de(elem));
-      sigs(elem)=abs(feats.entropy(elem)-natives.entropy(elem));
-      
-% %       % Hausdorff DE is no-go
-% %       A=abs(bsxfun(@minus, feats.de(test{elem}), feats.de(nbrs{elem})));
-% %       sigs(elem)=max(max(min(A,[],1)),max(min(A,[],2)));
-
-%       error('Stop');
-
-      % Update the time bar.
-      if (toc > 1)
-         tic;
-         h = timebar(elem, elements, msg, tstart, h);
-      end
-   end
-
-   % Close the time bar, if still open.
-   if (all(ishghandle(h, 'figure')))
-      close(h);
-   end
-
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-  min(sigs)
-  max(sigs)
-  
-%   results = sigs;
-%end
-  
-%function cont
-%    error('Stop');
-   
-%   sigs = feats.de;
-%   sigs = sqrt(biases.*feats.de);
-%   sigs = 0.5 * (biases + feats.de);
-%   sigs = max(biases, feats.de);
-%   sigs = min(biases, feats.de);
-%   sigs = biases;
-
-% RMS DE for sigs in nbrhood and test?
-
-   %***
-   % PARTITION THE DATA SET
-   %***
-
-%   disp('Partition by Label...');
-%   tstart=tic;
-%
-%   parts = cell(1,dimensions);
-%
-%   for dim=1:dimensions
-%      parts{dim}=sort(uint64(find(feats.labeling==dim)),'ascend');
-%   end
-%
-%   [~,idx]=sort(cellfun('length',parts),'descend');
-%   parts=parts(idx);
-%   
-%   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-   %***
-   % THIN BY LABEL
-   %***
-
-%   fraction=0;
-
-   removed=zeros(1,elements-threshold);
-   dual_size=zeros(1,elements-threshold);
-   current=1;
-
-%   removed_wgts=cell(1,3);
-   fellback = 0;
-
-%   for dim=1:dimensions
-%      desired  = threshold * length(parts{dim}) / elements + fraction;
-%      tau      = floor(desired);
-%      fraction = desired-tau;
-%      heap     = SplayTree(sigs(parts{dim}),parts{dim});
-%      n        = length(parts{dim})-tau;
-      
-%      removed_wgts{dim}=zeros(1,n);
-
-      tau=threshold;
-      heap = SplayTree(sigs,1:length(sigs));
-      n = length(sigs) - tau;
-      removed_wgts=zeros(1,n);
-
-%      msg=['Thin Dimension ' num2str(dim) '(' num2str(length(parts{dim})) ...
-%                                          '->' num2str(tau) ')...'];
-      msg='Thin...';
-      tstart=tic;
-      h = timebar(1, n, msg, tstart);
-
-      disp(msg);
-      tic;
-
-      for x=1:n
-
-         % Locate the least significant point to remove
-         [wgt, idx]=heap.pop_head();
-
-%         idx
-%         wgt
-         
-         % Mark the point as removed
-         removed(current)=idx;
-%         removed_wgts{dim}(x)=wgt;
-         removed_wgts(x)=wgt;
-
-
-         % Distribute the points in the test set to the neighbor's test sets.
-         neighbors = nbrs{idx};
-         samples   = test{idx};
-         
-%         neighbors
-%         samples
-         
-         for samp=1:length(samples)
-            % Find the closest
-%            [dsq,new_idx]=min(sum((bsxfun(@minus, points(:,neighbors), ...
-%                                          points(:,samples(samp)))).^2, 1));
-            [dsq,new_idx]=min(sum((bsxfun(@minus, points(1:3,neighbors), ...
-                                          points(1:3,samples(samp)))).^2, 1));
-
-%             samples(samp)
-%             points(1:3,neighbors)
-%             points(1:3,samples(samp))
-%             dsq
-%             new_idx
-%             neighbors(new_idx)
-
-            % Update the test set
-            test{neighbors(new_idx)}(end + 1,1) = samples(samp);
-
-%            tdist(neighbors(new_idx)) = max(tdist(neighbors(new_idx)),...
-%                                            sqrt(dsq));
-         end
-         
-%         duals{neighbors}
-         
-         % The removed element neighborhood is eliminated, so it no longer
-         % contains the neighbors. Update the neighbor duals appropriately.
-         for nbr=1:length(neighbors)
-            duals{neighbors(nbr)}=duals{neighbors(nbr)}(duals{neighbors(nbr)}~=idx);
-         end
-
-%         duals{neighbors}
-
-         % Find neighborhoods that contain removed element
-         neighborhoods=duals{idx};
-         dual_size(current)=length(neighborhoods);
-         neighborhoods=sort(neighborhoods(neighborhoods~=idx), 'ascend');
-
-         % The fallback neighborhood is identical for all neighborhoods, but
-         % may be expensive to compute. Allow it to be lazily instantiated.
-         fallback_pool = [];
-         
-         % Replace removed element in each neighborhood with nearest neighbor's
-         % neighbor
-         for hood=1:length(neighborhoods)
-
-            % Build up the list of potential new neighbors
-%            disp('building candidates...');
-
-%% Obsolete code
-%            nbr_pool=unique(vertcat(nbrs{nbrs{neighborhoods(hood)}}));
-%            nbr_pool=setdiff(nbr_pool, idx);
-%            nbr_pool=setdiff(nbr_pool, nbrs{neighborhoods(hood)});
-%%
-            nbr_pool=fastsetunion({nbrs{nbrs{neighborhoods(hood)}}});
-            non_nbrs=fastsetunion({nbrs{neighborhoods(hood)},idx,neighborhoods(hood)});
-            nbr_pool=nbr_pool(~ismembc(nbr_pool(:), non_nbrs(:)));
-
-            if (isempty(nbr_pool))
-               if (isempty(fallback_pool))
-                  fallback_pool = uint64(find(~ismember(1:size(points,2),removed)));
-               end
-               fellback = fellback + 1;
-               nbr_pool = fallback_pool;
-               nbr_pool=nbr_pool(~ismembc(nbr_pool(:), non_nbrs(:)));
-            end
-
-            % Find the closest
-%            disp('finding closest...');
-
-%% Obsolete code
-%            % Don't use VP Tree for single nearest neighbor... overhead not
-%            % worth it.
-%            locdb = VpTree(points(:,nbr_pool));
-%            nn=locdb.knn(points(:,idx),1);
-%            new_idx=nn{1}
-%%
-%             points(1:3,nbr_pool)
-%             points(1:3,neighborhoods(hood))
-%             
-            [dsq,new_idx]=min(sum((bsxfun(@minus, points(1:3,nbr_pool), ...
-                                          points(1:3,neighborhoods(hood)))).^2, 1));
-
-%             points(1:3,nbr_pool)
-%             points(1:3,neighborhoods(hood))
-%             bsxfun(@minus, points(1:3,nbr_pool), points(1:3,neighborhoods(hood)))
-%             (bsxfun(@minus, points(1:3,nbr_pool), points(1:3,neighborhoods(hood)))).^2
-%             sum((bsxfun(@minus, points(1:3,nbr_pool), points(1:3,neighborhoods(hood)))).^2,1)
-%             [dsq,new_idx]=min(sum((bsxfun(@minus, points(1:3,nbr_pool), points(1:3,neighborhoods(hood)))).^2,1))
-
-            % Update the neighborhood
-%            disp('updating neighborhood...'); 
-
-            new_dist = sqrt(dsq);
-
-%             new_idx
-%             new_dist
-%             nbr_pool(new_idx)
-%             neighborhoods(hood)
-%             nbrs{neighborhoods(hood)}
-%             dists{neighborhoods(hood)}
-            
-            % Maintain a partially sorted list of indices by max distance.
-            if (new_dist > dists{neighborhoods(hood)}(end))
-               dists{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) = ...
-                  dists{neighborhoods(hood)}(end);
-               
-               nbrs{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) =  ...
-                  nbrs{neighborhoods(hood)}(end);
-
-               dists{neighborhoods(hood)}(end) = sqrt(dsq);
-               
-               nbrs{neighborhoods(hood)}(end)  = nbr_pool(new_idx);
-            else
-               dists{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) = ...
-                  sqrt(dsq);
-               
-               nbrs{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) =  ...
-                  nbr_pool(new_idx);
-            end
-            
-%            nbrs{neighborhoods(hood)}
-%            dists{neighborhoods(hood)}
-            
-            % Update the dual
-%            disp('updating dual...');
-
-
-%            duals{nbr_pool(new_idx)}
-            duals{nbr_pool(new_idx)}(end + 1,1) = neighborhoods(hood);
-%            duals{nbr_pool(new_idx)}
-%             disp(nbrs{neighborhoods(hood)});
-%             disp(duals{nbr_pool(new_idx)});
-
-%             error('stop');
-
-         end
-         
-         nbrs{idx}=[];
-         duals{idx}=[];
-         test{idx}=[];
-         
-         % Update analysis for elements
-%         disp('updating analysis...');
-
-         if (isempty(neighborhoods))
-            warning('id1','empty neighborhoods');
-         end
-         
-         if (isempty(neighbors))
-            warning('id2','empty neighbors');
-         end
-         
-%         if (~isempty(neighborhoods) && ~isempty(neighbors))
-         neighborhoods=fastsetunion({neighborhoods, neighbors});
-%         elseif (isempty(neighborhoods) && ~isempty(neighbors))
-%            neighborhoods=neighbors;
-%         end
-         
-%         nbrs{neighborhoods}
-%         test{neighborhoods}
-         
-%         error('Stop');
-
-         if (~isempty(neighborhoods))
-            locfeats = nbrspanalyze(points,                                 ...
-                                    nbrs(neighborhoods));
-%            locfeats = nbrspanalyze(points,                                 ...
-%                                    nbrs(neighborhoods),                    ...
-%                                    test(neighborhoods));
-
-            locsigs=zeros(1,length(neighborhoods));
-
-            % Hausdorff DE is no-go
-            for hood=1:length(neighborhoods)
-%                rss=sqrt(sum(feats.features(:,nbrs{neighborhoods(hood)}).^2./length(nbrs{neighborhoods(hood)}), 2));
-
-%                nbrdims(1:dimensions-1)=(rss(1:dimensions-1)-rss(2:dimensions))./...
-%                                         repmat(rss(1),dimensions-1,1);
-%                nbrdims(dimensions)=rss(dimensions)./rss(1);
-
-%                de=-sum(nbrdims.*log(nbrdims))./log(dimensions);
-
-%                feats.de(test{elem})
-%                feats.de(test{elem})-de
-%                abs(feats.de(test{elem})-de)
-      
-%                locsigs(hood)=max(abs(feats.de(test{neighborhoods(hood)})-de));
-
-%                hood
-%                neighborhoods(hood)
-%                sigs(neighborhoods(hood))
-%                locfeats.entropy(hood)
-%                feats.entropy(test{neighborhoods(hood)})
-%                natives.entropy(test{neighborhoods(hood)})
-%                natives.entropy(test{neighborhoods(hood)})-locfeats.entropy(hood)
-%                abs(natives.entropy(test{neighborhoods(hood)})-locfeats.entropy(hood))
-%                max(abs(natives.entropy(test{neighborhoods(hood)})-locfeats.entropy(hood)))
-                
-
-                locsigs(hood)=max(abs(natives.entropy(test{neighborhoods(hood)})-locfeats.entropy(hood)));
-                
-%                error('Stop');
-                
-%               A=abs(bsxfun(@minus, feats.de(test{neighborhoods(hood)}).', feats.de(nbrs{neighborhoods(hood)})));
-%               locsigs(hood)=max(max(min(A,[],1)),max(min(A,[],2)));
-            end
-
-%            radii(neighborhoods)=cellfun(@max,dists(neighborhoods));
-%            radii(neighborhoods)=max(radii(neighborhoods), tdist(neighborhoods));
-%            biases(neighborhoods)=(locfeats.dists2means)./(radii(neighborhoods));
-            
-%            locsigs = locfeats.de;
-%            locsigs = sqrt(biases(neighborhoods).*locfeats.de);
-%            locsigs = 0.5 * (biases(neighborhoods) + locfeats.de);
-%            locsigs = max(biases(neighborhoods), locfeats.de);
-%            locsigs = min(biases(neighborhoods), locfeats.de);
-%            locsigs = biases(neighborhoods);
-
-%            locsigs
-%            sigs(neighborhoods)
-%            error('Stop');
-         
-         % Update heap, where required
-%            updates=neighborhoods(ismembc(neighborhoods,parts{dim})).';
-%            sig_upd=locsigs(ismembc(neighborhoods,updates));
-            updates=neighborhoods';
-            sig_upd=locsigs;
-
-            heap.erase(sigs(updates),updates);
-            heap.insert(sig_upd,updates);
-            sigs(neighborhoods)=locsigs;
-%            feats.de(neighborhoods)=locfeats.de;
-%            feats.dists2means(neighborhoods)=locfeats.dists2means;
-%            feats.biases(neighborhoods)=locfeats.biases;
-         end
-         
-         current = current + 1;
-         
-         % Update the time bar.
-         if (toc > 1)
-            tic;
-            h = timebar(x, n, msg, tstart, h);
-         end
-      end
-      
-      % Close the time bar, if still open.
-      if (all(ishghandle(h, 'figure')))
-         close(h);
-      end
-      
-      disp(['...done in ' num2str(toc(tstart)) 's']);   
-%   end
-
-   disp(['Generated fallback neighborhood pool ' num2str(fellback) ' time(s).']);
-   
-%   x_max=max(cellfun(@length, removed_wgts));
-%   y=nan(length(removed_wgts),x_max);
-   
-%   for dim=1:dimensions
-%      y(dim,1:length(removed_wgts{dim}))=removed_wgts{dim};
-%   end
-
-   x_max=length(removed_wgts);
-   y = removed_wgts;
-
-   figure, plot(1:x_max,y);
-   figure, plot(1:length(dual_size),dual_size);
-
-%   results = points(:,~ismember(1:size(points,2),removed));
-   results = removed;
-
-end
-
-%******************************************************************************
-% parseInputs
-%******************************************************************************
-function [userParams] = parseInputs(varargin)
-   % Support function to parse inputs into userParams structure
-   %
-   % Parameters:
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    userParams - .
-
-   userParams = struct('radius', 0, 'neighbors', 0, 'counts', [], 'steps', []);
-   
-   if isempty(varargin)
-      error('Damkjer:InvalidOptions', ...
-            ['A neighborhood size must be specified, either directly or '...
-             'via optional parameters.']);
-   end
-   
-   if length(varargin) == 1 || ~isnumeric(varargin{2})
-      value = varargin{1};
-      
-      if (isscalar(value)  && ...
-          isreal(value)    && ...
-          value >= 5)
-         userParams.neighbors = fix(value);
-      else
-         error('Damkjer:InvalidCount', ...
-               ['Number of Neighbors must be a real valued positive '...
-                'integer greater or equal to 5: ' num2str(value)]);
-      end
-      
-      varargin(1) = [];
-   end
-   
-   % Parse the Property/Value pairs
-   if rem(length(varargin), 2) ~= 0
-      error('Damkjer:PropertyValueNotPair', ...
-            ['Additional arguments must take the form of Property/Value '...
-             'pairs']);
-   end
-   
-   propertyNames = {'neighbors', 'radius', 'counts', 'steps'};
-
-   while ~isempty(varargin)
-      property = varargin{1};
-      value    = varargin{2};
-      
-      % If the property has been supplied in a shortened form, lengthen it
-      iProperty = find(strncmpi(property, propertyNames, length(property)));
-      
-      if isempty(iProperty)
-         error('Damkjer:InvalidProperty', 'Invalid Property');
-      elseif length(iProperty) > 1
-         error('Damkjer:AmbiguousProperty', ...
-               'Supplied shortened property name is ambiguous');
-      end
-      
-      property = propertyNames{iProperty};
-      
-      switch property
-      case 'neighbors'
-         if (isscalar(value)  && ...
-             isreal(value)    && ...
-             value >= 5)
-          userParams.neighbors = fix(value);
-         else
-            error('Damkjer:InvalidCount', ...
-                  ['Number of Neighbors must be a real valued positive '...
-                   'integer greater or equal to 5']);
-         end
-      case 'radius'
-         if (isscalar(value) && ...
-             isnumeric(value) && ...
-             isreal(value) && ...
-             value > 0)
-            userParams.radius = value;
-         else
-            error('Damkjer:InvalidRadius', ...
-                  'Radius must be a real valued positive scalar');
-         end
-      case 'counts'
-         if (isvector(value)  && ...
-             isreal(value)    && ...
-             issorted(value)  && ...
-             all(value >= 5))
-            userParams.counts = fix(value);
-         else
-            error('Damkjer:InvalidCount', ...
-                  ['Counts must be a sorted vector of real valued positive '...
-                   'integers greater or equal to 5']);
-         end
-      case 'steps'
-         if (isvector(value)  && ...
-             isreal(value)    && ...
-             issorted(value)  && ...
-             all(value > 0))
-            userParams.steps = value;
-         else
-            error('Damkjer:InvalidSteps', ...
-                  ['Steps must be a sorted vector of real valued positive '...
-                   'values']);
-         end
-      end
-      
-      varargin(1:2) = [];
-   end
-
-   % Check for mutually exclusive options.
-   if (~isempty(userParams.counts) && userParams.neighbors >= 5)
-      error('Damkjer:MutExOpts', ...
-            '''neighbors'' and ''counts'' options are mutually exclusive');
-   end
-   
-   if (~isempty(userParams.steps) && userParams.radius > 0)
-      error('Damkjer:MutExOpts', ...
-            '''steps'' and ''radius'' options are mutually exclusive');
-   end
-   
-   if (~isempty(userParams.counts) && ~isempty(userParams.steps))
-      error('Damkjer:MutExOpts', ...
-            '''steps'' and ''counts'' options are mutually exclusive');
-   end
-
-   % Default, if necessary.
-   if (userParams.neighbors <= 0 && ...
-       userParams.radius <= 0 && ...
-       isempty(userParams.counts) && ...
-       isempty(userParams.steps))
-      userParams.radius = 1;
-   end
-end
Index: mkjer/PointProcessing/Thinning_Dyn/thin_Dyn.m
===================================================================
--- Damkjer/PointProcessing/Thinning_Dyn/thin_Dyn.m	(revision 14)
+++ 	(revision )
@@ -1,677 +1,0 @@
-% Thin_Dyn   Point Cloud Thinning (Dyn et al)
-%
-% File: thin_Dyn.m
-%
-% Description:
-%    Perform thinning according to Dyn 2004.
-%
-% Limitations:
-%    No known limitations.
-%
-% Synopsis:
-%    [results] = spanalyse(points, threshold, ...)
-%
-% Inputs:
-%    points - .
-%    threshold - must be positive. between 0-1, treated as percentage, > 1
-%                points.
-%
-%    Option strings may be provided as abbreviations as long as they resolve to
-%    a unique option.
-%
-%    'neighbors' - .
-%    'radius'    - .
-%    'counts'    - .
-%    'steps'     - .
-%
-% Outputs:
-%    results - Thinned point cloud.
-%
-% Toolbox requirements:
-%    None.
-%
-% Code requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    Dyn reference.
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2013 Kristian L. Damkjer.
-%
-%   Software History:
-%      2013-DEC-28  Initial coding.
-%
-
-%******************************************************************************
-% thin_Dyn
-%******************************************************************************
-function [ results ] = thin_Dyn( points, threshold, varargin )
-   % Perform local feature attribution via eigenspace analysis.
-   %
-   % Parameters:
-   %    points  - .
-   %
-   %    threshold - .
-   %
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    classes - Structure containing the spatial analysis classifications.
-   %
-   
-   userParams = parseInputs(varargin{:}); % Parse Inputs
-
-   %***
-   % CONFIRM UNIQUENESS
-   %***
-   
-   % Make sure that all points in the set are unique...
-   disp('Culling duplicate points...');
-   tstart=tic;
-   points = unique(points.','rows').';
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-   %***
-   % INDEX POINT SET
-   %***
-   disp('Indexing points...');
-   tstart=tic;
-   database = VpTree(points);
-   queries = points;
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-   %***
-   % CREATE NEIGHBORHOODS
-   %***
-
-   database.excludeWithin(0.00001); % Set um precision on searches.
-   
-   % Sizing metrics
-   dimensions=size(queries, 1);
-   elements=size(queries, 2);
-   
-   nbrs  = cell(1,elements);
-   dists = cell(1,elements);
-   test  = num2cell(1:elements, 1);
-
-   % This process may take a while. Display time bar while processing.
-   msg='Creating Neigborhoods...';
-   tstart=tic;
-   h = timebar(1, elements, msg, tstart);
-
-   disp(msg);
-
-   % Step through the queries in chunks.
-   step=1000;
-
-   tic;
-
-   for elem=1:step:elements
-
-      % The last available element may be closer than elem + step.
-      last=min(elem+step-1,elements);
-      
-      % Get the nearest neighbors of elem
-      if (userParams.radius > 0 && userParams.neighbors <= 0)
-         % Perform a fixed radius search
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.rnn(queries(:,elem:last),            ...
-                                           userParams.radius);
-      elseif (userParams.radius <= 0 && userParams.neighbors > 0)
-         % Search unconstrained neighbors
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(:,elem:last),            ...
-                                           userParams.neighbors);
-      elseif (userParams.radius > 0 && userParams.neighbors > 0)
-         % Search constrained to radius
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(:,elem:last),            ...
-                                           userParams.neighbors,            ...
-                                           'lim', userParams.radius);
-      elseif (~isempty(userParams.counts) && userParams.radius <= 0)
-         % Search unconstrained neighbors
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(:,elem:last),            ...
-                                           max(userParams.counts));
-      elseif (~isempty(userParams.counts) && userParams.radius > 0)
-         % Search constrained to radius
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.knn(queries(:,elem:last),            ...
-                                           max(userParams.counts),          ...
-                                           'lim', userParams.radius);
-      elseif (~isempty(userParams.steps))
-         % Perform a fixed radius search
-         [nbrs(elem:last),                                                  ...
-          dists(elem:last)] = database.rnn(queries(:,elem:last),            ...
-                                           max(userParams.steps));
-      end
-
-      % Update the time bar.
-      if (toc > 1)
-         tic;
-         h = timebar(elem, elements, msg, tstart, h);
-      end
-   end
-
-   % Close the time bar, if still open.
-   if (all(ishghandle(h, 'figure')))
-      close(h);
-   end
-
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-   min(cellfun(@min, dists))
-   
-%   error('Stop');
-
-%% Obsolete code   
-%  %***
-%  % COMPUTE DUAL NEIGHBORHOODS (THIS IS SLOW. LET'S MEX IT)
-%  %***
-%
-%  % This process may take a while. Display time bar while processing.
-%  msg='Computing Dual Neigborhoods...';
-%  tstart=tic;
-%  h = timebar(1, elements, msg, tstart);
-%    
-%  disp(msg);
-% 
-%  tic;
-%  for elem=1:elements
-%       
-%     % Build up dual set
-%     for nbr=1:length(nbrs{elem})
-%        n = nbrs{elem}(nbr);
-%        duals{n}=[duals{n}(:); elem];
-%     end
-% 
-%     % Update the time bar.
-%     if (toc > 1)
-%        tic;
-%        h = timebar(elem, elements, msg, tstart, h);
-%     end
-%  end
-% 
-%  % Close the time bar, if still open.
-%  if (all(ishghandle(h, 'figure')))
-%     close(h);
-%  end
-% 
-%  disp(['...done in ' num2str(toc(tstart)) 's']);
-%%
-   
-   %***
-   % COMPUTE DUAL NEIGHBORHOODS
-   %***
-
-   disp('Computing Dual Neigborhoods...');
-   tstart=tic;
-   duals=fastsetdual(nbrs);
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-   %***
-   % COMPUTE SIGNIFICANCES
-   %***
-   disp('Computing Initial Significances...');
-%    tstart=tic;
-% 
-% %   feats = nbrspanalyze(points, nbrs, 'timebar');
-% 
-%    feats = nbrspanalyze(points, nbrs, test, 'timebar');
-% 
-%    disp(['...done in ' num2str(toc(tstart)) 's']);
-% 
-% %   error('Stop');
-%    
-%    radii=cellfun(@max,dists);
-%    biases=feats.dists2means./radii;
-%    tdist = zeros(1,elements);
-%    
-% %   sigs = feats.de;
-% %   sigs = sqrt(biases.*feats.de);
-% %   sigs = 0.5 * (biases + feats.de);
-%    sigs = max(biases, feats.de);
-% %   sigs = min(biases, feats.de);
-% %   sigs = biases;
-
-   msg='Computing Significances...';
-   tstart=tic;
-   h = timebar(1, elements, msg, tstart);
-   
-   % Step through the queries in chunks.
-   step=1000;
-
-   tic;
-
-   sigs=zeros(1,elements);
-   
-   for elem=1:step:elements
-
-      % The last available element may be closer than elem + step.
-      last=min(elem+step-1,elements);
-
-      % Compute significance
-      sigs(elem:last)=sig_Dyn(points,test(elem:last),nbrs(elem:last));
-
-      % Update the time bar.
-      if (toc > 1)
-         tic;
-         h = timebar(elem, elements, msg, tstart, h);
-      end
-   end
-
-   % Close the time bar, if still open.
-   if (all(ishghandle(h, 'figure')))
-      close(h);
-   end
-
-   results=sigs;
-   
-end
-
-function cont
-%   error('Stop')
-
-   %***
-   % PARTITION THE DATA SET
-   %***
-
-%   disp('Partition by Label...');
-%   tstart=tic;
-%
-%   parts = cell(1,dimensions);
-%
-%   for dim=1:dimensions
-%      parts{dim}=sort(uint64(find(feats.labeling==dim)),'ascend');
-%   end
-%
-%   [~,idx]=sort(cellfun('length',parts),'descend');
-%   parts=parts(idx);
-%   
-%   disp(['...done in ' num2str(toc(tstart)) 's']);
-
-   %***
-   % THIN BY LABEL
-   %***
-
-%   fraction=0;
-
-   removed=zeros(1,elements-threshold);
-   dual_size=zeros(1,elements-threshold);
-   current=1;
-
-%   removed_wgts=cell(1,3);
-   fellback = 0;
-
-%   for dim=1:dimensions
-%      desired  = threshold * length(parts{dim}) / elements + fraction;
-%      tau      = floor(desired);
-%      fraction = desired-tau;
-%      heap     = SplayTree(sigs(parts{dim}),parts{dim});
-%      n        = length(parts{dim})-tau;
-      
-%      removed_wgts{dim}=zeros(1,n);
-
-      tau=threshold;
-      heap = SplayTree(sigs,1:length(sigs));
-      n = length(sigs) - tau;
-      removed_wgts=zeros(1,n);
-
-%      msg=['Thin Dimension ' num2str(dim) '(' num2str(length(parts{dim})) ...
-%                                          '->' num2str(tau) ')...'];
-      msg='Thin...';
-      tstart=tic;
-      h = timebar(1, n, msg, tstart);
-
-      disp(msg);
-      tic;
-
-      for x=1:n
-
-         % Locate the least significant point to remove
-         [wgt, idx]=heap.pop_head();
-
-         % Mark the point as removed
-         removed(current)=idx;
-%         removed_wgts{dim}(x)=wgt;
-         removed_wgts(x)=wgt;
-
-
-         % Distribute the points in the test set to the neighbor's test sets.
-         neighbors = nbrs{idx};
-         samples   = test{idx};
-         
-         for samp=1:length(samples)
-            % Find the closest
-            [~,new_idx]=min(sum((bsxfun(@minus, points(:,neighbors), ...
-                                        points(:,samples(samp)))).^2, 1));
-
-            % Update the test set
-            test{neighbors(new_idx)}(end + 1,1) = samples(samp);
-            
-%            tdist(neighbors(new_idx)) = max(tdist(neighbors(new_idx)),...
-%                                            sqrt(dsq));
-         end
-         
-         % The removed element neighborhood is eliminated, so it no longer
-         % contains the neighbors. Update the neighbor duals appropriately.
-         for nbr=1:length(neighbors)
-            duals{neighbors(nbr)}=duals{neighbors(nbr)}(duals{neighbors(nbr)}~=idx);
-         end
-
-         % Find neighborhoods that contain removed element
-         neighborhoods=duals{idx};
-         dual_size(current)=length(neighborhoods);
-         neighborhoods=sort(neighborhoods(neighborhoods~=idx), 'ascend');
-
-         % The fallback neighborhood is identical for all neighborhoods, but
-         % may be expensive to compute. Allow it to be lazily instantiated.
-         fallback_pool = [];
-         
-         % Replace removed element in each neighborhood with nearest neighbor's
-         % neighbor
-         for hood=1:length(neighborhoods)
-
-            % Build up the list of potential new neighbors
-%            disp('building candidates...');
-
-%% Obsolete code
-%            nbr_pool=unique(vertcat(nbrs{nbrs{neighborhoods(hood)}}));
-%            nbr_pool=setdiff(nbr_pool, idx);
-%            nbr_pool=setdiff(nbr_pool, nbrs{neighborhoods(hood)});
-%%
-            nbr_pool=fastsetunion({nbrs{nbrs{neighborhoods(hood)}}});
-            non_nbrs=fastsetunion({nbrs{neighborhoods(hood)},idx,neighborhoods(hood)});
-            nbr_pool=nbr_pool(~ismembc(nbr_pool(:), non_nbrs(:)));
-
-            if (isempty(nbr_pool))
-               if (isempty(fallback_pool))
-                  fallback_pool = uint64(find(~ismember(1:size(points,2),removed)));
-               end
-               fellback = fellback + 1;
-               nbr_pool = fallback_pool;
-               nbr_pool=nbr_pool(~ismembc(nbr_pool(:), non_nbrs(:)));
-            end
-
-            % Find the closest
-%            disp('finding closest...');
-
-%% Obsolete code
-%            % Don't use VP Tree for single nearest neighbor... overhead not
-%            % worth it.
-%            locdb = VpTree(points(:,nbr_pool));
-%            nn=locdb.knn(points(:,idx),1);
-%            new_idx=nn{1}
-%%
-            [dsq,new_idx]=min(sum((bsxfun(@minus, points(:,nbr_pool), ...
-                                          points(:,neighborhoods(hood)))).^2, 1));
-
-            % Update the neighborhood
-%            disp('updating neighborhood...'); 
-
-            new_dist = sqrt(dsq);
-
-            % Maintain a partially sorted list of indices by max distance.
-            if (new_dist > dists{neighborhoods(hood)}(end))
-               dists{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) = ...
-                  dists{neighborhoods(hood)}(end);
-               
-               nbrs{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) =  ...
-                  nbrs{neighborhoods(hood)}(end);
-
-               dists{neighborhoods(hood)}(end) = sqrt(dsq);
-               
-               nbrs{neighborhoods(hood)}(end)  = nbr_pool(new_idx);
-            else
-               dists{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) = ...
-                  sqrt(dsq);
-               
-               nbrs{neighborhoods(hood)}(nbrs{neighborhoods(hood)}==idx) =  ...
-                  nbr_pool(new_idx);
-            end
-            
-            % Update the dual
-%            disp('updating dual...');
-            duals{nbr_pool(new_idx)}(end + 1,1) = neighborhoods(hood);
-            
-%             disp(nbrs{neighborhoods(hood)});
-%             disp(duals{nbr_pool(new_idx)});
-         end
-         
-         nbrs{idx}=[];
-         duals{idx}=[];
-         test{idx}=[];
-         
-         % Update analysis for elements
-%         disp('updating analysis...');
-
-         neighborhoods=fastsetunion({neighborhoods, neighbors});
-         
-%         nbrs{neighborhoods}
-%         test{neighborhoods}
-         
-%         error('Stop');
-
-         if (~isempty(neighborhoods))
-
-             locsigs=sig_Dyn(points,test(neighborhoods),nbrs(neighborhoods));
-
-
-%            locfeats = nbrspanalyze(points,                                 ...
-%                                    nbrs(neighborhoods),                    ...
-%                                    test(neighborhoods));
-            
-%            radii(neighborhoods)=cellfun(@max,dists(neighborhoods));
-%            radii(neighborhoods)=max(radii(neighborhoods), tdist(neighborhoods));
-%            biases(neighborhoods)=(locfeats.dists2means)./(radii(neighborhoods));
-            
-%            locsigs = locfeats.de;
-%            locsigs = sqrt(biases(neighborhoods).*locfeats.de);
-%            locsigs = 0.5 * (biases(neighborhoods) + locfeats.de);
-%            locsigs = max(biases(neighborhoods), locfeats.de);
-%            locsigs = min(biases(neighborhoods), locfeats.de);
-%            locsigs = biases(neighborhoods);
-
-         % Update heap, where required
-%            updates=neighborhoods(ismembc(neighborhoods,parts{dim})).';
-%            sig_upd=locsigs(ismembc(neighborhoods,updates));
-            updates=neighborhoods';
-            sig_upd=locsigs;
-
-            heap.erase(sigs(updates),updates);
-            heap.insert(sig_upd,updates);
-            sigs(neighborhoods)=locsigs;
-%            feats.de(neighborhoods)=locfeats.de;
-%            feats.dists2means(neighborhoods)=locfeats.dists2means;
-%            feats.biases(neighborhoods)=locfeats.biases;
-         end
-         
-         current = current + 1;
-         
-         % Update the time bar.
-         if (toc > 1)
-            tic;
-            h = timebar(x, n, msg, tstart, h);
-         end
-      end
-      
-      % Close the time bar, if still open.
-      if (all(ishghandle(h, 'figure')))
-         close(h);
-      end
-      
-      disp(['...done in ' num2str(toc(tstart)) 's']);   
-%   end
-
-   disp(['Generated fallback neighborhood pool ' num2str(fellback) ' time(s).']);
-   
-%   x_max=max(cellfun(@length, removed_wgts));
-%   y=nan(length(removed_wgts),x_max);
-   
-%   for dim=1:dimensions
-%      y(dim,1:length(removed_wgts{dim}))=removed_wgts{dim};
-%   end
-
-   x_max=length(removed_wgts);
-   y = removed_wgts;
-
-   figure, plot(1:x_max,y);
-   figure, plot(1:length(dual_size),dual_size);
-
-%   results = points(:,~ismember(1:size(points,2),removed));
-   results = removed;
-
-end
-
-%******************************************************************************
-% parseInputs
-%******************************************************************************
-function [userParams] = parseInputs(varargin)
-   % Support function to parse inputs into userParams structure
-   %
-   % Parameters:
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    userParams - .
-
-   userParams = struct('radius', 0, 'neighbors', 0, 'counts', [], 'steps', []);
-   
-   if isempty(varargin)
-      error('Damkjer:InvalidOptions', ...
-            ['A neighborhood size must be specified, either directly or '...
-             'via optional parameters.']);
-   end
-   
-   if length(varargin) == 1 || ~isnumeric(varargin{2})
-      value = varargin{1};
-      
-      if (isscalar(value)  && ...
-          isreal(value)    && ...
-          value >= 5)
-         userParams.neighbors = fix(value);
-      else
-         error('Damkjer:InvalidCount', ...
-               ['Number of Neighbors must be a real valued positive '...
-                'integer greater or equal to 5: ' num2str(value)]);
-      end
-      
-      varargin(1) = [];
-   end
-   
-   % Parse the Property/Value pairs
-   if rem(length(varargin), 2) ~= 0
-      error('Damkjer:PropertyValueNotPair', ...
-            ['Additional arguments must take the form of Property/Value '...
-             'pairs']);
-   end
-   
-   propertyNames = {'neighbors', 'radius', 'counts', 'steps'};
-
-   while ~isempty(varargin)
-      property = varargin{1};
-      value    = varargin{2};
-      
-      % If the property has been supplied in a shortened form, lengthen it
-      iProperty = find(strncmpi(property, propertyNames, length(property)));
-      
-      if isempty(iProperty)
-         error('Damkjer:InvalidProperty', 'Invalid Property');
-      elseif length(iProperty) > 1
-         error('Damkjer:AmbiguousProperty', ...
-               'Supplied shortened property name is ambiguous');
-      end
-      
-      property = propertyNames{iProperty};
-      
-      switch property
-      case 'neighbors'
-         if (isscalar(value)  && ...
-             isreal(value)    && ...
-             value >= 5)
-          userParams.neighbors = fix(value);
-         else
-            error('Damkjer:InvalidCount', ...
-                  ['Number of Neighbors must be a real valued positive '...
-                   'integer greater or equal to 5']);
-         end
-      case 'radius'
-         if (isscalar(value) && ...
-             isnumeric(value) && ...
-             isreal(value) && ...
-             value > 0)
-            userParams.radius = value;
-         else
-            error('Damkjer:InvalidRadius', ...
-                  'Radius must be a real valued positive scalar');
-         end
-      case 'counts'
-         if (isvector(value)  && ...
-             isreal(value)    && ...
-             issorted(value)  && ...
-             all(value >= 5))
-            userParams.counts = fix(value);
-         else
-            error('Damkjer:InvalidCount', ...
-                  ['Counts must be a sorted vector of real valued positive '...
-                   'integers greater or equal to 5']);
-         end
-      case 'steps'
-         if (isvector(value)  && ...
-             isreal(value)    && ...
-             issorted(value)  && ...
-             all(value > 0))
-            userParams.steps = value;
-         else
-            error('Damkjer:InvalidSteps', ...
-                  ['Steps must be a sorted vector of real valued positive '...
-                   'values']);
-         end
-      end
-      
-      varargin(1:2) = [];
-   end
-
-   % Check for mutually exclusive options.
-   if (~isempty(userParams.counts) && userParams.neighbors >= 5)
-      error('Damkjer:MutExOpts', ...
-            '''neighbors'' and ''counts'' options are mutually exclusive');
-   end
-   
-   if (~isempty(userParams.steps) && userParams.radius > 0)
-      error('Damkjer:MutExOpts', ...
-            '''steps'' and ''radius'' options are mutually exclusive');
-   end
-   
-   if (~isempty(userParams.counts) && ~isempty(userParams.steps))
-      error('Damkjer:MutExOpts', ...
-            '''steps'' and ''counts'' options are mutually exclusive');
-   end
-
-   % Default, if necessary.
-   if (userParams.neighbors <= 0 && ...
-       userParams.radius <= 0 && ...
-       isempty(userParams.counts) && ...
-       isempty(userParams.steps))
-      userParams.radius = 1;
-   end
-end
Index: mkjer/PointProcessing/Thinning_Dyn/thin_Dyn_old.m
===================================================================
--- Damkjer/PointProcessing/Thinning_Dyn/thin_Dyn_old.m	(revision 14)
+++ 	(revision )
@@ -1,387 +1,0 @@
-% Thin_Dyn   Point Cloud Thinning (Dyn et al)
-%
-% File: thin_Dyn.m
-%
-% Description:
-%    Perform thinning according to Dyn 2004.
-%
-% Limitations:
-%    No known limitations.
-%
-% Synopsis:
-%    [results] = spanalyse(points, threshold, ...)
-%
-% Inputs:
-%    points - .
-%    threshold - must be positive. between 0-1, treated as percentage, > 1
-%                points.
-%
-%    Option strings may be provided as abbreviations as long as they resolve to
-%    a unique option.
-%
-%    'neighbors' - .
-%    'radius'    - .
-%    'counts'    - .
-%    'steps'     - .
-%
-% Outputs:
-%    results - Thinned point cloud.
-%
-% Toolbox requirements:
-%    None.
-%
-% Code requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    Dyn reference.
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2013 Kristian L. Damkjer.
-%
-%   Software History:
-%      2013-DEC-28  Initial coding.
-%
-
-%******************************************************************************
-% thin_Dyn
-%******************************************************************************
-function [ results ] = thin_Dyn( points, threshold, varargin )
-   % Perform local feature attribution via eigenspace analysis.
-   %
-   % Parameters:
-   %    points  - .
-   %
-   %    threshold - .
-   %
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    classes - Structure containing the spatial analysis classifications.
-   %
-   
-   userParams = parseInputs(varargin{:}); % Parse Inputs
-
-   % Make sure we have unique points... we barf otherwise...
-   disp('Culling duplicate points...');
-   tstart=tic;
-   points = unique(points.','rows').';
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-   disp('Indexing points...');
-   database = VpTree(points);
-   queries = points;
-   disp(['...done in ' num2str(toc(tstart)) 's']);
-   
-   database.excludeWithin(0.001); % Set mm precision on searches.
-   
-   % Sizing metrics
-   dimensions=size(queries, 1);
-   elements=size(queries, 2);
-
-   % Pre-allocate classes
-%   norms=zeros(size(queries));
-%   feats=zeros(size(queries));
-%   biases=zeros(1,elements);
-%   ints=zeros(1,elements);
-
-
-   nbrs  = cell(1,elements);
-   duals = cell(1,elements);
-   tests = cell(1,elements);
-   
-   sigs=zeros(1,elements);
-   
-   for elem=1:elements
-      tests{elem}=elem;
-   end
-
-   %***
-   % COMPUTE NEIGHBORHOODS
-   %***
-
-   % This process may take a while. Display time bar while processing.
-   msg='Computing Neigborhoods...';
-   tstart=tic;
-   h = timebar(1, elements, msg, tstart);
-   
-   % Step through the queries in chunks.
-   step=1000;
-
-   tic;
-
-   for elem=1:step:elements
-
-      % The last available element may be closer than elem + step.
-      last=min(elem+step-1,elements);
-      
-      % Get the nearest neighbors of elem
-      if (userParams.radius > 0 && userParams.neighbors <= 0)
-         % Perform a fixed radius search
-         nbrs(elem:last)=database.rnn(queries(:,elem:last),...
-                         userParams.radius);
-      elseif (userParams.radius <= 0 && userParams.neighbors > 0)
-         % Search unconstrained neighbors
-         nbrs(elem:last)=database.knn(queries(:,elem:last),...
-                         userParams.neighbors);
-      elseif (userParams.radius > 0 && userParams.neighbors > 0)
-         % Search constrained to radius
-         nbrs(elem:last)=database.knn(queries(:,elem:last),...
-                         userParams.neighbors,...
-                         'lim',userParams.radius);
-      elseif (~isempty(userParams.counts) && userParams.radius <= 0)
-         % Search unconstrained neighbors
-         nbrs(elem:last)=database.knn(queries(:,elem:last),...
-                         max(userParams.counts));
-      elseif (~isempty(userParams.counts) && userParams.radius > 0)
-         % Search constrained to radius
-         nbrs(elem:last)=database.knn(queries(:,elem:last),...
-                         max(userParams.counts),...
-                         'lim',userParams.radius);
-      elseif (~isempty(userParams.steps))
-         % Perform a fixed radius search
-         [nbrs(elem:last),DISTS]=database.rnn(queries(:,elem:last),...
-                                 max(userParams.steps));
-      end
-
-      % Update the time bar.
-      if (toc > 1)
-         tic;
-         h = timebar(elem, elements, msg, tstart, h);
-      end
-   end
-
-   % Close the time bar, if still open.
-   if (all(ishghandle(h, 'figure')))
-      close(h);
-   end
-
-   %***
-   % COMPUTE SIGNIFICANCES (THIS IS SLOW AND SHOULD BE EASY TO PARALLELIZE)
-   %***
-
-   % This process may take a while. Display time bar while processing.
-   msg='Computing Significances...';
-   tstart=tic;
-   h = timebar(1, elements, msg, tstart);
-   
-   % Step through the queries in chunks.
-   step=1000;
-
-   tic;
-
-   for elem=1:step:elements
-
-      % The last available element may be closer than elem + step.
-      last=min(elem+step-1,elements);
-
-      % Compute significance
-      sigs(elem:last)=sig_Dyn(points,tests(elem:last),nbrs(elem:last));
-
-      % Update the time bar.
-      if (toc > 1)
-         tic;
-         h = timebar(elem, elements, msg, tstart, h);
-      end
-   end
-
-   % Close the time bar, if still open.
-   if (all(ishghandle(h, 'figure')))
-      close(h);
-   end
-   
-   results = [points;sigs];
-   
-%    %***
-%    % COMPUTE DUAL NEIGHBORHOODS (THIS IS SLOW AND SHOULD BE EASY TO PARALLELIZE!)
-%    %***
-%    
-%    % This process may take a while. Display time bar while processing.
-%    msg='Computing Dual Neigborhoods...';
-%    tstart=tic;
-%    h = timebar(1, elements, msg, tstart);
-%    
-%    tic;
-% 
-%    for elem=1:elements
-%       % Build up dual set
-%       for nbr=1:length(nbrs{elem})
-%          n = nbrs{elem}(nbr);
-%          duals{n}=[duals{n}(:); elem];
-%       end
-% 
-% %         if rem(elem-1,100000)==0
-% %            for insp=1:10
-% %            disp(insp);
-% %            disp(duals{insp}');
-% %            end
-% %         end
-%          
-% %      end
-%       
-%       % Update the time bar.
-%       if (toc > 1)
-%          tic;
-%          h = timebar(elem, elements, msg, tstart, h);
-%       end
-%    end
-%    
-%    % Close the time bar, if still open.
-%    if (all(ishghandle(h, 'figure')))
-%       close(h);
-%    end
-% 
-%    results = points;
-end
-
-%******************************************************************************
-% parseInputs
-%******************************************************************************
-function [userParams] = parseInputs(varargin)
-   % Support function to parse inputs into userParams structure
-   %
-   % Parameters:
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    userParams - .
-
-   userParams = struct('radius', 0, 'neighbors', 0, 'counts', [], 'steps', []);
-   
-   if isempty(varargin)
-      error('Damkjer:InvalidOptions', ...
-            ['A neighborhood size must be specified, either directly or '...
-             'via optional parameters.']);
-   end
-   
-   if length(varargin) == 1 || ~isnumeric(varargin{2})
-      value = varargin{1};
-      
-      if (isscalar(value)  && ...
-          isreal(value)    && ...
-          value >= 5)
-         userParams.neighbors = fix(value);
-      else
-         error('Damkjer:InvalidCount', ...
-               ['Number of Neighbors must be a real valued positive '...
-                'integer greater or equal to 5: ' num2str(value)]);
-      end
-      
-      varargin(1) = [];
-   end
-   
-   % Parse the Property/Value pairs
-   if rem(length(varargin), 2) ~= 0
-      error('Damkjer:PropertyValueNotPair', ...
-            ['Additional arguments must take the form of Property/Value '...
-             'pairs']);
-   end
-   
-   propertyNames = {'neighbors', 'radius', 'counts', 'steps'};
-
-   while ~isempty(varargin)
-      property = varargin{1};
-      value    = varargin{2};
-      
-      % If the property has been supplied in a shortened form, lengthen it
-      iProperty = find(strncmpi(property, propertyNames, length(property)));
-      
-      if isempty(iProperty)
-         error('Damkjer:InvalidProperty', 'Invalid Property');
-      elseif length(iProperty) > 1
-         error('Damkjer:AmbiguousProperty', ...
-               'Supplied shortened property name is ambiguous');
-      end
-      
-      property = propertyNames{iProperty};
-      
-      switch property
-      case 'neighbors'
-         if (isscalar(value)  && ...
-             isreal(value)    && ...
-             value >= 5)
-          userParams.neighbors = fix(value);
-         else
-            error('Damkjer:InvalidCount', ...
-                  ['Number of Neighbors must be a real valued positive '...
-                   'integer greater or equal to 5']);
-         end
-      case 'radius'
-         if (isscalar(value) && ...
-             isnumeric(value) && ...
-             isreal(value) && ...
-             value > 0)
-            userParams.radius = value;
-         else
-            error('Damkjer:InvalidRadius', ...
-                  'Radius must be a real valued positive scalar');
-         end
-      case 'counts'
-         if (isvector(value)  && ...
-             isreal(value)    && ...
-             issorted(value)  && ...
-             all(value >= 5))
-            userParams.counts = fix(value);
-         else
-            error('Damkjer:InvalidCount', ...
-                  ['Counts must be a sorted vector of real valued positive '...
-                   'integers greater or equal to 5']);
-         end
-      case 'steps'
-         if (isvector(value)  && ...
-             isreal(value)    && ...
-             issorted(value)  && ...
-             all(value > 0))
-            userParams.steps = value;
-         else
-            error('Damkjer:InvalidSteps', ...
-                  ['Steps must be a sorted vector of real valued positive '...
-                   'values']);
-         end
-      end
-      
-      varargin(1:2) = [];
-   end
-
-   % Check for mutually exclusive options.
-   if (~isempty(userParams.counts) && userParams.neighbors >= 5)
-      error('Damkjer:MutExOpts', ...
-            '''neighbors'' and ''counts'' options are mutually exclusive');
-   end
-   
-   if (~isempty(userParams.steps) && userParams.radius > 0)
-      error('Damkjer:MutExOpts', ...
-            '''steps'' and ''radius'' options are mutually exclusive');
-   end
-   
-   if (~isempty(userParams.counts) && ~isempty(userParams.steps))
-      error('Damkjer:MutExOpts', ...
-            '''steps'' and ''counts'' options are mutually exclusive');
-   end
-
-   % Default, if necessary.
-   if (userParams.neighbors <= 0 && ...
-       userParams.radius <= 0 && ...
-       isempty(userParams.counts) && ...
-       isempty(userParams.steps))
-      userParams.radius = 1;
-   end
-end
Index: mkjer/PointProcessing/sig_Dyn.m
===================================================================
--- Damkjer/PointProcessing/sig_Dyn.m	(revision 14)
+++ 	(revision )
@@ -1,175 +1,0 @@
-% Sig_Dyn   Point Significance (Dyn et al)
-%
-% File: sig_Dyn.m
-%
-% Description:
-%    Compute point significance according to Dyn 2004.
-%
-% Limitations:
-%    No known limitations.
-%
-% Synopsis:
-%    [results] = sig_Dyn(points, test_sets, neighborhood_sets)
-%
-% Inputs:
-%    points            - .
-%    test_sets         - .
-%    neighborhood_sets - .
-%
-%
-% Outputs:
-%    results - Thinned point cloud.
-%
-% Toolbox requirements:
-%    None.
-%
-% Code requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    Dyn reference.
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2013 Kristian L. Damkjer.
-%
-%   Software History:
-%      2013-DEC-28  Initial coding.
-%
-
-%******************************************************************************
-% sig_Dyn
-%******************************************************************************
-function [ sigs ] = sig_Dyn( points, tests, nbrs )
-   % Perform local feature attribution via eigenspace analysis.
-   %
-   % Parameters:
-   %    points  - .
-   %
-   %    threshold - .
-   %
-   %    varargin - Variable-length input argument list. Option strings may be
-   %               provided as abbreviations as long as they resolve to a
-   %               unique option.Defined key-value pairs include the following:
-   %               'neighbors' - .
-   %               'radius'    - .
-   %               'counts'    - .
-   %               'steps'     - .
-   %
-   % Returns:
-   %    classes - Structure containing the spatial analysis classifications.
-   %
-
-   % Sizing metrics
-   dimensions=size(points, 1);
-   elements=length(tests);
-
-   % Pre-allocate classes
-   norms=zeros(dimensions, elements);
-
-   
-   % Fit planes to the neighborhoods
-   cells=cell(1,elements);
-         
-   for elem=1:elements
-      cells{elem}=points(:,nbrs{elem}).'; % fastcov is expecting row-vectors
-   end
-         
-   [covs,~,~]=fastcov(cells);
-
-   % Compute the neighborhood covariance eigenvalues.
-   [V,D]=par_eig(covs);
-
-   sigs = zeros(1,elements);
-   
-   for elem=1:elements
-
-      % skip underconstrained neighborhoods (possible with radius searches)
-      if (length(nbrs{elem})<5 || any(any(isnan(covs{elem}))))
-         continue;
-      end
-
-      [~,index]=min(abs(D{elem}));
-      A=V{elem};
-      aNorm=A(:,index);
-
-      % Plane fit to the neighborhood is defined by the normal and the point.
-      norms(:,elem)=aNorm;
-      ys = points(:,tests{elem});
-      x  = ys(:,1).';
-            
-      % Project neighborhood points to the fitted plane to establish local
-      % coordinate reference frame.
-      %
-      % NOTE: null-space method only works when treating norm as row-vector.
-      basis  = null(aNorm.');
-      coeffs = bsxfun(@minus, cells{elem}, x) * basis;
-      Z = bsxfun(@plus,  coeffs * basis.', x);
-
-      % Compute RBF function values for the neighborhood observations.
-      f=sqrt(sum(abs(cells{elem}-Z).^2,2));
-
-      % Compute RBF coefficients
-      
-      % Need R's established as |Zi-Zj|
-      % rM := radii Matrix
-      rM = min(1,pdist2(Z,Z)./1);
-      
-      % PhiM := A_{Phi,Z} = [Phi(z_{i},z_{j})]
-      %
-      % The equation used below is a Wendland compactly supported basis
-      % function in C2 to ensure curvature continuity. A C0 equivalent would be
-      % (1-r)^2 which would only ensure positional continuity.
-      PhiM = (1-rM).^4.*(4*rM+1);
-      
-%       if rcond(PhiM) < 1e-12
-% %         fmt=get(0, 'format');
-% %         format('hex');
-%          disp(Z);
-%          disp(rM);
-%          disp(f);
-%          disp(PhiM);
-%          1-rM
-%          (1-rM).^4
-%          4*rM
-%          4*rM+1
-%          ((1-rM).^4).*(4*rM+1)
-%          1-(((1-rM).^4).*(4*rM+1))
-%          hold on
-%          scatter3(cells{elem}(:,1),cells{elem}(:,2),cells{elem}(:,3), 5, 'blue', 'o');
-%          scatter3(Z(:,1),Z(:,2),Z(:,3), 5, 'green', 'o');
-%          scatter3(x(1),x(2),x(3), 5, 'red', 'x');
-%          hold off
-% %         set(0, 'format', fmt);
-%          error('oops');
-%       end
-      
-      as = PhiM\f;
-      
-      % radii from x.
-      rawRx=sqrt(sum(abs(bsxfun(@minus, x, Z)).^2,2));
-      rX = min(1,rawRx./1);
-      PhiX = (1-rX).^4.*(4*rX+1);
-
-      sigs(elem)=abs(as.' * PhiX);
-
-%       if (sigs(elem) == 0)
-%          hold on
-%          scatter3(cells{elem}(:,1),cells{elem}(:,2),cells{elem}(:,3), 5, 'blue', 'o');
-%          scatter3(Z(:,1),Z(:,2),Z(:,3), 5, 'green', 'o');
-%          scatter3(x(1),x(2),x(3), 5, 'red', 'x');
-%          hold off
-%          
-%          disp(rawRx);
-%          error('oops');
-%       end
-   end
-
-%    disp(sigs);
-      
-end
Index: mkjer/Top.dox
===================================================================
--- Damkjer/Top.dox	(revision 13)
+++ 	(revision )
@@ -1,21 +1,0 @@
-//*****************************************************************************
-// DIRECTORY: Util
-//>   General utilities.
-//<
-//*****************************************************************************
-
-//*****************************************************************************
-// NAMESPACE: Damkjer
-//>   Kristian Damkjer's doctoral research code. Data structures and algorithms
-//    directly related to Kristian Damkjer's PhD research, implemented by
-//    Kristian Damkjer.
-//<
-//*****************************************************************************
-
-//*****************************************************************************
-// NAMESPACE: MATLAB
-//>   MATLAB M-file documentation. M-files are transformed into a C++-like form
-//    using a PERL script. The resulting format is parsed by Doxygen to
-//    generate a semantic overview of the MATLAB code.
-//<
-//*****************************************************************************
Index: mkjer/Util.bib
===================================================================
--- Damkjer/Util.bib	(revision 13)
+++ 	(revision )
@@ -1,18 +1,0 @@
-@inproceedings{Yianilos:1993,
-crossref={SODA:1993},
-author={Peter N. Yianilos},
-title={Data Structures and Algorithms for Nearest Neighbor Search in General Metric Spaces},
-booktitle={Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms},
-series={SODA '93},
-year={1993},
-pages={311--321},
-abstract={We consider the computational problem of finding nearest neighbors in general metric spaces. Of particular interest are spaces that may not be conveniently embedded or approximated in Euclidian space, or where the dimensionality of a Euclidian representation is very high.Also relevant are high-dimensional Euclidian settings in which the distribution of data is in some sense of lower dimension and embedded in the space.The \textit{vp-tree} (vantage point tree) is introduced in several forms, together with associated algorithms, as an improved method for these difficult search problems. Tree construction executes in \textit{O}(\textit{n}log(\textit{n}) time, and search is under certain circumstances and in the limit, \textit{O}(log(\textit{n})) expected time. The theoretical basis for this approach is developed and the results of several experiments are reported. In Euclidian cases, kd-tree performance is compared.},
-}
-@proceedings{SODA:1993,
-organization={Association for Computing Machinery and Society for Industrial and Applied Mathematics},
-title={Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms},
-year={1993},
-publisher={Society for Industrial and Applied Mathematics},
-address={Philadelphia, PA, USA},
-isbn={9780898713138}
-}
Index: mkjer/Util/Dictionaries/SplayTree.h
===================================================================
--- Damkjer/Util/Dictionaries/SplayTree.h	(revision 14)
+++ 	(revision )
@@ -1,176 +1,0 @@
-//****************************************************************************
-// FILE:        SplayTree.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The interface definition for splay trees.
-//<
-//
-// LIMITATIONS:
-//>   This class template file follows the template inclusion pattern. This
-//    header file should be the only file included by clients wishing to
-//    instantiate a VpTree specialization.
-//<
-//
-// SOFTWARE HISTORY:
-//
-//> 2013-DEC-02  K. Damkjer
-//               Initial Coding.
-//<
-//****************************************************************************
-#ifndef Damkjer_SplayTree_HEADER
-#define Damkjer_SplayTree_HEADER
-
-#include <deque>
-#include <functional>
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// CLASS: SplayTree
-//>   A splay tree data structure and related algorithms.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT = std::less<T> >
-class SplayTree
-{
-public:
-   class Node
-   {
-   public:
-      Node(const T& element = T())
-         : theLBranch(0)
-         , theRBranch(0)
-         , theElement(element)
-         , theIndex(0)
-      {
-      }
-         //>
-         //<
-
-      ~Node()
-      {
-         std::deque<Node*> q;
-
-         q.push_back(this);
-
-         while (q.size() > 0)
-         {
-            Node* node = q.front();
-            q.pop_front();
-
-            if (node)
-            {
-               q.push_back(node->theLBranch);
-               q.push_back(node->theRBranch);
-
-               node->theLBranch = 0;
-               node->theRBranch = 0;
-
-               if (node != this) delete node;
-            }
-         }
-      }
-         //>
-         //<
-
-      Node* theLBranch;
-      Node* theRBranch;
-      T     theElement;
-      std::size_t theIndex;
-   };
-      //> A node interface for a splay tree.
-      //<
-
-   SplayTree();
-      //> Instantiate an empty tree.
-      //<
-
-   virtual ~SplayTree();
-      //> Destruct the tree and deallocate resources.
-      //<
-
-   void insert(const T&);
-      //> Add a new element to the tree.
-      //<
-
-   void update(const T&, const std::size_t&);
-      //> Remove an element from the tree.
-      //<
-   
-   void erase(const T&);
-      //> Remove an element from the tree.
-      //<
-
-   void eraseIndex(const std::size_t&);
-      //> Remove an element from the tree.
-      //<
-
-   Node* find(const T&);
-      //> Find an element in the tree.
-      //<
-
-   const T& head();
-      //> Find the front (minimum) element in the tree.
-      //<
-
-   const T& tail();
-      //> Find the back (maximum) element in the tree.
-      //<
-
-   bool empty() const { return theRoot == 0; }
-      //> Return true if and only if there are no elements in the tree.
-      //<
-
-   const std::size_t& size() const { return theSize; }
-      //> Return the number of elements in the tree.
-      //<
-
-private:
-
-   void splay(const T&);
-      //> Perform the splay operation.
-      //<
-
-   Node* headFrom(Node*);
-      //> Calculate the head (minimum) of the subtree rooted at the given node.
-      //<
-
-   Node* tailFrom(Node*);
-      //> Calculate the tail (maximum) of the subtree rooted at the given node.
-      //<
-
-   ComparitorT theOrderIs;
-      //> Pairwise comparitor that returns true if and only if the argument
-      //  order of elements is in-order according to the comparitor.
-      //<
-
-   Node* theRoot;
-      //> The root is the starting point for all operations against the database
-      //  represented by the SplayTree.
-      //<
-
-   std::size_t theSize;
-      //> The total number of elements contained in the tree.
-      //<
-   
-   std::deque<Node*> theIndexedList;
-};
-
-}
-
-//*****************************************************************************
-// External References
-//*****************************************************************************
-//#include "SplayTree_Node.h"
-
-//*****************************************************************************
-// Template Inclusion
-//*****************************************************************************
-#include "SplayTree.hpp" // HASA SplayTree Template Implementation.
-
-#endif
Index: mkjer/Util/Dictionaries/SplayTree.hpp
===================================================================
--- Damkjer/Util/Dictionaries/SplayTree.hpp	(revision 14)
+++ 	(revision )
@@ -1,520 +1,0 @@
-//****************************************************************************
-// FILE:        SplayTree.hpp
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The template implementation for splay trees.
-//<
-//
-// LIMITATIONS:
-//>   This class template file follows the template inclusion pattern. This
-//    header file should be the only file included by clients wishing to
-//    instantiate a VpTree specialization.
-//<
-//
-// SOFTWARE HISTORY:
-//
-//> 2013-DEC-02  K. Damkjer
-//               Initial Coding.
-//<
-//****************************************************************************
-#include "SplayTree.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// SplayTree::SplayTree()
-//>   Instantiate an empty tree.
-//
-//    @tparam T            The element type.
-//    @tparam ComparitorT  The element comparitor type.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT>
-SplayTree<T, ComparitorT>::SplayTree()
-   : theRoot(0)
-   , theSize(0)
-   , theIndexedList(1)
-{
-}
-
-//*****************************************************************************
-// SplayTree::~SplayTree()
-//>   Destruct the tree and deallocate resources.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT>
-SplayTree<T, ComparitorT>::~SplayTree()
-{
-   delete theRoot;
-   theRoot = 0;
-}
-
-//*****************************************************************************
-// SplayTree::insert(const T&)
-//>   Add a new element to the tree.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT>
-void
-SplayTree<T, ComparitorT>::insert(const T& element)
-{
-   Node* node = new Node(element);
-   node->theIndex = theIndexedList.size();
-   theIndexedList.push_back(node);
-
-   if (!theRoot)
-   {
-      theRoot = node;
-      ++theSize;
-      return;
-   }
-
-   splay(element);
-
-   if (theOrderIs(element, theRoot->theElement))
-   {
-      node->theLBranch = theRoot->theLBranch;
-      node->theRBranch = theRoot;
-      theRoot->theLBranch = 0;
-      theRoot = node;
-      ++theSize;
-   }
-   else // if (theOrderIs(theRoot->theElement, element))
-   {
-      node->theRBranch = theRoot->theRBranch;
-      node->theLBranch = theRoot;
-      theRoot->theRBranch = 0;
-      theRoot = node;
-      ++theSize;
-   }
-//   else
-//   {
-//      delete node;
-//   }
-
-#if USE_OBSOLETE
-   Node* current = theRoot;
-   Node* parent  = 0;
-
-   while (current)
-   {
-      parent = current;
-
-      if (theOrderIs(current->theElement, element))
-      {
-         current = current->theRBranch;
-      }
-      else
-      {
-         current = current->theLBranch;
-      }
-   }
-
-   current = new Node(element);
-   current->theParent = parent;
-
-   if (!parent)
-   {
-      theRoot = current;
-   }
-   else if (theOrderIs(parent->theElement, element))
-   {
-      parent->theRBranch = current;
-   }
-   else
-   {
-      parent->theLBranch = current;
-   }
-
-   splay(current);
-
-   ++theSize;
-#endif
-}
-
-//*****************************************************************************
-// SplayTree::update(const T&)
-//>   Add a new element to the tree.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT>
-void
-SplayTree<T, ComparitorT>::update(const T& element, const std::size_t& index)
-{
-   // This can probably be made more efficient, but this will suffice for now.
-   Node* found = theIndexedList[index];
-
-   if (!found) return; // What? Who's mismanaging the structure?
-
-   eraseIndex(index);
-
-   Node* node = new Node(element);
-   node->theIndex = index;
-   theIndexedList[index] = node;
-
-   //if (!theRoot) // How can we be found, but not have a root?
-   //{
-   //   theRoot = node;
-   //   ++theSize;
-   //   return;
-   //}
-
-   splay(element);
-
-   if (theOrderIs(element, theRoot->theElement))
-   {
-      node->theLBranch = theRoot->theLBranch;
-      node->theRBranch = theRoot;
-      theRoot->theLBranch = 0;
-      theRoot = node;
-      ++theSize;
-   }
-   else // if (theOrderIs(theRoot->theElement, element))
-   {
-      node->theRBranch = theRoot->theRBranch;
-      node->theLBranch = theRoot;
-      theRoot->theRBranch = 0;
-      theRoot = node;
-      ++theSize;
-   }
-}
-
-//*****************************************************************************
-// SplayTree::erase(const T&)
-//>   Remove an element from the tree.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT>
-void
-SplayTree<T, ComparitorT>::erase(const T& element)
-{
-   Node* found = find(element);
-
-   if (!found) return;
-
-   if (!found->theLBranch)
-   {
-      theRoot = found->theRBranch;
-   }
-   else
-   {
-      theRoot = found->theLBranch;
-      splay(element);
-      theRoot->theRBranch = found->theRBranch;
-   }
-
-   --theSize;
-   
-   found->theLBranch = 0;
-   found->theRBranch = 0;
-   theIndexedList[found->theIndex] = 0;
-   delete found;
-
-#if USE_OBSOLETE
-   Node* found = find(element);
-
-   if (!found) return;
-
-   // No need to splay here... splay performed by find.
-
-   if (!found->theLBranch)
-   {
-      replace(found, found->theRBranch);
-   }
-   else if (!found->theRBranch)
-   {
-      replace(found, found->theLBranch);
-   }
-   else
-   {
-      Node* newRoot = headFrom(found->theRBranch);
-
-      // NOTE: by definition, newRoot has no left child
-
-      if (newRoot->theParent != found)
-      {
-         replace(newRoot, newRoot->theRBranch);
-         newRoot->theRBranch = found->theRBranch;
-         newRoot->theRBranch->theParent = newRoot;
-      }
-
-      replace(found, newRoot);
-      newRoot->theLBranch = found->theLBranch;
-      newRoot->theLBranch->theParent = newRoot;
-   }
-
-   found->theLBranch = 0;
-   found->theRBranch = 0;
-   found->theParent = 0;
-   delete found;
-   --theSize;
-#endif
-}
-
-//*****************************************************************************
-// SplayTree::erase_index(const std::size_t&)
-//>   Remove an element from the tree.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT>
-void
-SplayTree<T, ComparitorT>::eraseIndex(const std::size_t& index)
-{
-   Node* found = theIndexedList.at(index);
-
-   if (!found) return;
-
-   splay(found->theElement);
-   
-   if (!found->theLBranch)
-   {
-      theRoot = found->theRBranch;
-   }
-   else
-   {
-      theRoot = found->theLBranch;
-      splay(found->theElement);
-      theRoot->theRBranch = found->theRBranch;
-   }
-
-   --theSize;
-   
-   found->theLBranch = 0;
-   found->theRBranch = 0;
-   theIndexedList[index] = 0;
-   delete found;
-}
-
-//*****************************************************************************
-// SplayTree::find(const T&)
-//>   Find an element in the tree.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT>
-typename SplayTree<T, ComparitorT>::Node*
-SplayTree<T, ComparitorT>::find(const T& element)
-{
-   splay(element);
-
-   if (theOrderIs(theRoot->theElement, element))
-   {
-      return 0;
-   }
-
-   if (theOrderIs(element, theRoot->theElement))
-   {
-      return 0;
-   }
-
-   return theRoot;
-
-#if USE_OBSOLETE
-   Node* previous = 0;
-   Node* current  = theRoot;
-
-   while (current)
-   {
-      if (theOrderIs(current->theElement, element))
-      {
-         previous = current;
-         current = current->theRBranch;
-      }
-      else if (theOrderIs(element, current->theElement))
-      {
-         previous = current;
-         current = current->theLBranch;
-      }
-      else
-      {
-         splay(current);
-         return current;
-      }
-   }
-
-   if (previous) splay(previous);
-
-   return 0;
-#endif
-}
-
-//*****************************************************************************
-// SplayTree::head()
-//>   Find the minimum element in the tree.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT>
-const T&
-SplayTree<T, ComparitorT>::head()
-{
-   return headFrom(theRoot)->theElement;
-}
-
-//*****************************************************************************
-// SplayTree::tail()
-//>   Find the maximum element in the tree.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT>
-const T&
-SplayTree<T, ComparitorT>::tail()
-{
-   return tailFrom(theRoot)->theElement;
-}
-
-//*****************************************************************************
-// SplayTree::splay(Node* const)
-//>   Perform the splay operation.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT>
-void
-SplayTree<T, ComparitorT>::splay(const T& element)
-{
-   if (!theRoot) return;
-
-   Node* node = theRoot;
-   Node* child = 0;
-
-   Node temp;
-   Node* l = &temp;
-   Node* r = &temp;
-
-   for(;;)
-   {
-      if (theOrderIs(element, node->theElement))
-      {
-         if (!node->theLBranch) break;
-
-         if (theOrderIs(element, node->theLBranch->theElement))
-         {
-            child = node->theLBranch;
-            node->theLBranch = child->theRBranch;
-            child->theRBranch = node;
-            node = child;
-
-            if (!node->theLBranch) break;
-         }
-
-         r->theLBranch = node;
-         r = node;
-         node = node->theLBranch;
-      }
-      else if (theOrderIs(node->theElement, element))
-      {
-         if (!node->theRBranch) break;
-
-         if (theOrderIs(node->theRBranch->theElement, element))
-         {
-            child = node->theRBranch;
-            node->theRBranch = child->theLBranch;
-            child->theLBranch = node;
-            node = child;
-            if (!node->theRBranch) break;
-         }
-
-         l->theRBranch = node;
-         l = node;
-         node = node->theRBranch;
-      }
-      else
-      {
-         break;
-      }
-   }
-
-   l->theRBranch = node->theLBranch;
-   r->theLBranch = node->theRBranch;
-   node->theLBranch = temp.theRBranch;
-   node->theRBranch = temp.theLBranch;
-   temp.theRBranch = 0;
-   temp.theLBranch = 0;
-
-   theRoot = node;
-
-#if USE_OBSOLETE
-   while (bubble->theParent)
-   {
-      if (bubble->theParent->theLBranch == bubble)
-      {
-         // CASE: The bubble is a left-child
-
-         if (!bubble->theParent->theParent)
-         {
-            // CASE: Zig Condition.
-            zig(bubble->theParent);
-         }
-         else if (bubble->theParent->theParent->theLBranch == bubble->theParent)
-         {
-            // CASE: Zig-Zig Condition
-            zig(bubble->theParent->theParent);
-            zig(bubble->theParent);
-         }
-         else
-         {
-            // CASE: Zig-Zag Condition
-            zig(bubble->theParent);
-            zag(bubble->theParent);
-         }
-      }
-      else
-      {
-         // CASE: The bubble is a right-child
-
-         if (!bubble->theParent->theParent)
-         {
-            // CASE: Zag Condition.
-            zag(bubble->theParent);
-         }
-         else if (bubble->theParent->theParent->theRBranch == bubble->theParent)
-         {
-            // Zag-Zag Condition
-            zag(bubble->theParent->theParent);
-            zag(bubble->theParent);
-         }
-         else
-         {
-            // Zag-Zig Condition
-            zag(bubble->theParent);
-            zig(bubble->theParent);
-         }
-      }
-   }
-#endif
-}
-   
-//*****************************************************************************
-// SplayTree::headFrom(Node*)
-//>   Calculate the head (minimum) of the subtree rooted at the given node.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT>
-typename SplayTree<T, ComparitorT>::Node*
-SplayTree<T, ComparitorT>::headFrom(Node* current)
-{
-   if (!current) return 0;
-   
-   while (current->theLBranch) current = current->theLBranch;
-
-   return current;
-}
-
-//*****************************************************************************
-// SplayTree::tailFrom(Node*)
-//>   Calculate the tail (maximum) of the subtree rooted at the given node.
-//<
-//*****************************************************************************
-template<typename T, typename ComparitorT>
-typename SplayTree<T, ComparitorT>::Node*
-SplayTree<T, ComparitorT>::tailFrom(Node* current)
-{
-   if (!current) return 0;
-   
-   while (current->theRBranch) current = current->theRBranch;
-
-   return current;
-}
-
-}
Index: mkjer/Util/Dictionaries/test/TestSplayTree.cpp
===================================================================
--- Damkjer/Util/Dictionaries/test/TestSplayTree.cpp	(revision 13)
+++ 	(revision )
@@ -1,137 +1,0 @@
-//*****************************************************************************
-// FILE:        TestSplayTree.cpp
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: TestSplayTree
-//
-//    See TestVpTree header for detailed description.
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-24  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include <iomanip>
-#include <sstream>
-#include <limits>
-#include <cmath>
-#include <vector>
-#include <typeinfo>
-
-#include "TestSplayTree.h"
-#include "Util/Exception/Exception.h"
-#include "Util/Dictionaries/SplayTree.h"
-#include "Util/Streams/BlockIndent.h"
-
-namespace Damkjer
-{
-
-
-//*****************************************************************************
-// FUNCTOR: testChebyshevRnn
-//*****************************************************************************
-class testSplayInsert : public TestCase::TestStep
-{
-public:
-   testSplayInsert()
-      : TestCase::TestStep((std::string(
-                            "insert into splay tree")))
-   {
-   }
-      //>
-      //<
-
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::testSplayInsert::operator(TestCase&)");
-
-      // Create the spatially indexed database
-      typedef SplayTree<int> SplayTreeT;
-
-      SplayTreeT dictionary;
-
-      dictionary.insert(5);
-      dictionary.insert(6);
-      dictionary.insert(4);
-      dictionary.insert(10);
-      dictionary.insert(12);
-      dictionary.insert(2);
-      dictionary.insert(1);
-      dictionary.insert(8);
-
-      dictionary.erase(8);
-      dictionary.erase(1);
-      dictionary.erase(12);
-
-      // Check the results
-      bool passedAll = true;
-      bool check;
-
-      test.report() << "Check that dictionary size is five... ";
-      check = (dictionary.size() == 5);
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-//      for (unsigned int i = 0; i < 1024; ++i)
-//      {
-//         dictionary.insert((541 * i) & 1023);
-//      }
-
-      {
-
-      SplayTreeT dictionary2;
-
-      for (unsigned int i = 0; i < 1048576; ++i)
-      {
-         dictionary2.insert((524309 * i) & 1048575);
-         if (i % 10486 == 0) test.report() << (100.*i/1048575) << "\n";
-      }
-
-      test.report() << "Check that dictionary size is 1048576... ";
-      check = (dictionary2.size() == 1048576);
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      while (dictionary2.size() > 0)
-      {
-         dictionary2.erase(dictionary2.head());
-
-         if (dictionary2.size() % 10486 == 0)
-         {
-            test.report() << (100.*dictionary2.size()/1048575) << "\n";
-         }
-      }
-
-      }
-
-      return passedAll;
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-};
-
-//*****************************************************************************
-// CONSTRUCTOR: TestSplayTree::TestSplayTree(int, char**)
-//*****************************************************************************
-TestSplayTree::TestSplayTree(int argc, char** argv)
-   : TestCase(argc, argv,
-              "SplayTree: Splay Point Tree Test Suite",
-              "SplayTree_01",
-              "This test case tests the splay point tree data structure.")
-{
-   EXCEPTION_TRY("Damkjer::TestSplayTree::TestSplayTree(int, char**)");
-
-   registerStep(new testSplayInsert());
-
-   EXCEPTION_RETHROW;
-}
-
-}
Index: mkjer/Util/Dictionaries/test/TestSplayTree.h
===================================================================
--- Damkjer/Util/Dictionaries/test/TestSplayTree.h	(revision 13)
+++ 	(revision )
@@ -1,38 +1,0 @@
-//*****************************************************************************
-// FILE:        TestSplayTree.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: 
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-AUG-06  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifndef TestSplayTree_HEADER
-#define TestSplayTree_HEADER
-
-#include "Util/UtilAPI.h"
-#include "Util/UnitTest/TestCase.h"
-
-namespace Damkjer
-{
-
-class TestSplayTree : public TestCase
-{
-public:
-   TestSplayTree(int, char**);
-      //>
-      //<
-private:
-   TestSplayTree(const TestSplayTree&);
-   TestSplayTree& operator=(const TestSplayTree&);
-};
-
-}
-
-#endif
Index: mkjer/Util/Dictionaries/test/TestSplayTree.vcxproj
===================================================================
--- Damkjer/Util/Dictionaries/test/TestSplayTree.vcxproj	(revision 13)
+++ 	(revision )
@@ -1,437 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="DebugOMP|Win32">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="DebugOMP|x64">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|Win32">
-      <Configuration>OpenMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|x64">
-      <Configuration>OpenMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="TestSplayTree.cpp" />
-    <ClCompile Include="test_SplayTree.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="TestSplayTree.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\Util.vcxproj">
-      <Project>{20fe2624-c64f-d61a-bd8f-1725a8e68a42}</Project>
-    </ProjectReference>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <Keyword>Win32Proj</Keyword>
-    <ProjectName>test_SplayTree</ProjectName>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent />
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent />
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <RuntimeTypeInfo>true</RuntimeTypeInfo>
-      <AdditionalOptions>/wd4514 /wd4571 /wd4668 /wd4710 /wd4711 /wd4820 /wd4986 %(AdditionalOptions)</AdditionalOptions>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-    <CustomBuildStep />
-  </ItemDefinitionGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
Index: mkjer/Util/Dictionaries/test/TestSplayTree.vcxproj.filters
===================================================================
--- Damkjer/Util/Dictionaries/test/TestSplayTree.vcxproj.filters	(revision 13)
+++ 	(revision )
@@ -1,26 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4010ed24-e68d-4e6e-97b0-8b8bb335aa86}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{0c039d31-de79-478b-9dc5-c3378145e52a}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="test_SplayTree.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="TestSplayTree.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="TestSplayTree.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-  </ItemGroup>
-</Project>
Index: mkjer/Util/Dictionaries/test/test_SplayTree.cpp
===================================================================
--- Damkjer/Util/Dictionaries/test/test_SplayTree.cpp	(revision 13)
+++ 	(revision )
@@ -1,33 +1,0 @@
-//*****************************************************************************
-// FILE:        test_SplayTree.cpp
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: 
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-AUG-06  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include "Util/Exception/Exception.h"
-#include "TestSplayTree.h"
-
-using namespace Damkjer;
-
-//*****************************************************************************
-// main
-//*****************************************************************************
-int main(int argc, char** argv)
-{
-   EXCEPTION_TRY("main(int, char**)");
-
-   TestSplayTree driver(argc, argv);
-
-   return driver.execute();
-
-   EXCEPTION_CATCHALL;
-}
Index: mkjer/Util/Exception/Exception.cpp
===================================================================
--- Damkjer/Util/Exception/Exception.cpp	(revision 12)
+++ 	(revision )
@@ -1,432 +1,0 @@
-//*****************************************************************************
-// FILE:        Exception.cpp
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The class implementations for exception classes that parallel the STL
-//    exception classes.
-//<
-//
-// LIMITATIONS:
-//>   No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-27  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include <iostream>    // HASA std::ostream interface
-#include <sstream>     // USES std::stringstream interfaces
-
-#include "Exception.h" // ISA Damkjer::Exception implementation
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// Exception::what()
-//>   Provide additional information about the exceptional condition.
-//
-//    @return The detailed error message.
-//<
-//*****************************************************************************
-Util_API const char* Exception::what() const throw()
-{
-   if (theMsg.empty())
-   {
-      std::ostringstream oss;
-      message(oss);
-      theMsg = oss.str();
-   }
-
-   return theMsg.c_str();
-}
-
-//*****************************************************************************
-// Exception::message(std::ostream&)
-//>   Apply standard formatting to the exception verbose message stream.
-//
-//    @param os The output stream to receive the formatted message.
-//    @return   The updated stream.
-//<
-//*****************************************************************************
-Util_API std::ostream& Exception::message(std::ostream& os) const
-{
-   os << "-- " << type() << " --\n";
-
-   insertReason(os);
-
-   os << "\n(" << who()
-      << ", \"" << file() << "\""
-      << ", line " << line() << ")";
-
-   return os;
-}
-
-//*****************************************************************************
-// Exception::push(const std::string&, const std::string&, const int)
-//>   Add a record to the exception stack trace.
-//
-//    @param who  The module to add to the call stack.
-//    @param file The file containing the module.
-//    @param line The line number where the exception was encountered.
-//<
-//*****************************************************************************
-Util_API void Exception::push(const std::string& who,
-                              const std::string& file,
-                              const int          line) const
-{
-   std::ostringstream os;
-   os << who << " (\"" << file << "\"" << ", line " << line << ")";
-   theStack.push_back(os.str());
-}
- 
-//*****************************************************************************
-// Exception::stackTrace(std::ostream&)
-//>   Provide a stack trace for the exceptional condition.
-//
-//    @param os The output stream to receive the stack trace.
-//    @return   The updated stream.
-//<
-//*****************************************************************************
-Util_API std::ostream& Exception::stackTrace(std::ostream& os) const
-{
-   if (theStack.empty()) return os;
-
-   os << "\nStack Trace:";
-
-   for (std::vector<std::string>::const_iterator vsi = theStack.begin();
-        vsi != theStack.end();
-        ++vsi)
-   {
-      os << "\n" << *vsi;
-   }
-
-   os << "\n";
-
-   return os;
-}
-
-//*****************************************************************************
-// Exception::Exception
-//>   Allocate memory and instantiate an Exception object with details.
-//
-//    @param why  The reason for raising the exception.
-//    @param who  The module to add to the call stack.
-//    @param file The file containing the module.
-//    @param line The line number where the exception was encountered.
-//<
-//*****************************************************************************
-Util_API
-Exception::Exception(const std::string& why,
-                     const std::string& who,
-                     const std::string& file,
-                     int                line)
-   : theWhy(why)
-   , theWho(who)
-   , theFile(file)
-   , theLine(line)
-{
-}
-
-//*****************************************************************************
-// Exception::insertReason
-//>   Insert the reason for raising the exception into the output stream.
-//
-//    @param os The output stream to receive the formatted reason for raising
-//              the exception.
-//    @return   The updated stream.
-//<
-//*****************************************************************************
-Util_API std::ostream&
-Exception::insertReason(std::ostream& os)
-const
-{
-   return os << "\n" << theWhy << "\n";
-}
-
-//*****************************************************************************
-// LogicError::LogicError
-//>   Allocate memory and instantiate an LogicError object with details.
-//
-//    @param why  The reason for raising the exception.
-//    @param who  The module to add to the call stack.
-//    @param file The file containing the module.
-//    @param line The line number where the exception was encountered.
-//<
-//*****************************************************************************
-LogicError::LogicError(const std::string& why,
-                       const std::string& who,
-                       const std::string& file,
-                       int                line)
-   : Exception(why, who, file, line)
-{
-}
-
-//*****************************************************************************
-// DomainError::DomainError
-//>   Allocate memory and instantiate an DomainError object with details.
-//
-//    @param why  The reason for raising the exception.
-//    @param who  The module to add to the call stack.
-//    @param file The file containing the module.
-//    @param line The line number where the exception was encountered.
-//<
-//*****************************************************************************
-DomainError::DomainError(const std::string& why,
-                         const std::string& who,
-                         const std::string& file,
-                         int                line)
-   : LogicError(why, who, file, line)
-   , std::domain_error(why)
-{
-}
-
-//*****************************************************************************
-// DomainError::what
-//>   Provide additional information about the exceptional condition.
-//
-//    @return The detailed error message.
-//<
-//*****************************************************************************
-const char*
-DomainError::what()
-const throw()
-{
-   return Exception::what();
-}
-
-//*****************************************************************************
-// InvalidArgument::InvalidArgument
-//>   Allocate memory and instantiate an InvalidArgument object with details.
-//
-//    @param why  The reason for raising the exception.
-//    @param who  The module to add to the call stack.
-//    @param file The file containing the module.
-//    @param line The line number where the exception was encountered.
-//<
-//*****************************************************************************
-InvalidArgument::InvalidArgument(const std::string& why,
-                                 const std::string& who,
-                                 const std::string& file,
-                                 int                line)
-   : LogicError(why, who, file, line)
-   , std::invalid_argument(why)
-{
-}
-
-//*****************************************************************************
-// InvalidArgument::what
-//>   Provide additional information about the exceptional condition.
-//
-//    @return The detailed error message.
-//<
-//*****************************************************************************
-const char*
-InvalidArgument::what()
-const throw()
-{
-   return Exception::what();
-}
-
-//*****************************************************************************
-// LengthError::LengthError
-//>   Allocate memory and instantiate an LengthError object with details.
-//
-//    @param why  The reason for raising the exception.
-//    @param who  The module to add to the call stack.
-//    @param file The file containing the module.
-//    @param line The line number where the exception was encountered.
-//<
-//*****************************************************************************
-LengthError::LengthError(const std::string& why,
-                         const std::string& who,
-                         const std::string& file,
-                         int                line)
-   : LogicError(why, who, file, line)
-   , std::length_error(why)
-{
-}
-
-//*****************************************************************************
-// LengthError::what
-//>   Provide additional information about the exceptional condition.
-//
-//    @return The detailed error message.
-//<
-//*****************************************************************************
-const char* LengthError::what() const throw()
-{
-   return Exception::what();
-}
-
-//*****************************************************************************
-// OutOfRange::OutOfRange
-//>   Allocate memory and instantiate an OutOfRange object with details.
-//
-//    @param why  The reason for raising the exception.
-//    @param who  The module to add to the call stack.
-//    @param file The file containing the module.
-//    @param line The line number where the exception was encountered.
-//<
-//*****************************************************************************
-OutOfRange::OutOfRange(const std::string& why,
-                       const std::string& who,
-                       const std::string& file,
-                       int                line)
-   : LogicError(why, who, file, line)
-   , std::out_of_range(why)
-{
-}
-
-//*****************************************************************************
-// OutOfRange::what
-//>   Provide additional information about the exceptional condition.
-//
-//    @return The detailed error message.
-//<
-//*****************************************************************************
-const char* OutOfRange::what() const throw()
-{
-   return Exception::what();
-}
-
-//*****************************************************************************
-// RethrowError::RethrowError
-//>   Allocate memory and instantiate an RethrowError object with details.
-//
-//    This constructor is used to wrap a std::exception as a Damkjer::Exception
-//    for the purpose of rethrowing. The what() portion of the std::exception
-//    is reported in the what() of the RethrowError.
-//
-//    @param thrown The original thrown std::exception to be re-thrown.
-//    @param who    The module to add to the call stack.
-//    @param file   The file containing the module.
-//    @param line   The line number where the exception was encountered.
-//<
-//*****************************************************************************
-RethrowError::RethrowError(const std::exception& thrown,
-                           const std::string& who,
-                           const std::string& file,
-                           int line)
-   : DomainError((*thrown.what() != '\0' ? thrown.what()
-                                         : typeid(thrown).name()),
-                 who, file, line)
-{
-}
-
-//*****************************************************************************
-// RuntimeError::RuntimeError
-//>   Allocate memory and instantiate an RuntimeError object with details.
-//
-//    @param why  The reason for raising the exception.
-//    @param who  The module to add to the call stack.
-//    @param file The file containing the module.
-//    @param line The line number where the exception was encountered.
-//<
-//*****************************************************************************
-RuntimeError::RuntimeError(const std::string& why,
-                           const std::string& who,
-                           const std::string& file,
-                           int                line)
-   : Exception(why, who, file, line)
-{
-}
-
-//*****************************************************************************
-// RangeError::RangeError
-//>   Allocate memory and instantiate an RangeError object with details.
-//
-//    @param why  The reason for raising the exception.
-//    @param who  The module to add to the call stack.
-//    @param file The file containing the module.
-//    @param line The line number where the exception was encountered.
-//<
-//*****************************************************************************
-RangeError::RangeError(const std::string& why,
-                       const std::string& who,
-                       const std::string& file,
-                       int                line)
-   : RuntimeError(why, who, file, line)
-   , std::range_error(why)
-{
-}
-
-//*****************************************************************************
-// RangeError::what
-//>   Provide additional information about the exceptional condition.
-//
-//    @return The detailed error message.
-//<
-//*****************************************************************************
-const char* RangeError::what() const throw()
-{
-   return Exception::what();
-}
-
-//*****************************************************************************
-// OverflowError::OverflowError
-//>   Allocate memory and instantiate an OverflowError object with details.
-//
-//    @param why  The reason for raising the exception.
-//    @param who  The module to add to the call stack.
-//    @param file The file containing the module.
-//    @param line The line number where the exception was encountered.
-//<
-//*****************************************************************************
-OverflowError::OverflowError(const std::string& why,
-                             const std::string& who,
-                             const std::string& file,
-                             int                line)
-   : RuntimeError(why, who, file, line)
-   , std::overflow_error(why)
-{
-}
-
-//*****************************************************************************
-// OverflowError::what
-//>   Provide additional information about the exceptional condition.
-//
-//    @return The detailed error message.
-//<
-//*****************************************************************************
-const char* OverflowError::what() const throw()
-{
-   return Exception::what();
-}
-
-//*****************************************************************************
-// UnderflowError::UnderflowError
-//>   Allocate memory and instantiate an UnderflowError object with details.
-//
-//    @param why  The reason for raising the exception.
-//    @param who  The module to add to the call stack.
-//    @param file The file containing the module.
-//    @param line The line number where the exception was encountered.
-//<
-//*****************************************************************************
-UnderflowError::UnderflowError(const std::string& why,
-                               const std::string& who,
-                               const std::string& file,
-                               int                line)
-   : RuntimeError(why, who, file, line)
-   , std::underflow_error(why)
-{
-}
-
-//*****************************************************************************
-// UnderflowError::what
-//>   Provide additional information about the exceptional condition.
-//
-//    @return The detailed error message.
-//<
-//*****************************************************************************
-const char* UnderflowError::what() const throw()
-{
-   return Exception::what();
-}
-
-}
Index: mkjer/Util/Exception/Exception.h
===================================================================
--- Damkjer/Util/Exception/Exception.h	(revision 12)
+++ 	(revision )
@@ -1,585 +1,0 @@
-//*****************************************************************************
-// FILE:        Exception.h
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The interface definitions for exception classes that parallel the STL
-//    exception classes.
-//<
-//
-// LIMITATIONS:
-//>   No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2013-JUL-27  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifndef Damkjer_Exception_HEADER
-#define Damkjer_Exception_HEADER
-
-#include <typeinfo>       // USES typeid operator.
-#include <exception>      // ISA extension to STL exception classes.
-#include <stdexcept>      // ISA extension to STL logic and runtime errors.
-#include <vector>         // HASA std::vector data member.
-#include <string>         // HASA std::string data member.
-#include <ostream>        // USES std::ostream::operator<<.
-
-#include "Util/UtilAPI.h" // ISA contributor to the Util libraray API.
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// CLASS: Exception
-//> Abstract base class for exception classes. Exceptions allow for detailed,
-//  robust handling of errors and exceptional circumstances encountered in
-//  programs. This class, and its derivatives, intnentionally mirror the C++
-//  Standard Library exception classes. They also provide for standardized
-//  message formatting and stack trace aggregation through convenience macros.
-//
-//  The implemented exceptions that parallel the C++ Standard Library are:
-//
-// - Exception                ->     std::exception
-//    - LogicError            ->        std::logic_error
-//       - DomainError        ->           std::domain_error
-//       - InvalidArgument    ->           std::invalid_argument
-//       - LengthError        ->           std::length_error
-//       - OutOfRange         ->           std::out_of_range
-//    - RuntimeError          ->        std::runtime_error
-//       - RangeError         ->           std::range_error
-//       - OverflowError      ->           std::overflow_error
-//       - UnderflowError     ->           std::underflow_error
-//<
-//*****************************************************************************
-class Exception
-{
-public:
-   // Use the compiler-generated default constructor.
-   // Util_API Exception();
-
-   // Use the compiler-generated copy constructor.
-   // Util_API Exception(const Exception&);
-
-   Util_API virtual ~Exception() throw(){}
-      //> Destroy the Exception object and perform clean-up activities.
-      //<
-
-   // Use the compiler-generated assignment operator.
-   // Util_API Exception& operator=(const Exception&);
-
-   Util_API virtual const char* what() const throw() = 0;
-      //> Provide additional information about the exceptional condition.
-      //<
-
-   Util_API virtual std::ostream& message(std::ostream&) const;
-      //> Apply standard formatting to the exception verbose message stream.
-      //<
-
-   Util_API void push(const std::string&,
-                      const std::string&,
-                      const int) const;
-      //> Add a record to the exception stack trace.
-      //<
-
-   Util_API std::ostream& stackTrace(std::ostream&) const;
-      //> Provide a stack trace for the exceptional condition.
-      //<
-
-   Util_API const std::string& type() const {
-      if (theTypeID.empty())
-      {
-         theTypeID = typeid(*this).name();
-      }
-      return theTypeID;
-   }
-      //> Provide the type of the exception class.
-      //
-      //  @return The type of the exception class.
-      //<
-
-   Util_API const std::string& why()  const { return theWhy; }
-      //> Provide additional information about the cause of the exceptional
-      //  condition, if possible.
-      //
-      //  @return The verbose description for the cause of the exception.
-      //<
-
-   Util_API const std::string& who()  const { return theWho; }
-      //> Identify the module that raised the exception.
-      //
-      //  @return The module that raised the exception
-      //<
-
-   Util_API const std::string& file() const { return theFile; }
-      //> Identify the file containing the code emitting the exception.
-      //
-      //  @return The file containing the code emitting the exception.
-      //<
-
-   Util_API const int line() const { return theLine; }
-      //> Identify the line number of the originating location for the
-      //  exception.
-      //
-      //  @return The line number for the exception origin.
-      //<
-
-protected:
-   Util_API Exception(const std::string&,
-                      const std::string&,
-                      const std::string&,
-                      int);
-      //> Allocate memory and instantiate an Exception object with details.
-      //<
-
-   Util_API virtual std::ostream& insertReason(std::ostream&) const;
-      //> Insert the reason for raising the exception into the output stream.
-      //<
-
-private:
-   mutable std::vector<std::string> theStack;
-      //> The call stack.
-      //<
-
-   mutable std::string theTypeID;
-      //> The exception type.
-      //<
-
-   mutable std::string theMsg;
-      //> The verbose message.
-      //<
-
-   std::string theWhy;
-      //> The reason for raising the exception.
-      //<
-
-   std::string theWho;
-      //> The originator of the exception.
-      //<
-
-   std::string theFile;
-      //> The file containing the exception throw site.
-      //<
-
-   int theLine;
-      //> The location of the exception throw.
-      //<
-};
-
-//*****************************************************************************
-// CLASS: LogicError
-//>   An error raised due to faulty logic.
-//
-//    Logic errors are errors that, at least in theory, could be avoided by the
-//    program; for example, by performing additional tests of function
-//    arguments. Examples of such errors are a violation of logical
-//    preconditions or a class invariant under the Design-by-Contract idiom.
-//<
-//*****************************************************************************
-class LogicError : public Exception
-{
-public:
-   Util_API LogicError(const std::string&,
-                       const std::string&,
-                       const std::string&,
-                       int);
-      //> Allocate memory and instantiate an LogicError object with details.
-      //<
-
-   Util_API virtual ~LogicError() throw() {}
-      //> Destroy the LogicError object and perform clean-up activities.
-      //<
-};
-
-//*****************************************************************************
-// CLASS: DomainError
-//>   An error raised due to an operation being undefined for an argument.
-//
-//    A domain error typically applies to mathematic functions where the domain
-//    is the subset of values that can be accepted by the function. In this
-//    case, an argument encountered outside of the valid subset of values is a
-//    domain error.
-//<
-//*****************************************************************************
-class DomainError : public LogicError,
-                    public std::domain_error
-{
-public:
-   Util_API DomainError(const std::string&,
-                        const std::string&,
-                        const std::string&,
-                        int);
-      //> Allocate memory and instantiate an DomainError object with details.
-      //<
-
-   Util_API virtual ~DomainError() throw() {}
-      //> Destroy the DomainError object and perform clean-up activities.
-      //<
-
-   Util_API virtual const char* what() const throw();
-      //> Provide additional information about the exceptional condition.
-      //<
-};
-
-//*****************************************************************************
-// CLASS: InvalidArgument
-//>   An error raised due to an argument being rejected as valid input.
-//
-//    An invalid argument is a general class of exception that reflects a
-//    violation of logical preconditions for a function.
-//<
-//*****************************************************************************
-class InvalidArgument : public LogicError,
-                        public std::invalid_argument
-{
-public:
-   Util_API InvalidArgument(const std::string&,
-                            const std::string&,
-                            const std::string&,
-                            int);
-      //> Allocate memory and instantiate an InvalidArgument object with
-      //  details.
-      //<
-
-   Util_API virtual ~InvalidArgument() throw() {}
-      //> Destroy the InvalidArgument object and perform clean-up activities.
-      //<
-
-   Util_API virtual const char* what() const throw();
-      //> Provide additional information about the exceptional condition.
-      //<
-};
-
-//*****************************************************************************
-// CLASS: LengthError
-//>   An error raised due to an attempt to perform an action that would exceed
-//    implementation defined length limits for an object.
-//<
-//*****************************************************************************
-class LengthError : public LogicError,
-                    public std::length_error
-{
-public:
-   Util_API LengthError(const std::string&,
-                        const std::string&,
-                        const std::string&,
-                        int);
-      //> Allocate memory and instantiate an LengthError object with details.
-      //<
-
-   Util_API virtual ~LengthError() throw() {}
-      //> Destroy the LengthError object and perform clean-up activities.
-      //<
-
-   Util_API virtual const char* what() const throw();
-      //> Provide additional information about the exceptional condition.
-      //<
-};
-
-//*****************************************************************************
-// CLASS: OutOfRange
-//>   An error raised due to an attempt to access elements outside of a defined
-//    range.
-//
-//    A typical example of an out of range error is an invalid index for a
-//    container element. 
-//<
-//*****************************************************************************
-class OutOfRange : public LogicError,
-                   public std::out_of_range
-{
-public:
-   Util_API OutOfRange(const std::string&,
-                       const std::string&,
-                       const std::string&,
-                       int);
-      //> Allocate memory and instantiate an OutOfRange object with details.
-      //<
-
-   Util_API virtual ~OutOfRange() throw() {}
-      //> Destroy the OutOfRange object and perform clean-up activities.
-      //<
-
-   Util_API virtual const char* what() const throw();
-      //> Provide additional information about the exceptional condition.
-      //<
-};
-
-//*****************************************************************************
-// CLASS: RethrowError
-//>   An error raised due to an unhandled exception thrown within a guarded
-//    section.
-//
-//    Rethrow errors are used to capture the call trace between an exception
-//    origin and its handling location.
-//<
-//*****************************************************************************
-class RethrowError : public DomainError
-{
-public:
-   Util_API RethrowError(const std::exception&,
-                         const std::string&,
-                         const std::string&,
-                         int);
-      //> Allocate memory and instantiate an RethrowError object with details.
-      //<
-
-   Util_API RethrowError(const Damkjer::Exception& thrown,
-                         const std::string&        extraReason,
-                         const std::string&        who,
-                         const std::string&        file,
-                         int                       line)
-      : DomainError(thrown.why() + " " + extraReason, who, file, line)
-   {
-   }
-      //> This constructor is used to add an extra reason to a
-      //  Damkjer::Exception for the purpose of rethrowing.
-      //
-      //  @param thrown      The original thrown exception to be re-thrown.
-      //  @param extraReason The additional reason for re-throwing.
-      //  @param who         The module to add to the call stack.
-      //  @param file        The file containing the module.
-      //  @param line        The line number where the exception was
-      //                     encountered.
-      //<
-
-   Util_API RethrowError(const std::string& why,
-                         const std::string& who,
-                         const std::string& file,
-                         int                line)
-      : DomainError(why, who, file, line)
-   {
-   }
-      //> This constructor is used to wrap a string as a
-      //  Damkjer::Exception for the purpose of rethrowing. The what()
-      //  portion of the std::exception is reported in the what()
-      //  of the RethrowError.
-      //
-      //  @param why  The reason for raising the exception.
-      //  @param who  The module to add to the call stack.
-      //  @param file The file containing the module.
-      //  @param line The line number where the exception was encountered.
-      //<
-
-   Util_API RethrowError(const std::string& who,
-                         const std::string& file,
-                         int                line)
-      : DomainError("Unknown error", who, file, line)
-   {
-   }
-      //> This constructor is used to wrap an unknown exception as a
-      //  Damkjer::Exception for the purpose of rethrowing. The message
-      //  "Unknown error" is reported in the what() of the RethrowError.
-      //
-      //  @param who  The module to add to the call stack.
-      //  @param file The file containing the module.
-      //  @param line The line number where the exception was encountered.
-      //<
-
-   Util_API virtual ~RethrowError() throw() {}
-      //> Destroy the RethrowError object and perform clean-up activities.
-      //<
-};
-
-//*****************************************************************************
-// CLASS: RuntimeError
-//>   An error raised due to events beyond the scope of the program and only
-//    detectable at run-time.
-//
-//    Runtime errors are errors that are not easily avoided by the program.
-//<
-//*****************************************************************************
-class RuntimeError : public Exception
-{
-public:
-   Util_API RuntimeError(const std::string&,
-                         const std::string&,
-                         const std::string&,
-                         int);
-      //> Allocate memory and instantiate an RuntimeError object with details.
-      //<
-
-   Util_API virtual ~RuntimeError() throw() {}
-      //> Destroy the RuntimeError object and perform clean-up activities.
-      //<
-};
-
-//*****************************************************************************
-// CLASS: RangeError
-//>   An error raised due to a defined, but unrepresentable result.
-//
-//    Range errors are typically used to report a floating-point value that
-//    would be too large or small in magnitude to represent.
-//
-//    @note
-//    Do not use this class to report out of range logical errors. For example,
-//    an index out of bounds would not be a range error.
-//<
-//*****************************************************************************
-class RangeError : public RuntimeError,
-                   public std::range_error
-{
-public:
-   Util_API RangeError(const std::string&,
-                       const std::string&,
-                       const std::string&,
-                       int);
-      //> Allocate memory and instantiate an RangeError object with details.
-      //<
-
-   Util_API virtual ~RangeError() throw() {}
-      //> Destroy the RangeError object and perform clean-up activities.
-      //<
-
-   Util_API virtual const char* what() const throw();
-      //> Provide additional information about the exceptional condition.
-      //<
-};
-
-//*****************************************************************************
-// CLASS: OverflowError
-//>   An error raised due to a value growing too large resulting in an
-//    arithmetic overflow.
-//
-//    Overflow errors are tpically used to report an integer computation that
-//    would exceed the maximum representable value for the integer class.
-//<
-//*****************************************************************************
-class OverflowError : public RuntimeError,
-                      public std::overflow_error
-{
-public:
-   Util_API OverflowError(const std::string&,
-                          const std::string&,
-                          const std::string&,
-                          int);
-      //> Allocate memory and instantiate an OverflowError object with details.
-      //<
-
-   Util_API virtual ~OverflowError() throw() {}
-      //> Destroy the OverflowError object and perform clean-up activities.
-      //<
-
-   Util_API virtual const char* what() const throw();
-      //> Provide additional information about the exceptional condition.
-      //<
-};
-
-//*****************************************************************************
-// CLASS: UnderflowError
-//>   An error raised due to a value growing too small resulting in an
-//    arithmetic underflow.
-//
-//    Underflow errors are tpically used to report an integer computation that
-//    would exceed the minimum representable value for the integer class.
-//<
-//*****************************************************************************
-class UnderflowError : public RuntimeError,
-                       public std::underflow_error
-{
-public:
-   Util_API UnderflowError(const std::string&,
-                           const std::string&,
-                           const std::string&,
-                           int);
-      //> Allocate memory and instantiate an UnderflowError object with
-      //  details.
-      //<
-
-   Util_API virtual ~UnderflowError() throw() {}
-      //> Destroy the UnderflowError object and perform clean-up activities.
-      //<
-
-   Util_API virtual const char* what() const throw();
-      //> Provide additional information about the exceptional condition.
-      //<
-};
-
-}
-
-//*****************************************************************************
-// FUNCTION: operator<<(std::ostream&, const Damkjer::Exception&)
-//>   Insert a human-readable summary of the Damkjer::Exception into the output
-//    stream.
-//
-//    @param  os The output stream to accept the error message.
-//    @param  e  The Damkjer::Exception object to provide the error message.
-//    @return    The updated output stream.
-//<
-//*****************************************************************************
-Util_API inline std::ostream&
-operator<<(std::ostream& os, const Damkjer::Exception& e)
-{
-   return os << e.what();
-}
-
-//*****************************************************************************
-// MACRO: EXCEPTION_TRY
-//>   Establish a guarded section for a module. The module name will be
-//    appended to the stack trace for any unhandled exceptions. This macro
-//    should be at the beginning of any module that may throw an exception.
-//
-//    @param MODULE_NAME The module identifier (and signature).
-//<
-//*****************************************************************************
-#define EXCEPTION_TRY( MODULE_NAME ) \
-static const char* const MODULE = MODULE_NAME; \
-try \
-{
-
-//*****************************************************************************
-// MACRO: EXCEPTION_RETHROW
-//>   Intercept unhandled exceptions and append the current module to the stack
-//    trace. This macro should be placed at the end of any module where an
-//    unhandled exception may be encountered.
-//<
-//*****************************************************************************
-#define EXCEPTION_RETHROW \
-} \
-catch (const Damkjer::Exception& e) \
-{ \
-   e.push(MODULE, __FILE__, __LINE__); \
-   throw; \
-} \
-catch (const std::exception& e) \
-{ \
-   throw RethrowError(e, MODULE, __FILE__, __LINE__); \
-} \
-catch (...) \
-{ \
-   throw RethrowError(MODULE, __FILE__, __LINE__); \
-}
-
-//*****************************************************************************
-// MACRO: EXCEPTION_CATCHALL
-//>   Intercept exceptions immediately prior to throwing off the stack. Instead
-//    of a hard crash, provide any exception messages and any stack trace
-//    information available. Always return with a failure code to indicate
-//    unsucessful program execution. This macro should be placed at the end of
-//    all application main functions.
-//<
-//*****************************************************************************
-#define EXCEPTION_CATCHALL \
-} \
-catch (const Damkjer::Exception& e) \
-{ \
-   e.push(MODULE, __FILE__, __LINE__); \
-   std::cerr << e; \
-   e.stackTrace(std::cerr); \
-   return EXIT_FAILURE; \
-} \
-catch (const std::exception& e) \
-{ \
-   std::cerr << e.what() << std::endl; \
-   return EXIT_FAILURE; \
-} \
-catch (...) \
-{ \
-   std::cerr << "Unknown exception" << std::endl; \
-   return EXIT_FAILURE; \
-}
-
-#endif
Index: mkjer/Util/Exception/test/TestException.cpp
===================================================================
--- Damkjer/Util/Exception/test/TestException.cpp	(revision 12)
+++ 	(revision )
@@ -1,202 +1,0 @@
-//*****************************************************************************
-// FILE:        TestException.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: TestException
-//
-//    See TestTestCase header for detailed description.
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-24  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include <sstream>
-
-#include <vector>
-#include <typeinfo>
-
-#include "Util/Exception/Exception.h"
-#include "TestException.h"
-#include "Util/Streams/BlockIndent.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// FUNCTOR: throwTest
-//*****************************************************************************
-template <typename CatchT, typename ThrowT=CatchT>
-class throwTest : public TestCase::TestStep
-{
-public:
-   throwTest(const ThrowT& expected)
-      : TestCase::TestStep(typeid(CatchT).name())
-      , theExpected(expected)
-   {
-   }
-      //> 
-      //<
-   
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::throwTest::operator(TestCase&)");
-
-      try
-      {
-         throw theExpected;
-
-         test.report() << "Did not catch an exception!\n";
-
-         // If we get here, we didn't throw: failed test.
-         return false;
-      }
-      catch (const CatchT& e)
-      {
-         test.report() << "Caught expected exception:\n";
-         test.report() << BlockIndent() << e.what() << "\n" << endBlock;
-
-         // If we get here, we threw the correct exception: successful test.
-         return true;
-      }
-      catch (...)
-      {
-         test.report() << "Caught unexpected exception.\n";
-
-         // If we get here, we threw something unexpected: failed test.
-         return false;
-      }
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-
-private:
-   ThrowT theExpected;
-      //>
-      //<
-};
-
-//*****************************************************************************
-// CONSTRUCTOR: TestException::TestException(int, char**)
-//*****************************************************************************
-TestException::TestException(int argc, char** argv)
-   : TestCase(argc, argv,
-              "Exception: Basic Functionality",
-              "Exception_01",
-              "This test case tests basic Exception functionality.")
-{
-   EXCEPTION_TRY("Damkjer::TestException::TestException(int, char**)");
-
-   DomainError     dde("Function not defined for provided input. (undefined "
-                       "behavior)",
-                       MODULE,__FILE__,__LINE__);
-   InvalidArgument dia("Argument cannot be interpretted in the context of the "
-                       "function. (e.g., bitset initialized with char other "
-                       "than '0' or '1')",
-                       MODULE,__FILE__,__LINE__);
-   LengthError     dle("Action exceeded a maximum allowable size.",
-                       MODULE,__FILE__,__LINE__);
-   OutOfRange      dor("Parameter outside of permitted range. (e.g., bad "
-                       "index)",
-                       MODULE,__FILE__,__LINE__);
-   RangeError      dre("Error in internal computation. (result cannot be "
-                       "represented)",
-                       MODULE,__FILE__,__LINE__);
-   OverflowError   doe("Detected arithmetic overflow. (result is larger "
-                       "than type can represent)",
-                       MODULE,__FILE__,__LINE__);
-   UnderflowError  due("Detected arithmetic underflow. (result is smaller "
-                       "than type can represent)",
-                       MODULE,__FILE__,__LINE__);
-   std::domain_error     sde("Function not defined for provided input. "
-                             "(undefined behavior)");
-   std::invalid_argument sia("Argument cannot be interpretted in the context "
-                             "of the function. (e.g., bitset initialized with "
-                             "char other than '0' or '1')");
-   std::length_error     sle("Action exceeded a maximum allowable size.");
-   std::out_of_range     sor("Parameter outside of permitted range. (e.g., "
-                             "bad index)");
-   std::range_error      sre("Error in internal computation. (result cannot "
-                             "be represented)");
-   std::overflow_error   soe("Detected arithmetic overflow. (result is larger "
-                             "than type can represent)");
-   std::underflow_error  sue("Detected arithmetic underflow. (result is "
-                             "smaller than type can represent)");
-
-//   std::bad_alloc        sba("Unable to allocate requested memory.");
-//   std::bad_cast         sbc("Failure to dynamic cast. Cast relationship is "
-//                             "defined, but results in an incomplete object of"
-//                             "the destination type");
-//   std::bad_exception    sbe("Exception thrown that wasn't listed in the "
-//                             "function dynamic exception specifier.");
-//   std::bad_typeid       sbt("typeid operator applied to dereferenced null "
-//                             "pointer.");
-
-   std::bad_alloc     sba;
-   std::bad_cast      sbc;
-   std::bad_exception sbe;
-   std::bad_typeid    sbt;
-
-   registerStep(new throwTest<std::domain_error>(sde));
-   registerStep(new throwTest<std::invalid_argument>(sia));
-   registerStep(new throwTest<std::length_error>(sle));
-   registerStep(new throwTest<std::out_of_range>(sor));
-   registerStep(new throwTest<std::range_error>(sre));
-   registerStep(new throwTest<std::overflow_error>(soe));
-   registerStep(new throwTest<std::underflow_error>(sue));
-   registerStep(new throwTest<std::bad_alloc>(sba));
-   registerStep(new throwTest<std::bad_cast>(sbc));
-   registerStep(new throwTest<std::bad_exception>(sbe));
-   registerStep(new throwTest<std::bad_typeid>(sbt));
-   registerStep(new throwTest<std::logic_error>(sde));
-   registerStep(new throwTest<std::logic_error>(sia));
-   registerStep(new throwTest<std::logic_error>(sle));
-   registerStep(new throwTest<std::logic_error>(sor));
-   registerStep(new throwTest<std::runtime_error>(sre));
-   registerStep(new throwTest<std::runtime_error>(soe));
-   registerStep(new throwTest<std::runtime_error>(sue));
-   registerStep(new throwTest<std::exception>(sde));
-   registerStep(new throwTest<std::exception>(sia));
-   registerStep(new throwTest<std::exception>(sle));
-   registerStep(new throwTest<std::exception>(sor));
-   registerStep(new throwTest<std::exception>(sre));
-   registerStep(new throwTest<std::exception>(soe));
-   registerStep(new throwTest<std::exception>(sue));
-   registerStep(new throwTest<std::exception>(sba));
-   registerStep(new throwTest<std::exception>(sbc));
-   registerStep(new throwTest<std::exception>(sbe));
-   registerStep(new throwTest<std::exception>(sbt));
-   registerStep(new throwTest<DomainError>(dde));
-   registerStep(new throwTest<InvalidArgument>(dia));
-   registerStep(new throwTest<LengthError>(dle));
-   registerStep(new throwTest<OutOfRange>(dor));
-   registerStep(new throwTest<RangeError>(dre));
-   registerStep(new throwTest<OverflowError>(doe));
-   registerStep(new throwTest<UnderflowError>(due));
-   registerStep(new throwTest<LogicError, DomainError>(dde));
-   registerStep(new throwTest<LogicError, InvalidArgument>(dia));
-   registerStep(new throwTest<LogicError, LengthError>(dle));
-   registerStep(new throwTest<LogicError, OutOfRange>(dor));
-   registerStep(new throwTest<RuntimeError, RangeError>(dre));
-   registerStep(new throwTest<RuntimeError, OverflowError>(doe));
-   registerStep(new throwTest<RuntimeError, UnderflowError>(due));
-   registerStep(new throwTest<Exception, DomainError>(dde));
-   registerStep(new throwTest<Exception, InvalidArgument>(dia));
-   registerStep(new throwTest<Exception, LengthError>(dle));
-   registerStep(new throwTest<Exception, OutOfRange>(dor));
-   registerStep(new throwTest<Exception, RangeError>(dre));
-   registerStep(new throwTest<Exception, OverflowError>(doe));
-   registerStep(new throwTest<Exception, UnderflowError>(due));
-
-   EXCEPTION_RETHROW;
-}
-
-}
Index: mkjer/Util/Exception/test/TestException.h
===================================================================
--- Damkjer/Util/Exception/test/TestException.h	(revision 12)
+++ 	(revision )
@@ -1,38 +1,0 @@
-//*****************************************************************************
-// FILE:        TestException.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: 
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-24  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifndef TestException_HEADER
-#define TestException_HEADER
-
-#include "Util/UtilAPI.h"
-#include "Util/UnitTest/TestCase.h"
-
-namespace Damkjer
-{
-
-class TestException : public TestCase
-{
-public:
-   TestException(int, char**);
-      //>
-      //<
-private:
-   TestException(const TestException&);
-   TestException& operator=(const TestException&);
-};
-
-}
-
-#endif
Index: mkjer/Util/Exception/test/TestException.vcxproj
===================================================================
--- Damkjer/Util/Exception/test/TestException.vcxproj	(revision 12)
+++ 	(revision )
@@ -1,452 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="DebugOMP|Win32">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="DebugOMP|x64">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|Win32">
-      <Configuration>OpenMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|x64">
-      <Configuration>OpenMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="TestException.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="TestException.cpp" />
-    <ClCompile Include="test_Exception.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\Util.vcxproj">
-      <Project>{20fe2624-c64f-d61a-bd8f-1725a8e68a42}</Project>
-    </ProjectReference>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <Keyword>Win32Proj</Keyword>
-    <ProjectName>test_Exception</ProjectName>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <AdditionalOptions>/wd4514 /wd4571 /wd4668 /wd4710 /wd4711 /wd4820 /wd4986 %(AdditionalOptions)</AdditionalOptions>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
Index: mkjer/Util/Exception/test/TestException.vcxproj.filters
===================================================================
--- Damkjer/Util/Exception/test/TestException.vcxproj.filters	(revision 9)
+++ 	(revision )
@@ -1,26 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4010ed24-e68d-4e6e-97b0-8b8bb335aa86}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{0c039d31-de79-478b-9dc5-c3378145e52a}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="TestException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="test_Exception.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="TestException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-</Project>
Index: mkjer/Util/Exception/test/test_Exception.cpp
===================================================================
--- Damkjer/Util/Exception/test/test_Exception.cpp	(revision 12)
+++ 	(revision )
@@ -1,33 +1,0 @@
-//*****************************************************************************
-// FILE:        test_Exception.cpp
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: 
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-26  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include "Util/Exception/Exception.h"
-#include "TestException.h"
-
-using namespace Damkjer;
-
-//*****************************************************************************
-// main
-//*****************************************************************************
-int main(int argc, char** argv)
-{
-   EXCEPTION_TRY("main(int, char**)");
-
-   TestException driver(argc, argv);
-
-   return driver.execute();
-
-   EXCEPTION_CATCHALL;
-}
Index: mkjer/Util/FileIO/FXYZ/readFXYZ.m
===================================================================
--- Damkjer/Util/FileIO/FXYZ/readFXYZ.m	(revision 16)
+++ 	(revision )
@@ -1,57 +1,0 @@
-%%READXYZ    Read XYZ formatted file.
-%   [POINTS,FRAMES,PIXELS] = READXYZ(FILENAME) parses the file FILENAME for
-%   binary point tuples. POINTS is a 3-by-N collection of world coordinate
-%   points, FRAMES is a 1-by-N collection of IFOV frame indices for the
-%   associated points, and PIXELS is a 1-by-N collection of IFOV pixel
-%   indices for the associated points.
-%
-%   FILENAME is a string containing the name of the file to be opened.  
-%
-%   PIXELS indices follow the convention that negative indices capture
-%   information about IFOV. Index -5 is the effective center of the IFOV
-%   while indices -1 through -4 capture the IFOV corners at the top of the
-%   range gate.
-%
-%   See also FOPEN.
-
-%   Copyright 2012 Kristian Linn Damkjer
-function [X,F,P] = readXYZ(filename)
-
-% Attempt to open the file for reading.
-[fid, msg] = fopen(filename, 'r');
-
-% If unsuccessful, let the user know why and return empy tuples.
-if (fid < 0)
-    disp(msg);
-    X = zeros(3,0);
-    F = zeros(1,0,'int32');
-    P = zeros(1,0,'int32');
-    return;
-end
-
-% Otherwise, parse the data.
-dirStruct = dir(filename);
-
-
-numPts = (dirStruct.bytes-24)/20;
-
-tic;
-
-offsets = fread(fid, 3, 'double=>double');
-
-temp = reshape(fread(fid, inf, 'single=>single'),5,numPts);
-
-size(offsets)
-size(temp)
-
-X = bsxfun(@plus, temp(1:3,:), offsets);
-F = typecast(temp(4,:),'int32');
-P = typecast(temp(5,:),'int32');
-
-disp(['Time to parse file: ' num2str(toc) 's']);
-
-fclose(fid);
-
-return;
-
-end
Index: Damkjer/Util/FileIO/GeoKey/GTModelTypeGeoKey.m
===================================================================
--- Damkjer/Util/FileIO/GeoKey/GTModelTypeGeoKey.m	(revision 6)
+++ Damkjer/Util/FileIO/GeoKey/GTModelTypeGeoKey.m	(revision 0)
Index: Damkjer/Util/FileIO/GeoKey/GeoKey.m
===================================================================
--- Damkjer/Util/FileIO/GeoKey/GeoKey.m	(revision 7)
+++ Damkjer/Util/FileIO/GeoKey/GeoKey.m	(revision 0)
@@ -1,87 +1,2 @@
-% GeoKey   Abstract class for GeoTIFF Key data structures.
-%
-% File:
-%    LasVlr.m
-%
-% Description:
-%    This class provides a common ancestor and interface for GeoTIFF Key data
-%    structures.
-%
-% Limitations:
-%    None.
-%
-% Properties:
-%    None.
-%
-% Methods:
-%    None.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    http://www.remotesensing.org/geotiff/spec/geotiffhome.html
-%
-% See Also:
-%    GTModelTypeGeoKey
-%    GTRasterTypeGeoKey
-%    GeographicTypeGeoKey
-%    GeogGeodeticDatumGeoKey
-%    GeogPrimeMeridianGeoKey
-%    GeogLinearUnitsGeoKey
-%    GeogAngularUnitsGeoKey
-%    GeogEllipsoidGeoKey
-%    GeogAzimuthUnitsGeoKey
-%    ProjectedCSTypeGeoKey
-%    ProjectionGeoKey
-%    ProjCoordTransGeoKey
-%    ProjLinearUnitsGeoKey
-%    VerticalCSTypeGeoKey
-%    VerticalDatumGeoKey
-%    VerticalUnitsGeoKey
-%    GeogLinearUnitSizeGeoKey
-%    GeogAngularUnitSizeGeoKey
-%    GeogSemiMajorAxisGeoKey
-%    GeogSemiMinorAxisGeoKey
-%    GeogInvFlatteningGeoKey
-%    GeogPrimeMeridianLongGeoKey
-%    ProjLinearUnitSizeGeoKey
-%    ProjStdParallel1GeoKey
-%    ProjStdParallel2GeoKey
-%    ProjNatOriginLongGeoKey
-%    ProjNatOriginLatGeoKey
-%    ProjFalseEastingGeoKey
-%    ProjFalseNorthingGeoKey
-%    ProjFalseOriginLongGeoKey
-%    ProjFalseOriginLatGeoKey
-%    ProjFalseOriginEastingGeoKey
-%    ProjFalseOriginNorthingGeoKey
-%    ProjCenterLongGeoKey
-%    ProjCenterLatGeoKey
-%    ProjCenterEastingGeoKey
-%    ProjCenterNorthingGeoKey
-%    ProjScaleAtNatOriginGeoKey
-%    ProjScaleAtCenterGeoKey
-%    ProjAzimuthAngleGeoKey
-%    ProjStraightVertPoleLongGeoKey
-%    GTCitationGeoKey
-%    GeogCitationGeoKey
-%    PCSCitationGeoKey
-%    VerticalCitationGeoKey
-%
-
-% Software History:
-%    2012-AUG-29   K. Damkjer
-%       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
-%
-
 classdef GeoKey
     methods (Abstract = true)
Index: Damkjer/Util/FileIO/GeoKey/ProjLinearUnitsGeoKey.m
===================================================================
--- Damkjer/Util/FileIO/GeoKey/ProjLinearUnitsGeoKey.m	(revision 12)
+++ Damkjer/Util/FileIO/GeoKey/ProjLinearUnitsGeoKey.m	(revision 0)
@@ -1,174 +1,62 @@
-% ProjLinearUnitsGeoKey   Vantage Point Tree spatial indexing data structure
-%
-% File: ProjLinearUnitsGeoKey.m
-%
-% Description:
-%    Provides the definition for GeoTIFF Projected Linear Units Keys.
-%
-% Limitations:
-%    No known limitations.
-%
-% Properties:
-%    code           - The code for the projected linear unit described by this
-%                     key.
-%    interpretation - The interpretation of the projected linear unit described
-%                     by this key.
-%
-% Methods:
-%        [this] = ProjLinearUnitsGeoKey(varargin) - Constructor
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    http://www.remotesensing.org/geotiff/spec/geotiffhome.html
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2012 Kristian L. Damkjer.
-%
-% Software History:
-%    2012-SEP-07   K. Damkjer
-%       Initial Coding.
-%
-
-%******************************************************************************
-% CLASS: ProjLinearUnitsGeoKey
-%    GeoTIFF Projected Linear Units Key.  There are several different kinds of
-%    units that may be used in geographically related raster data: linear
-%    units, angular units, units of time (e.g. for radar-return), CCD-voltages,
-%    etc. For this reason there will be a single, unique range for each kind of
-%    unit, broken down into the following currently defined ranges:
-%
-%       Range          | Allocation
-%       ---------------|--------------------------------------------------------
-%       0              | undefined
-%       [   1,  2000]  | Obsolete GeoTIFF codes
-%       [2001,  8999]  | Reserved by GeoTIFF
-%       [9000,  9099]  | EPSG Linear Units.
-%       [9100,  9199]  | EPSG Angular Units.
-%       32767          | user-defined unit
-%       [32768, 65535] | Private User Implementations
-%
-%    Linear Unit Values (See the ESPG/POSC tables for definition):
-%       Unit                        | Code
-%       ----------------------------|------------------------------------------
-%       Meter                       | 9001
-%       Foot                        | 9002
-%       Foot (US Survey)            | 9003
-%       Foot (Modified American)    | 9004
-%       Foot (Clarke)               | 9005
-%       Foot (Indian)               | 9006
-%       Link                        | 9007
-%       Link (Benoit)               | 9008
-%       Link (Sears)                | 9009
-%       Chain (Benoit               | 9010
-%       Chain (Sears)               | 9011
-%       Yard (Sears)                | 9012
-%       Yard (Indian)               | 9013
-%       Fathom                      | 9014
-%       International Nautical Mile | 9015
-%******************************************************************************
 classdef (Sealed = true) ProjLinearUnitsGeoKey < GeoKey
-   properties
-      % The code for the projected linear unit described by this key. The
-      % default value, 0, indicates "undefined".
-      code = 0
-   end
-   
-   properties (Access = private, Constant = true)
-      % The mapping of defined codes and interpretations.
-      codes = containers.Map(...
-         {9001,...
-         9002,...
-         9003,...
-         9004,...
-         9005,...
-         9006,...
-         9007,...
-         9008,...
-         9009,...
-         9010,...
-         9011,...
-         9012,...
-         9013,...
-         9014,...
-         9015},...
-         {'Meter',...
-         'Foot',...
-         'Foot (US Survey)',...
-         'Foot (Modified American)',...
-         'Foot (Clarke)',...
-         'Foot (Indian)',...
-         'Link',...
-         'Link (Benoit)',...
-         'Link (Sears)',...
-         'Chain (Benoit)',...
-         'Chain (Sears)',...
-         'Yard (Sears)',...
-         'Yard (Indian)',...
-         'Fathom',...
-         'International Nautical Mile'});
-   end
-   
-   properties (Dependent)
-      % The interpretation of the projected linear unit described by this key.
-      interpretation
-   end
-   
-   methods
-      %************************************************************************
-      % ProjLinearUnitsGeoKey/ProjLinearUnitsGeoKey
-      %************************************************************************
-      function this = ProjLinearUnitsGeoKey(varargin)
-         % The Constructor.  The constructor may be called with an argument
-         % list to specify the code for the key. If no argument is provided,
-         % the default constructor creates a key with "undefined" linear unit.
-         %
-         % Parameters:
-         %    varargin - Variable-length input argument list. The argument list
-         %               may contain up to a single argument. If an argument is
-         %               provided, it will be checked against the list of known
-         %               linear units. if the code is not recognized, an error
-         %               will be thrown. Similarly, if the constructor is
-         %               called with more than one argument, an error will be
-         %               thrown.
-
-         if (nargin == 0)
-            this.code = 0;
-         elseif (nargin == 1)
-            if (~this.codes.isKey(varargin{1}))
-                error('ProjLinearUnitsGeoKey:InitError',...
-                      'Unknown Unit');
+    properties
+        code = 2
+    end
+    
+    properties (GetAccess = private,Constant = true)
+        codes = containers.Map(...
+            {9001,...
+            9002,...
+            9003,...
+            9004,...
+            9005,...
+            9006,...
+            9007,...
+            9008,...
+            9009,...
+            9010,...
+            9011,...
+            9012,...
+            9013,...
+            9014,...
+            9015},...
+            {'Meter',...
+            'Foot',...
+            'Foot (US Survey)',...
+            'Foot (Modified American)',...
+            'Foot (Clarke)',...
+            'Foot (Indian)',...
+            'Link',...
+            'Link (Benoit)',...
+            'Link (Sears)',...
+            'Chain (Benoit)',...
+            'Chain (Sears)',...
+            'Yard (Sears)',...
+            'Yard (Indian)',...
+            'Fathom',...
+            'International Nautical Mile'});
+    end
+    
+    properties (Dependent)
+        interpretation
+    end
+    
+    methods
+        function vlr = ProjLinearUnitsGeoKey(varargin)
+            if (nargin == 1)
+                if (~vlr.codes.isKey(varargin{1}))
+                    error('ProjLinearUnitsGeoKey:InitError',...
+                        'Unknown Unit');
+                end
+                vlr.code = varargin{1};
             end
-            this.code = varargin{1};
-         elseif (nargin > 1)
-            error('ProjLinearUnitsGeoKey:InvalidArgument',...
-                  'Too many arguments provided to constructor.');
-         end
-      end
-      
-      %************************************************************************
-      % ProjLinearUnitsGeoKey/get.interpretation
-      %************************************************************************
-      function meaning = get.interpretation(this)
-         % Reinterpret the key code in human-readable format.
-         %
-         % Returns:
-         %    meaning - The interpretation of the code.
-         
-         meaning = this.codes(this.code);
-      end
-      
-   end
+        end
+        
+        function meaning = get.interpretation(vlr)
+            % Required accessor for dependent property: interpretation
+            
+            meaning = vlr.codes(vlr.code);
+        end
+        
+    end
 end
-   
-   
Index: Damkjer/Util/FileIO/GeoKey/VerticalUnitsGeoKey.m
===================================================================
--- Damkjer/Util/FileIO/GeoKey/VerticalUnitsGeoKey.m	(revision 6)
+++ Damkjer/Util/FileIO/GeoKey/VerticalUnitsGeoKey.m	(revision 0)
@@ -1,62 +1,62 @@
 classdef (Sealed = true) VerticalUnitsGeoKey < GeoKey
-   properties
-      code = 2
-   end
-   
-   properties (GetAccess = private,Constant = true)
-      codes = containers.Map(...
-         {9001,...
-         9002,...
-         9003,...
-         9004,...
-         9005,...
-         9006,...
-         9007,...
-         9008,...
-         9009,...
-         9010,...
-         9011,...
-         9012,...
-         9013,...
-         9014,...
-         9015},...
-         {'Meter',...
-         'Foot',...
-         'Foot (US Survey)',...
-         'Foot (Modified American)',...
-         'Foot (Clarke)',...
-         'Foot (Indian)',...
-         'Link',...
-         'Link (Benoit)',...
-         'Link (Sears)',...
-         'Chain (Benoit)',...
-         'Chain (Sears)',...
-         'Yard (Sears)',...
-         'Yard (Indian)',...
-         'Fathom',...
-         'International Nautical Mile'});
-   end
-   
-   properties (Dependent)
-      interpretation
-   end
-   
-   methods
-      function vlr = VerticalUnitsGeoKey(varargin)
-         if (nargin == 1)
-            if (~vlr.codes.isKey(varargin{1}))
-               error('VerticalUnitsGeoKey:InitError',...
-                  'Unknown Unit');
+    properties
+        code = 2
+    end
+    
+    properties (GetAccess = private,Constant = true)
+        codes = containers.Map(...
+            {9001,...
+            9002,...
+            9003,...
+            9004,...
+            9005,...
+            9006,...
+            9007,...
+            9008,...
+            9009,...
+            9010,...
+            9011,...
+            9012,...
+            9013,...
+            9014,...
+            9015},...
+            {'Meter',...
+            'Foot',...
+            'Foot (US Survey)',...
+            'Foot (Modified American)',...
+            'Foot (Clarke)',...
+            'Foot (Indian)',...
+            'Link',...
+            'Link (Benoit)',...
+            'Link (Sears)',...
+            'Chain (Benoit)',...
+            'Chain (Sears)',...
+            'Yard (Sears)',...
+            'Yard (Indian)',...
+            'Fathom',...
+            'International Nautical Mile'});
+    end
+    
+    properties (Dependent)
+        interpretation
+    end
+    
+    methods
+        function vlr = VerticalUnitsGeoKey(varargin)
+            if (nargin == 1)
+                if (~vlr.codes.isKey(varargin{1}))
+                    error('VerticalUnitsGeoKey:InitError',...
+                        'Unknown Unit');
+                end
+                vlr.code = varargin{1};
             end
-            vlr.code = varargin{1};
-         end
-      end
-      
-      function meaning = get.interpretation(vlr)
-         % Required accessor for dependent property: interpretation
-         
-         meaning = vlr.codes(vlr.code);
-      end
-      
-   end
+        end
+        
+        function meaning = get.interpretation(vlr)
+            % Required accessor for dependent property: interpretation
+            
+            meaning = vlr.codes(vlr.code);
+        end
+        
+    end
 end
Index: Damkjer/Util/FileIO/GeoKey/geoKeyFactory.m
===================================================================
--- Damkjer/Util/FileIO/GeoKey/geoKeyFactory.m	(revision 7)
+++ Damkjer/Util/FileIO/GeoKey/geoKeyFactory.m	(revision 0)
@@ -1,139 +1,2 @@
-% geoKeyFactory   Concrete factory for GeoTIFF key objects
-%
-% File:
-%    geoKeyFactory.m
-%
-% Description:
-%    This MATLAB function provides an interface similar to a concrete factory
-%    in the abstract factory design pattern for constructing defined GeoTIFF key
-%    objects.
-%
-% Limitations:
-%    Several of the concrete classes referenced by this factory do not exist.
-%    This means that an error will be thrown if they key is recognized, but no
-%    corresponding class exists. This was done to allow me to incrementally
-%    develop classes for keys as they are encountered.
-%
-% Synopsis:
-%    [key] = geoKeyFactory(code, location, size, data)
-%
-% Inputs:
-%    vlrHeader  - A LAS VLR object containing populated header data
-%
-% Outputs:
-%    vlr  - A specialized LAS File VLR Specification object
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    GTModelTypeGeoKey.m
-%    GTRasterTypeGeoKey.m
-%    GeographicTypeGeoKey.m
-%    GeogGeodeticDatumGeoKey.m
-%    GeogPrimeMeridianGeoKey.m
-%    GeogLinearUnitsGeoKey.m
-%    GeogAngularUnitsGeoKey.m
-%    GeogEllipsoidGeoKey.m
-%    GeogAzimuthUnitsGeoKey.m
-%    ProjectedCSTypeGeoKey.m
-%    ProjectionGeoKey.m
-%    ProjCoordTransGeoKey.m
-%    ProjLinearUnitsGeoKey.m
-%    VerticalCSTypeGeoKey.m
-%    VerticalDatumGeoKey.m
-%    VerticalUnitsGeoKey.m
-%    GeogLinearUnitSizeGeoKey.m
-%    GeogAngularUnitSizeGeoKey.m
-%    GeogSemiMajorAxisGeoKey.m
-%    GeogSemiMinorAxisGeoKey.m
-%    GeogInvFlatteningGeoKey.m
-%    GeogPrimeMeridianLongGeoKey.m
-%    ProjLinearUnitSizeGeoKey.m
-%    ProjStdParallel1GeoKey.m
-%    ProjStdParallel2GeoKey.m
-%    ProjNatOriginLongGeoKey.m
-%    ProjNatOriginLatGeoKey.m
-%    ProjFalseEastingGeoKey.m
-%    ProjFalseNorthingGeoKey.m
-%    ProjFalseOriginLongGeoKey.m
-%    ProjFalseOriginLatGeoKey.m
-%    ProjFalseOriginEastingGeoKey.m
-%    ProjFalseOriginNorthingGeoKey.m
-%    ProjCenterLongGeoKey.m
-%    ProjCenterLatGeoKey.m
-%    ProjCenterEastingGeoKey.m
-%    ProjCenterNorthingGeoKey.m
-%    ProjScaleAtNatOriginGeoKey.m
-%    ProjScaleAtCenterGeoKey.m
-%    ProjAzimuthAngleGeoKey.m
-%    ProjStraightVertPoleLongGeoKey.m
-%    GTCitationGeoKey.m
-%    GeogCitationGeoKey.m
-%    PCSCitationGeoKey.m
-%    VerticalCitationGeoKey.m
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    http://www.remotesensing.org/geotiff/spec/geotiffhome.html
-%
-% See Also:
-%    GeoKey
-%    GTModelTypeGeoKey
-%    GTRasterTypeGeoKey
-%    GeographicTypeGeoKey
-%    GeogGeodeticDatumGeoKey
-%    GeogPrimeMeridianGeoKey
-%    GeogLinearUnitsGeoKey
-%    GeogAngularUnitsGeoKey
-%    GeogEllipsoidGeoKey
-%    GeogAzimuthUnitsGeoKey
-%    ProjectedCSTypeGeoKey
-%    ProjectionGeoKey
-%    ProjCoordTransGeoKey
-%    ProjLinearUnitsGeoKey
-%    VerticalCSTypeGeoKey
-%    VerticalDatumGeoKey
-%    VerticalUnitsGeoKey
-%    GeogLinearUnitSizeGeoKey
-%    GeogAngularUnitSizeGeoKey
-%    GeogSemiMajorAxisGeoKey
-%    GeogSemiMinorAxisGeoKey
-%    GeogInvFlatteningGeoKey
-%    GeogPrimeMeridianLongGeoKey
-%    ProjLinearUnitSizeGeoKey
-%    ProjStdParallel1GeoKey
-%    ProjStdParallel2GeoKey
-%    ProjNatOriginLongGeoKey
-%    ProjNatOriginLatGeoKey
-%    ProjFalseEastingGeoKey
-%    ProjFalseNorthingGeoKey
-%    ProjFalseOriginLongGeoKey
-%    ProjFalseOriginLatGeoKey
-%    ProjFalseOriginEastingGeoKey
-%    ProjFalseOriginNorthingGeoKey
-%    ProjCenterLongGeoKey
-%    ProjCenterLatGeoKey
-%    ProjCenterEastingGeoKey
-%    ProjCenterNorthingGeoKey
-%    ProjScaleAtNatOriginGeoKey
-%    ProjScaleAtCenterGeoKey
-%    ProjAzimuthAngleGeoKey
-%    ProjStraightVertPoleLongGeoKey
-%    GTCitationGeoKey
-%    GeogCitationGeoKey
-%    PCSCitationGeoKey
-%    VerticalCitationGeoKey
-%
-
-% Software History:
-%    2012-AUG-29   K. Damkjer
-%       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
-%
-
 function [key] = geoKeyFactory(code, location, size, data)
 switch location
@@ -173,6 +36,6 @@
                 key = VerticalUnitsGeoKey(data);
             otherwise
-                error('geoKeyFactory:InvalidGeoNativeCode',...
-                      'Unrecognized Code for Native GeoKey');
+%                error('geoKeyFactory:InvalidGeoNativeCode',...
+%                    'Unrecognized Code for Native GeoKey');
         end
     case 34736
@@ -229,6 +92,6 @@
                 key = ProjStraightVertPoleLongGeoKey(data);
             otherwise
-               error('geoKeyFactory:InvalidGeoDoubleCode',...
-                     'Unrecognized Code for Double GeoKey');
+%                error('geoKeyFactory:InvalidGeoDoubleCode',...
+%                    'Unrecognized Code for Double GeoKey');
         end
     case 34767
@@ -243,10 +106,10 @@
                 key = VerticalCitationGeoKey(data,size);
             otherwise
-               error('geoKeyFactory:InvalidGeoAsciiCode',...
-                     'Unrecognized Code for Ascii GeoKey');
+%                error('geoKeyFactory:InvalidGeoAsciiCode',...
+%                    'Unrecognized Code for Ascii GeoKey');
         end
     otherwise
-       error('geoKeyFactory:InvalidLocation',...
-             'Unrecognized Data Location for GeoKey');
+%        error('geoKeyFactory:InvalidLocation',...
+%            'Unrecognized Data Location for GeoKey');
 end
 end
Index: Damkjer/Util/FileIO/LasFile/LasFile.m
===================================================================
--- Damkjer/Util/FileIO/LasFile/LasFile.m	(revision 15)
+++ Damkjer/Util/FileIO/LasFile/LasFile.m	(revision 0)
@@ -1,736 +1,613 @@
-% LasFile   ASPRS LAS format data structure
+% LasFile
 %
-% File:
-%    LasFile.m
+% File:  LasFile.m
 %
-% Description:
-%    This MATLAB class represents an ASPRS LAS version 1.2 file.
+% Description: This MATLAB class represents an ASPRS LAS version 1.2
+%              file.
 %
-% Limitations:
-%    There are currently no mechanisms for setting VLR data. This means that it
-%    is not possible to geocode LAS files with this class.
-%
-% Properties:
-%    publicHeader      - The LAS File Public Header Block.
-%    vlrs              - The LAS File VLRs.
-%    intensity         - The Pulse Return Magnitude.
-%    returnNumber      - The Pulse Return Number.
-%    numberOfReturns   - The Pulse Number of Returns.
-%    scanDirection     - The Pulse Scan Direction.
-%    edgeOfFlightLine  - Edge of Flight Line Flag.
-%    classification    - The Pulse Category Classification.
-%    synthetic         - The Synthetic Point Flag.
-%    keyPoint          - The Key Point Flag.
-%    withheld          - The Withheld Point Flag.
-%    scanAngleRank     - The Pulse Scan Angle Rank.
-%    userData          - The User Data Field.
-%    pointSourceID     - The Point Source ID.
-%    points            - The Pulse X, Y, and Z Coordinates.
-%    gpsTime           - The Pulse GPS Time.
-%    color             - The Point Color.
-%
-% Methods:
-%    [lasFile] = LasFile(varargin)   - Constructor for LasFile objects.
-%    [lasFile] = loadFrom(location)  - Load LAS file from a given location. 
-%                saveTo(location)    - Save LAS file to a given location.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    LasPublicHeader.m
-%    LasVlr.m
-%    lasVlrFactory.m
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    http://asprs.org/a/society/committees/standards/asprs_las_format_v12.pdf
-%
-% See Also:
-%    LasPublicHeader
-%    LasVlr
-%    lasVlrFactory
-%
-
-% Copyright (C)  2012 Kristian L. Damkjer.
+% Limitations: This class does not currently capture and pass through VLR
+%              data. There are also currently no mechanisms for setting VLR
+%              data. This means that it is not possible to geocode LAS
+%              files with this class. It also means that any geocoding
+%              information will be lost if data is read in from a geocoded
+%              file. The output will be invalid unless the geocoding VLRs
+%              are removed from the LAS file header.
 %
 % Software History:
 %    2012-AUG-29   K. Damkjer
 %       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
 %
 
-%******************************************************************************
-% CLASS: LasFile
-%    An ASPRS LAS version 1.2 file structure.
-%******************************************************************************
 classdef (Sealed = true) LasFile
-   properties
-      % The LAS File Public Header Block
-      %
-      % The public header block contains information about the LAS file
-      % that is used to document the details of this file for parsing and
-      % writing.
-      publicHeader = LasPublicHeader
-      
-      % The LAS File VLRs
-      %
-      % The Public Header Block is followed by one or more Variable
-      % Length Records. Each VLR header is 54 bytes in length with the
-      % data section dependent on the specific VLR.
-      vlrs
-      
-      % The Pulse Return Magnitude
-      %
-      % The intensity value is the integer representation of the pulse
-      % return magnitude. This value is optional and system specific.
-      % However, it should always be included if available.
-      intensity
-      
-      % The Pulse Return Number
-      %
-      % The Return Number is the pulse return number for a given output
-      % pulse. A given output laser pulse can have many returns, and they
-      % must be marked in sequence of return. The first return will have
-      % a Return Number of one, the second a Return Number of two, and so
-      % on up to five returns.
-      returnNumber
-      
-      % The Pulse Number of Returns
-      %
-      % The Number of Returns is the total number of returns for a given
-      % pulse. For example, a laser data point may be return two (Return
-      % Number) within a total of five returns.
-      numberOfReturns
-      
-      % The Pulse Scan Direction
-      %
-      % The Scan Direction Flag denotes the direction at which the
-      % scanner mirror was travelling at the time of the output pulse. A
-      % bit value of 1 is a positive scan direction, and a bit value of 0
-      % is a negative scan direction (where positive scan direction is a
-      % scan moving from the left side of the in-track direction to the
-      % right side and negative the opposite).
-      scanDirection
-      
-      % Edge of Flight Line Flag
-      %
-      % The Edge of Flight Line data bit has a value of 1 only when the
-      % point is at the end of a scan. It is the last point on a given
-      % scan line before it changes direction.
-      edgeOfFlightLine
-      
-      % The Pulse Category Classification
-      %
-      % Classification in LAS 1.0 was essentially user defined and
-      % optional. Las 1.1 defines a standard set of ASPRS
-      % classifications. In addition, the field is now mandatory. If a
-      % point has never been classified, this byte must be set to zero.
-      % There are no user defined classes since both point format 0 and
-      % point format 1 supply 8 bits per point for user defined
-      % operations.
-      %
-      % | Value | Meaning                                                  |
-      % |-------|----------------------------------------------------------|
-      % |  0    | Created, never classified                                |
-      % |  1    | Unclassified                                             |
-      % |  2    | Ground                                                   |
-      % |  3    | Low Vegetation                                           |
-      % |  4    | Medium Vegetation                                        |
-      % |  5    | High Vegetation                                          |
-      % |  6    | Building                                                 |
-      % |  7    | Low Point (noise)                                        |
-      % |  8    | Model Key-point (mass point)                             |
-      % |  9    | Water                                                    |
-      % | 10    | Reserved for ASPRS Definition                            |
-      % | 11    | Reserved for ASPRS Definition                            |
-      % | 12    | Overlap Point                                            |
-      % | 13-31 | Reserved for ASPRS Definition                            |
-      classification
-      
-      % The Synthetic Point Flag
-      %
-      % If set then this point was created by a technique other than
-      % LIDAR collection such as digitized from a photogrammetric stereo
-      % model.
-      synthetic
-      
-      % The Key Point Flag
-      %
-      % If set then this point is considered to be a model key-point and
-      % thus should generally not be withheld in a thinning algorithm.
-      keyPoint
-      
-      % The Withheld Point Flag
-      %
-      % If set then this point should not be included in processing
-      % (synonymous with Deleted).
-      withheld
-      
-      % The Pulse Scan Angle Rank
-      %
-      % The Scan Angle Rank is a signed one-byte number with a valid
-      % range from -90 to +90. The scan angle Rank is the angle (rounded
-      % to the nearest integer in the absolute value sense) at which the
-      % laser point was output from the laser system including the roll
-      % of the aircraft. The scan angle is within 1 degree of accuracy
-      % from +90 to -90 degrees. The scan angle is an angle based on 0
-      % degrees being nadir, and -90 degrees to the left side of the
-      % aircraft in the direction of flight.
-      scanAngleRank
-      
-      % The User Data Field
-      %
-      % This field may be used at the user's discretion.
-      userData
-      
-      % The Point Source ID
-      %
-      % This value indicates the file from which this point originated.
-      % Valid values for this field are 1 to 65,535 inclusive with zero
-      % being used for a special case discussed below. The numerical
-      % value corresponds to the File Source ID from which this point
-      % originated. Zero is reserved as a convenience to system
-      % implementers. A Point Source ID of zero implies that this point
-      % originated in this file. This implies that processing software
-      % should set the Point Source ID equal to the File Source ID of the
-      % file containing this point at some time during processing.
-      pointSourceID
-   end
-   
-   properties (Access = private)
-      % The Pulse X, Y, and Z Coordinates
-      %
-      % The X, Y, and Z values are stored as long inegers. The X, Y, and
-      % Z values are used in conjunction with the scale values and the
-      % offset values to determine the coordinate for each point as
-      % described in the Public Header Block section.
-      pPoints
-      
-      % The Pulse GPS Time
-      %
-      % The GPS Time is the double floating point time tag value at which
-      % the point was acquired. It is GPS Week Time if the Global
-      % Encoding low bit is clear and POSIX Time if the Global Encoding
-      % low bit is set (see Global Encoding in the Public Header Block
-      % description).
-      pGpsTime
-      
-      % The Point Color
-      %
-      % Red   - The Red image channel value associated with this point
-      % Green - The Green image channel value associated with this point
-      % Blue  - The Blue imagechannel value associated with this point
-      pColor
-   end
-   
-   properties (Dependent)
-      % The Pulse X, Y, and Z Coordinates
-      %
-      % The X, Y, and Z values are stored as long integers. The X, Y, and
-      % Z values are used in conjunction with the scale values and the
-      % offset values to determine the coordinate for each point as
-      % described in the Public Header Block section.
-      points
-      
-      % The Pulse GPS Time
-      %
-      % The GPS Time is the double floating point time tag value at which
-      % the point was acquired. It is GPS Week Time if the Global
-      % Encoding low bit is clear and POSIX Time if the Global Encoding
-      % low bit is set (see Global Encoding in the Public Header Block
-      % description).
-      gpsTime
-      
-      % The Point Color
-      %
-      % Red   - The Red image channel value associated with this point
-      % Green - The Green image channel value associated with this point
-      % Blue  - The Blue imagechannel value associated with this point
-      color
-   end
-   
-   methods
-      %************************************************************************
-      % LasFile/LasFile
-      %************************************************************************
-      function lasFile = LasFile(varargin)
-         % Constructor for LasFile objects
-         %
-         % LasFile objects may be constructed either by using a
-         % no-argument (default) constructor or by passing a file
-         % descriptor or file name.
-         
-         if (nargin == 0)
-            lasFile.pPoints=zeros(3,0,'double');
-            lasFile.intensity=zeros(1,0,'uint16');
-            lasFile.returnNumber=zeros(1,0,'uint8');
-            lasFile.numberOfReturns=zeros(1,0,'uint8');
-            lasFile.scanDirection=false(1,0);
-            lasFile.edgeOfFlightLine=false(1,0);
-            lasFile.classification=zeros(1,0,'uint8');
-            lasFile.synthetic=false(1,0);
-            lasFile.keyPoint=false(1,0);
-            lasFile.withheld=false(1,0);
-            lasFile.scanAngleRank=zeros(1,0,'int8');
-            lasFile.userData=zeros(1,0,'uint8');
-            lasFile.pointSourceID=zeros(1,0,'uint16');
-         elseif (nargin == 1)
-            lasFile = lasFile.loadFrom(varargin{1});
-         end
-      end
-      
-      %************************************************************************
-      % LasFile/get.points
-      %************************************************************************
-      function pointData = get.points(lasFile)
-         % Required accessor for dependent property: points
-         %
-         % Returns:
-         %    pointData - The point set data for this LAS file object.
-         pointData = lasFile.pPoints;
-      end
-
-      %************************************************************************
-      % LasFile/get.gpsTime
-      %************************************************************************
-      function timeData = get.gpsTime(lasFile)
-         % Required accessor for dependent property: gpsTime
-         %
-         % Returns:
-         %    timeData - The GPS time data for this LAS file object.
-         timeData = lasFile.pGpsTime;
-      end
-      
-      %************************************************************************
-      % LasFile/get.color
-      %************************************************************************
-      function colorData = get.color(lasFile)
-         % Required accessor for dependent property: color
-         %
-         % Returns:
-         %    colorData - The color data for this LAS file object.
-         colorData = lasFile.pColor;
-      end
-      
-      %************************************************************************
-      % LasFile/set.points
-      %************************************************************************
-      function lasFile = set.points(lasFile, pointData)
-         % Controlled interface for setting point data on LasFile objects
-         %
-         % Parameters:
-         %    pointData - The point set data to add to this LAS object.
-         %
-         % Returns:
-         %    lasFile  - The LAS file object with updated point data.
-
-         if (size(pointData,1) ~= 3)
-            error('LasFile:DimensionMismatch',...
-                  'Points must have 3 coordinates');
-         end
-         
-         nPoints = size(pointData,2);
-         
-         if (size(lasFile.pPoints,2) > nPoints)
-            lasFile.intensity        = lasFile.intensity(:,1:nPoints);
-            lasFile.returnNumber     = lasFile.returnNumber(:,1:nPoints);
-            lasFile.numberOfReturns  = lasFile.numberOfReturns(:,1:nPoints);
-            lasFile.scanDirection    = lasFile.scanDirection(:,1:nPoints);
-            lasFile.edgeOfFlightLine = lasFile.edgeOfFlightLine(:,1:nPoints);
-            lasFile.classification   = lasFile.classification(:,1:nPoints);
-            lasFile.synthetic        = lasFile.synthetic(:,1:nPoints);
-            lasFile.keyPoint         = lasFile.keyPoint(:,1:nPoints);
-            lasFile.withheld         = lasFile.withheld(:,1:nPoints);
-            lasFile.scanAngleRank    = lasFile.scanAngleRank(:,1:nPoints);
-            lasFile.userData         = lasFile.userData(:,1:nPoints);
-            lasFile.pointSourceID    = lasFile.pointSourceID(:,1:nPoints);
-         else
-            addPoints = nPoints-size(lasFile.pPoints,2);
-            lasFile.intensity = ...
-               [lasFile.intensity zeros(1,addPoints,'uint16')];
-            lasFile.returnNumber = ...
-               [lasFile.returnNumber zeros(1,addPoints,'uint8')];
-            lasFile.numberOfReturns = ...
-               [lasFile.numberOfReturns zeros(1,addPoints,'uint8')];
-            lasFile.scanDirection = ...
-               [lasFile.scanDirection false(1,addPoints)];
-            lasFile.edgeOfFlightLine = ...
-               [lasFile.edgeOfFlightLine false(1,addPoints)];
-            lasFile.classification = ...
-               [lasFile.classification zeros(1,addPoints,'uint8')];
-            lasFile.synthetic = ...
-               [lasFile.synthetic false(1,addPoints)];
-            lasFile.keyPoint = ...
-               [lasFile.keyPoint false(1,addPoints)];
-            lasFile.withheld = ...
-               [lasFile.withheld false(1,addPoints)];
-            lasFile.scanAngleRank = ...
-               [lasFile.scanAngleRank zeros(1,addPoints,'int8')];
-            lasFile.userData = ...
-               [lasFile.userData zeros(1,addPoints,'uint8')];
-            lasFile.pointSourceID = ...
-               [lasFile.pointSourceID zeros(1,addPoints,'uint16')];
-         end
-         
-         lasFile.pPoints = pointData;
-         
-         lasFile.publicHeader.nPoints = size(pointData,2);
-         lasFile.publicHeader.nPointsByReturn(1) = size(pointData,2);
-         maxX = max(pointData(1,:));
-         minX = min(pointData(1,:));
-         maxY = max(pointData(2,:));
-         minY = min(pointData(2,:));
-         maxZ = max(pointData(3,:));
-         minZ = min(pointData(3,:));
-         lasFile.publicHeader.maxX = maxX;
-         lasFile.publicHeader.minX = minX;
-         lasFile.publicHeader.maxY = maxY;
-         lasFile.publicHeader.minY = minY;
-         lasFile.publicHeader.maxZ = maxZ;
-         lasFile.publicHeader.minZ = minZ;
-         lasFile.publicHeader.xOffset = minX+0.5*(maxX-minX);
-         lasFile.publicHeader.yOffset = minY+0.5*(maxY-minY);
-         lasFile.publicHeader.zOffset = minZ+0.5*(maxZ-minZ);
-         lasFile.publicHeader.xScaleFactor = (maxX-minX)/...
-                                             double(intmax('uint32')-1);
-         lasFile.publicHeader.yScaleFactor = (maxY-minY)/...
-                                             double(intmax('uint32')-1);
-         lasFile.publicHeader.zScaleFactor = (maxZ-minZ)/...
-                                             double(intmax('uint32')-1);
-      end
-      
-      %************************************************************************
-      % LasFile/set.gpsTime
-      %************************************************************************
-      function lasFile = set.gpsTime(lasFile, timeData)
-         % Controlled interface for setting GPS time data on LasFile objects
-         %
-         % Parameters:
-         %    timeData - The GPS time information to add to this LAS object's
-         %                point set.
-         %
-         % Returns:
-         %    lasFile  - The LAS file object with updated GPS time data.
-         
-         if (size(timeData,2) ~= lasFile.publicHeader.nPoints)
-            error('LasFile:DimensionMismatch',...
-                  'GPS Time Data must have an entry for each point');
-         end
-         
-         lasFile.pGpsTime = timeData;
-         
-         lasFile.publicHeader.pointDataFormatID = ...
-            bitor(lasFile.publicHeader.pointDataFormatID,1);
-         
-         if (lasFile.publicHeader.pointDataFormatID == 1)
-            lasFile.publicHeader.pointDataRecordLength = 28;
-         elseif (lasFile.publicHeader.pointDataFormatID == 3)
-            lasFile.publicHeader.pointDataRecordLength = 34;
-         end
-      end
-      
-      %************************************************************************
-      % LasFile/set.color
-      %************************************************************************
-      function lasFile = set.color(lasFile, colorData)
-         % Controlled interface for setting color data on LasFile objects.
-         %
-         % Parameters:
-         %    colorData - The color information to add to this LAS object's
-         %                point set.
-         %
-         % Returns:
-         %    lasFile  - The LAS file object with updated color data.
-         
-         if (~isa(colorData,'uint16'))
-            error('LasFile:DataTypeMismatch',...
-                  'Color data must be of type uint16');
-         end
-         
-         if (size(colorData,1) ~= 3)
-            error('LasFile:DimensionMismatch',...
-                  'Color data must have 3 coordinates');
-         end
-         
-         if (size(colorData,2) ~= lasFile.publicHeader.nPoints)
-            error('LasFile:DimensionMismatch',...
-                  'Color data must have an entry for each point');
-         end
-         
-         lasFile.pColor = colorData;
-         
-         lasFile.publicHeader.pointDataFormatID = ...
-            bitor(lasFile.publicHeader.pointDataFormatID,2);
-         
-         if (lasFile.publicHeader.pointDataFormatID == 2)
-            lasFile.publicHeader.pointDataRecordLength = 26;
-         elseif (lasFile.publicHeader.pointDataFormatID == 3)
-            lasFile.publicHeader.pointDataRecordLength = 34;
-         end
-      end
-      
-      %************************************************************************
-      % LasFile/loadFrom
-      %************************************************************************
-      function lasFile = loadFrom(lasFile,location)
-         % Load the LAS file from the given location.
-         %
-         % Parameters:
-         %    location - The file name or handle containing LAS data to load
-         %               into this object.
-         %
-         % Returns:
-         %    lasFile  - The LAS file object with data populated from the input
-         %               file location.
-         
-         if (ischar(location))
-            % Assume single argument is file name
-            [fid, msg]=fopen(location, 'r');
-            
-            if (fid < 0)
-               error('LasFile:FileError',msg);
-            end
-         elseif (isnumeric(location))
-            % Assume single argument is file ID
-            fid = location;
-         else
-            error('LasFile:InitError',...
-                  'Unknown argument initializer');
-         end
-         
-         % Parse the LAS Public Header Block
-         lasFile.publicHeader = LasPublicHeader(fid);
-         
-         % Parse the LAS Variable Length Record Headers
-         if (lasFile.publicHeader.nVLRs > 0)
-            vlrHeaders = LasVlr(fid);
-            
-            my_vlrs = cell(lasFile.publicHeader.nVLRs,1);
-            
-            for vlr=1:lasFile.publicHeader.nVLRs
-               my_vlrs{vlr} = lasVlrFactory(vlrHeaders(vlr));
-            end
-            
-            lasFile.vlrs = my_vlrs;
-         end
-         
-         % Un-Pack data from uint8 for fast reading.
-         fseek(fid, lasFile.publicHeader.offsetToPointData, 'bof');
-         temp = reshape(...
-                   fread(...
-                      fid,...
-                      double(lasFile.publicHeader.pointDataRecordLength)*...
-                      lasFile.publicHeader.nPoints,...
-                      'uint8=>uint8'),...
-                   lasFile.publicHeader.pointDataRecordLength,...
-                   lasFile.publicHeader.nPoints);
-         fclose(fid);
-         
-         offsets = diag([lasFile.publicHeader.xOffset,...
-                         lasFile.publicHeader.yOffset,...
-                         lasFile.publicHeader.zOffset]);
-         
-         scales = diag([lasFile.publicHeader.xScaleFactor,...
-                        lasFile.publicHeader.yScaleFactor,...
-                        lasFile.publicHeader.zScaleFactor]);
-         
-         tempPoints  = temp(1:12,:);
-         tempInt     = temp(13:14,:);
-         tempPtInfo  = temp(15,:);
-         tempPtClass = temp(16,:);
-         tempSARank  = temp(17,:);
-         tempUData   = temp(18,:);
-         tempSrcID   = temp(19:20,:);
-         
-         lasFile.pPoints = double(reshape(typecast(tempPoints(:),'int32'),...
-                                  3,lasFile.publicHeader.nPoints));
-         
-         lasFile.pPoints = scales*lasFile.pPoints+...
-                           offsets*ones(size(lasFile.pPoints));
-         
-         lasFile.intensity=reshape(typecast(tempInt(:),'uint16'),...
-                                   1,lasFile.publicHeader.nPoints);
-         
-         lasFile.returnNumber     = bitand(tempPtInfo,7);
-         lasFile.numberOfReturns  = bitand(bitshift(tempPtInfo,-3),7);
-         lasFile.scanDirection    = logical(bitget(tempPtInfo,7));
-         lasFile.edgeOfFlightLine = logical(bitget(tempPtInfo,8));
-         
-         lasFile.withheld       = logical(bitget(tempPtClass,8));
-         lasFile.keyPoint       = logical(bitget(tempPtClass,7));
-         lasFile.synthetic      = logical(bitget(tempPtClass,6));
-         lasFile.classification = bitand(tempPtClass,31);
-         
-         lasFile.scanAngleRank=reshape(typecast(tempSARank(:),...
-                                       'int8'),1,lasFile.publicHeader.nPoints);
-         
-         lasFile.userData=reshape(typecast(tempUData(:),'uint8'),...
-                                  1,lasFile.publicHeader.nPoints);
-         
-         lasFile.pointSourceID=reshape(typecast(tempSrcID(:),'uint16'),...
-                                       1,lasFile.publicHeader.nPoints);
-         
-         switch lasFile.publicHeader.pointDataFormatID
-            case 1
-               tempGps = temp(21:28,:);
-               
-               lasFile.pGpsTime=reshape(typecast(tempGps(:),'double'),...
-                                        1,lasFile.publicHeader.nPoints);
-            case 2
-               tempColor = temp(21:26,:);
-               
-               lasFile.pColor = reshape(typecast(tempColor(:),'uint16'),...
-                                        3,lasFile.publicHeader.nPoints);
-            case 3
-               tempGps   = temp(21:28,:);
-               tempColor = temp(29:34,:);
-               
-               lasFile.pGpsTime=reshape(typecast(tempGps(:),'double'),...
-                                        1,lasFile.publicHeader.nPoints);
-               
-               lasFile.pColor = reshape(typecast(tempColor(:),'uint16'),...
-                                        3,lasFile.publicHeader.nPoints);
-         end
-         
-         % Update offsets
-         lasFile.publicHeader.offsetToPointData =...
-            lasFile.publicHeader.headerSize;
-         
-         for record=1:lasFile.publicHeader.nVLRs
-            lasFile.publicHeader.offsetToPointData = ...
-               lasFile.publicHeader.offsetToPointData + 54 + ...
-               lasFile.vlrs{record}.recordLengthAfterHeader;
-         end
-      end
-      
-      %************************************************************************
-      % LasFile/saveTo
-      %************************************************************************
-      function saveTo(lasFile,location)
-         % Save the LAS file to the given location.
-         %
-         % Parameters:
-         %    location - The file name or handle to receive this object's
-         %               state.
-         
-         if (ischar(location))
-            % Assume single argument is file name
-            [fid, msg]=fopen(location, 'w');
-            
-            if (fid < 0)
-               error('LasFile:FileError',msg);
-            end
-         elseif (isnumeric(location))
-            % Assume single argument is file ID
-            fid = location;
-            
-         else
-            error('LasFile:InitError',...
-                  'Unknown argument initializer');
-         end
-         
-         lasFile.publicHeader.saveTo(fid);
-         
-         for record=1:lasFile.publicHeader.nVLRs
-            lasFile.vlrs{record}.saveTo(fid);
-         end
-         
-         % Pack data to uint8 for fast writing.
-         offs=diag([lasFile.publicHeader.xOffset,...
-                    lasFile.publicHeader.yOffset,...
-                    lasFile.publicHeader.zOffset]);
-         
-         invSF=diag([1/lasFile.publicHeader.xScaleFactor,...
-                     1/lasFile.publicHeader.yScaleFactor,...
-                     1/lasFile.publicHeader.zScaleFactor]);
-         
-         outPoints=int32(invSF*(lasFile.pPoints-...
-                                offs*ones(size(lasFile.pPoints))));
-         
-         uintPoints = reshape(typecast(outPoints(:),'uint8'),...
-                              12,lasFile.publicHeader.nPoints);
-         
-         uintInt = reshape(typecast(lasFile.intensity(:),'uint8'),...
-                           2,lasFile.publicHeader.nPoints);
-         
-         ptInfo = bitand(lasFile.returnNumber,7);
-         ptInfo = bitor(bitshift(bitand(lasFile.numberOfReturns,7),3),ptInfo);
-         ptInfo = bitset(ptInfo,7,lasFile.scanDirection);
-         ptInfo = bitset(ptInfo,8,lasFile.edgeOfFlightLine);
-         
-         ptClass = bitand(lasFile.classification,31);
-         ptClass = bitset(ptClass,6,lasFile.synthetic);
-         ptClass = bitset(ptClass,7,lasFile.keyPoint);
-         ptClass = bitset(ptClass,8,lasFile.withheld);
-         
-         uintSA = reshape(typecast(lasFile.scanAngleRank(:),'uint8'),...
-                          1,lasFile.publicHeader.nPoints);
-         
-         uintID = reshape(typecast(lasFile.pointSourceID(:),'uint8'),...
-                          2,lasFile.publicHeader.nPoints);
-         
-         switch lasFile.publicHeader.pointDataFormatID
-            case 0
-               temp = [uintPoints;...
-                       uintInt;...
-                       ptInfo;...
-                       ptClass;...
-                       uintSA;...
-                       lasFile.userData;...
-                       uintID];
-            case 1
-               uintGPS = reshape(typecast(lasFile.pGpsTime(:),'uint8'),...
-                                 8,lasFile.publicHeader.nPoints);
-               
-               temp = [uintPoints;...
-                       uintInt;...
-                       ptInfo;...
-                       ptClass;...
-                       uintSA;...
-                       lasFile.userData;...
-                       uintID;...
-                       uintGPS];
-            case 2
-               uintColor = reshape(typecast(lasFile.pColor(:),'uint8'),...
-                  6,lasFile.publicHeader.nPoints);
-               
-               temp = [uintPoints;...
-                       uintInt;...
-                       ptInfo;...
-                       ptClass;...
-                       uintSA;...
-                       lasFile.userData;...
-                       uintID;...
-                       uintColor];
-            case 3
-               uintGPS = reshape(typecast(lasFile.pGpsTime(:),'uint8'),...
-                                 8,lasFile.publicHeader.nPoints);
-               
-               uintColor = reshape(typecast(lasFile.pColor(:),'uint8'),...
-                                   6,lasFile.publicHeader.nPoints);
-               
-               temp = [uintPoints;...
-                       uintInt;...
-                       ptInfo;...
-                       ptClass;...
-                       uintSA;...
-                       lasFile.userData;...
-                       uintID;...
-                       uintGPS;...
-                       uintColor];
-         end
-         
-         fseek(fid, lasFile.publicHeader.offsetToPointData, 'bof');
-         fwrite(fid,temp);
-         
-         if (ischar(location))
-            % Close the file if it was opened  here.
+    properties
+        % The LAS File Public Header Block
+        %
+        % The public header block contains information about the LAS file
+        % that is used to document the details of this file for parsing and
+        % writing.
+        publicHeader = LasPublicHeader
+
+        % The LAS File VLRs
+        %
+        % The Public Header Block is followed by one or more Variable
+        % Length Records. Each VLR header is 54 bytes in length with the
+        % data section dependent on the specific VLR.
+        vlrs
+
+        % The Pulse Return Magnitude
+        %
+        % The intensity value is the integer representation of the pulse
+        % return magnitude. This value is optional and system specific.
+        % However, it should always be included if available.
+        intensity
+
+        % The Pulse Return Number
+        %
+        % The Return Number is the pulse return number for a given output 
+        % pulse. A given output laser pulse can have many returns, and they
+        % must be marked in sequence of return. The first return will have
+        % a Return Number of one, the second a Return Number of two, and so
+        % on up to five returns.
+        returnNumber
+
+        % The Pulse Number of Returns
+        %
+        % The Number of Returns is the total number of returns for a given
+        % pulse. For example, a laser data point may be return two (Return
+        % Number) within a total of five returns.
+        numberOfReturns
+
+        % The Pulse Scan Direction
+        %
+        % The Scan Direction Flag denotes the direction at which the
+        % scanner mirror was travelling at the time of the output pulse. A
+        % bit value of 1 is a positive scan direction, and a bit value of 0
+        % is a negative scan direction (where positive scan direction is a
+        % scan moving from the left side of the in-track direction to the
+        % right side and negative the opposite).
+        scanDirection
+
+        % Edge of Flight Line Flag
+        %
+        % The Edge of Flight Line data bit has a value of 1 only when the
+        % point is at the end of a scan. It is the last point on a given
+        % scan line before it changes direction.
+        edgeOfFlightLine
+
+        % The Pulse Classification
+        %
+        % Classification in LAS 1.0 was essentially user defined and
+        % optional. Las 1.1 defines a standard set of ASPRS
+        % classifications. In addition, the field is now mandatory. If a
+        % point has never been classified, this byte must be set to zero.
+        % There are no user defined classes since both point format 0 and
+        % point format 1 supply 8 bits per point for user defined
+        % operations.
+        %
+        % Value | Meaning
+        % ------+----------------------------------------------------------
+        %  0    | Created, never classified
+        %  1    | Unclassified
+        %  2    | Ground
+        %  3    | Low Vegetation
+        %  4    | Medium Vegetation
+        %  5    | High Vegetation
+        %  6    | Building
+        %  7    | Low Point (noise)
+        %  8    | Model Key-point (mass point)
+        %  9    | Water
+        % 10    | Reserved for ASPRS Definition
+        % 11    | Reserved for ASPRS Definition
+        % 12    | Overlap Point
+        % 13-31 | Reserved for ASPRS Definition
+        classification
+
+        % The Synthetic Point Flag
+        %
+        % If set then this point was created by a technique other than
+        % LIDAR collection such as digitized from a photogrammetric stereo
+        % model.
+        synthetic
+        
+        % The Key Point Flag
+        %
+        % If set then this point is considered to be a model key-point and
+        % thus should generally not be withheld in a thinning algorithm.
+        keyPoint
+        
+        % The Withheld Point Flag
+        %
+        % If set then this point should not be included in processing
+        % (synonymous with Deleted).
+        withheld
+        
+        % The Pulse Scan Angle Rank
+        %
+        % The Scan Angle Rank is a signed one-byte number with a valid
+        % range from -90 to +90. The scan angle Rank is the angle (rounded
+        % to the nearest integer in the absolute value sense) at which the
+        % laser point was output from the laser system including the roll
+        % of the aircraft. The scan angle is within 1 degree of accuracy
+        % from +90 to -90 degrees. The scan angle is an angle based on 0
+        % degrees being nadir, and -90 degrees to the left side of the
+        % aircraft in the direction of flight.
+        scanAngleRank
+
+        % The User Data Field
+        %
+        % This field may be used at the user's discretion.
+        userData
+
+        % The Point Source ID
+        %
+        % This value indicates the file from which this point originated.
+        % Valid values for this field are 1 to 65,535 inclusive with zero
+        % being used for a special case discussed below. The numerical
+        % value corresponds to the File Source ID from which this point
+        % originated. Zero is reserved as a convenience to system
+        % implementers. A Point Source ID of zero implies that this point
+        % originated in this file. This implies that processing software
+        % should set the Point Source ID equal to the File Source ID of the
+        % file containing this point at some time during processing.
+        pointSourceID
+    end
+    
+    properties (Access = private)
+        % The Pulse X, Y, and Z Coordinates
+        %
+        % The X, Y, and Z values are stored as long inegers. The X, Y, and
+        % Z values are used in conjunction with the scale values and the
+        % offset values to determine the coordinate for each point as
+        % described in the Public Header Block section.
+        pPoints
+
+        % The Pulse GPS Time
+        %
+        % The GPS Time is the double floating point time tag value at which
+        % the point was acquired. It is GPS Week Time if the Global
+        % Encoding low bit is clear and POSIX Time if the Global Encoding
+        % low bit is set (see Global Encoding in the Public Header Block
+        % description).
+        pGpsTime
+
+        % The Point Color
+        %
+        % Red: The Red image channel value associated with this point
+        % Green: The Green image channel value associated with this point
+        % Blue: The Blue imagechannel value associated with this point
+        pColor
+    end
+    
+    properties (Dependent)
+        % The Pulse X, Y, and Z Coordinates
+        %
+        % The X, Y, and Z values are stored as long inegers. The X, Y, and
+        % Z values are used in conjunction with the scale values and the
+        % offset values to determine the coordinate for each point as
+        % described in the Public Header Block section.
+        points
+
+        % The Pulse GPS Time
+        %
+        % The GPS Time is the double floating point time tag value at which
+        % the point was acquired. It is GPS Week Time if the Global
+        % Encoding low bit is clear and POSIX Time if the Global Encoding
+        % low bit is set (see Global Encoding in the Public Header Block
+        % description).
+        gpsTime
+
+        % The Point Color
+        %
+        % Red: The Red image channel value associated with this point
+        % Green: The Green image channel value associated with this point
+        % Blue: The Blue imagechannel value associated with this point
+        color
+    end
+    
+    methods
+        function lasFile = LasFile(varargin)
+            % Constructor for LasFile objects
+            %
+            % LasFile objects may be constructed either by using a
+            % no-argument (default) constructor or by passing a file
+            % descriptor or file name.
+            
+            if (nargin == 0)
+                lasFile.pPoints=zeros(3,0,'double');
+                lasFile.intensity=zeros(1,0,'uint16');
+                lasFile.returnNumber=zeros(1,0,'uint8');
+                lasFile.numberOfReturns=zeros(1,0,'uint8');
+                lasFile.scanDirection=false(1,0);
+                lasFile.edgeOfFlightLine=false(1,0);
+                lasFile.classification=zeros(1,0,'uint8');
+                lasFile.synthetic=false(1,0);
+                lasFile.keyPoint=false(1,0);
+                lasFile.withheld=false(1,0);
+                lasFile.scanAngleRank=zeros(1,0,'int8');
+                lasFile.userData=zeros(1,0,'uint8');
+                lasFile.pointSourceID=zeros(1,0,'uint16');
+            elseif (nargin == 1)
+                lasFile = lasFile.loadFrom(varargin{1});
+            end
+        end
+        
+        function pointData = get.points(lasFile)
+            % Required accessor for dependent property: points
+            pointData = lasFile.pPoints;
+        end
+        
+        function timeData = get.gpsTime(lasFile)
+            % Required accessor for dependent property: gpsTime
+            timeData = lasFile.pGpsTime;
+        end
+        
+        function colorData = get.color(lasFile)
+            % Required accessor for dependent property: color
+            colorData = lasFile.pColor;
+        end
+        
+        function lasFile = set.points(lasFile, pointData)
+            % Controlled interface for setting point data on LasFile
+            % objects
+            if (size(pointData,1) ~= 3)
+                error('LasFile:DimensionMismatch',...
+                    'Points must have 3 coordinates');
+            end
+            
+            nPoints = size(pointData,2);
+            
+            if (size(lasFile.pPoints,2) > nPoints)
+                lasFile.intensity=lasFile.intensity(:,1:nPoints);
+                lasFile.returnNumber=lasFile.returnNumber(:,1:nPoints);
+                lasFile.numberOfReturns=lasFile.numberOfReturns(:,1:nPoints);
+                lasFile.scanDirection=lasFile.scanDirection(:,1:nPoints);
+                lasFile.edgeOfFlightLine=lasFile.edgeOfFlightLine(:,1:nPoints);
+                lasFile.classification=lasFile.classification(:,1:nPoints);
+                lasFile.synthetic=lasFile.synthetic(:,1:nPoints);
+                lasFile.keyPoint=lasFile.keyPoint(:,1:nPoints);
+                lasFile.withheld=lasFile.withheld(:,1:nPoints);
+                lasFile.scanAngleRank=lasFile.scanAngleRank(:,1:nPoints);
+                lasFile.userData=lasFile.userData(:,1:nPoints);
+                lasFile.pointSourceID=lasFile.pointSourceID(:,1:nPoints);
+            else
+                addPoints = nPoints-size(lasFile.pPoints,2);
+                lasFile.intensity=[lasFile.intensity zeros(1,addPoints,'uint16')];
+                lasFile.returnNumber=[lasFile.returnNumber zeros(1,addPoints,'uint8')];
+                lasFile.numberOfReturns=[lasFile.numberOfReturns zeros(1,addPoints,'uint8')];
+                lasFile.scanDirection=[lasFile.scanDirection false(1,addPoints)];
+                lasFile.edgeOfFlightLine=[lasFile.edgeOfFlightLine false(1,addPoints)];
+                lasFile.classification=[lasFile.classification zeros(1,addPoints,'uint8')];
+                lasFile.synthetic=[lasFile.synthetic false(1,addPoints)];
+                lasFile.keyPoint=[lasFile.keyPoint false(1,addPoints)];
+                lasFile.withheld=[lasFile.withheld false(1,addPoints)];
+                lasFile.scanAngleRank=[lasFile.scanAngleRank zeros(1,addPoints,'int8')];
+                lasFile.userData=[lasFile.userData zeros(1,addPoints,'uint8')];
+                lasFile.pointSourceID=[lasFile.pointSourceID zeros(1,addPoints,'uint16')];
+            end
+            
+            lasFile.pPoints = pointData;
+            
+            lasFile.publicHeader.nPoints = size(pointData,2);
+            lasFile.publicHeader.nPointsByReturn(1) = size(pointData,2);
+            maxX = max(pointData(1,:));
+            minX = min(pointData(1,:));
+            maxY = max(pointData(2,:));
+            minY = min(pointData(2,:));
+            maxZ = max(pointData(3,:));
+            minZ = min(pointData(3,:));
+            lasFile.publicHeader.maxX = maxX;
+            lasFile.publicHeader.minX = minX;
+            lasFile.publicHeader.maxY = maxY;
+            lasFile.publicHeader.minY = minY;
+            lasFile.publicHeader.maxZ = maxZ;
+            lasFile.publicHeader.minZ = minZ;
+            lasFile.publicHeader.xOffset = minX+0.5*(maxX-minX);
+            lasFile.publicHeader.yOffset = minY+0.5*(maxY-minY);
+            lasFile.publicHeader.zOffset = minZ+0.5*(maxZ-minZ);
+            lasFile.publicHeader.xScaleFactor = (maxX-minX)/...
+                double(intmax('uint32')-1);
+            lasFile.publicHeader.yScaleFactor = (maxY-minY)/...
+                double(intmax('uint32')-1);
+            lasFile.publicHeader.zScaleFactor = (maxZ-minZ)/...
+                double(intmax('uint32')-1);
+        end
+        
+        function lasFile = set.gpsTime(lasFile, timeData)
+            % Controlled interface for setting GPS time data on LasFile
+            % objects
+            
+            if (size(timeData,2) ~= lasFile.publicHeader.nPoints)
+                error('LasFile:DimensionMismatch',...
+                    'GPS Time Data must have an entry for each point');
+            end
+            
+            lasFile.pGpsTime = timeData;
+            
+            lasFile.publicHeader.pointDataFormatID = ...
+                bitor(lasFile.publicHeader.pointDataFormatID,1);
+            
+            if (lasFile.publicHeader.pointDataFormatID == 1)
+                lasFile.publicHeader.pointDataRecordLength = 28;
+            elseif (lasFile.publicHeader.pointDataFormatID == 3)
+                lasFile.publicHeader.pointDataRecordLength = 34;
+            end
+        end
+        
+        function lasFile = set.color(lasFile, colorData)
+            % Controlled interface for setting color data on LasFile
+            % objects.
+
+            if (~strcmp(class(colorData),'uint16'))
+                error('LasFile:DataTypeMismatch',...
+                    'Color data must be of type uint16');
+            end
+            
+            if (size(colorData,1) ~= 3)
+                error('LasFile:DimensionMismatch',...
+                    'Color data must have 3 coordinates');
+            end
+            
+            if (size(colorData,2) ~= lasFile.publicHeader.nPoints)
+                error('LasFile:DimensionMismatch',...
+                    'Color data must have an entry for each point');
+            end
+            
+            lasFile.pColor = colorData;
+            
+            lasFile.publicHeader.pointDataFormatID = ...
+                bitor(lasFile.publicHeader.pointDataFormatID,2);
+            
+            if (lasFile.publicHeader.pointDataFormatID == 2)
+                lasFile.publicHeader.pointDataRecordLength = 26;
+            elseif (lasFile.publicHeader.pointDataFormatID == 3)
+                lasFile.publicHeader.pointDataRecordLength = 34;
+            end
+        end
+
+        function lasFile = loadFrom(lasFile,location)
+            % Load the LAS file from the given location.
+            
+            if (ischar(location))
+                % Assume single argument is file name
+                [fid, msg]=fopen(location, 'r');
+                
+                if (fid < 0)
+                    error('LasFile:FileError',msg);
+                end
+            elseif (isnumeric(location))
+                % Assume single argument is file ID
+                fid = location;   
+            else
+                error('LasFile:InitError',...
+                    'Unknown argument initializer');
+            end
+            
+            % Parse the LAS Public Header Block
+            lasFile.publicHeader = LasPublicHeader(fid);
+            
+            % Parse the LAS Variable Length Record Headers
+            if (lasFile.publicHeader.nVLRs > 0)
+                lasFile.vlrs = LasVlr(fid);
+
+                for vlr=1:lasFile.publicHeader.nVLRs
+                    lasVlrFactory(lasFile.vlrs(vlr));
+                end
+            end
+
+            % Un-Pack data from uint8 for fast reading.
+            fseek(fid, lasFile.publicHeader.offsetToPointData, 'bof');
+            temp = reshape(fread(fid,...
+                double(lasFile.publicHeader.pointDataRecordLength)*...
+                lasFile.publicHeader.nPoints,...
+                'uint8=>uint8'),...
+                lasFile.publicHeader.pointDataRecordLength,...
+                lasFile.publicHeader.nPoints);
             fclose(fid);
-         end
-      end
-   end
+            
+            offsets = diag([...
+                lasFile.publicHeader.xOffset,...
+                lasFile.publicHeader.yOffset,...
+                lasFile.publicHeader.zOffset]);
+            
+            scales = diag([...
+                lasFile.publicHeader.xScaleFactor,...
+                lasFile.publicHeader.yScaleFactor,...
+                lasFile.publicHeader.zScaleFactor]);
+            
+            tempPoints = temp(1:12,:);
+            tempInt = temp(13:14,:);
+            tempPtInfo = temp(15,:);
+            tempPtClass = temp(16,:);
+            tempSARank = temp(17,:);
+            tempUData = temp(18,:);
+            tempSrcID = temp(19:20,:);
+            
+            lasFile.pPoints = double(...
+                reshape(typecast(tempPoints(:),'int32'),...
+                3,lasFile.publicHeader.nPoints));
+            
+            lasFile.pPoints = scales*lasFile.pPoints+...
+                offsets*ones(size(lasFile.pPoints));
+            
+            lasFile.intensity=reshape(typecast(tempInt(:),'uint16'),...
+                1,lasFile.publicHeader.nPoints);
+            
+            lasFile.returnNumber=bitand(tempPtInfo,7);
+            lasFile.numberOfReturns=bitand(bitshift(tempPtInfo,-3),7);
+            lasFile.scanDirection=logical(bitget(tempPtInfo,7));
+            lasFile.edgeOfFlightLine=logical(bitget(tempPtInfo,8));
+            
+            lasFile.withheld=logical(bitget(tempPtClass,8));
+            lasFile.keyPoint=logical(bitget(tempPtClass,7));
+            lasFile.synthetic=logical(bitget(tempPtClass,6));
+            lasFile.classification=bitand(tempPtClass,31);
+            
+            lasFile.scanAngleRank=reshape(typecast(tempSARank(:),...
+                'int8'),1,lasFile.publicHeader.nPoints);
+            
+            lasFile.userData=reshape(typecast(tempUData(:),'uint8'),...
+                1,lasFile.publicHeader.nPoints);
+            
+            lasFile.pointSourceID=reshape(typecast(tempSrcID(:),...
+                'uint16'),...
+                1,lasFile.publicHeader.nPoints);
+            
+            switch lasFile.publicHeader.pointDataFormatID
+                case 1
+                    tempGps = temp(21:28,:);
+                    
+                    lasFile.pGpsTime=reshape(typecast(tempGps(:),...
+                        'double'),...
+                        1,lasFile.publicHeader.nPoints);
+                case 2
+                    tempColor = temp(21:26,:);
+                    
+                    lasFile.pColor = reshape(...
+                        typecast(tempColor(:),'uint16'),...
+                        3,lasFile.publicHeader.nPoints);
+                case 3
+                    tempGps = temp(21:28,:);
+                    tempColor = temp(29:34,:);
+                    
+                    lasFile.pGpsTime=reshape(typecast(tempGps(:),...
+                        'double'),...
+                        1,lasFile.publicHeader.nPoints);
+                    
+                    lasFile.pColor = reshape(...
+                        typecast(tempColor(:),'uint16'),...
+                        3,lasFile.publicHeader.nPoints);
+            end
+
+            % Update offsets
+            lasFile.publicHeader.offsetToPointData =...
+                                           lasFile.publicHeader.headerSize;
+
+            for record=1:lasFile.publicHeader.nVLRs
+                lasFile.publicHeader.offsetToPointData = ...
+                    lasFile.publicHeader.offsetToPointData + 54 + ...
+                    lasFile.vlrs(record).recordLengthAfterHeader;
+            end
+        end
+        
+        function saveTo(lasFile,location)
+            % Save the LAS file to the given location.
+            
+            if (ischar(location))
+                % Assume single argument is file name
+                [fid, msg]=fopen(location, 'w');
+                
+                if (fid < 0)
+                    error('LasFile:FileError',msg);
+                end
+            elseif (isnumeric(location))
+                % Assume single argument is file ID
+                fid = location;
+                
+            else
+                error('LasFile:InitError',...
+                    'Unknown argument initializer');
+            end
+            
+            lasFile.publicHeader.saveTo(fid);
+            
+            for record=1:lasFile.publicHeader.nVLRs
+                lasFile.vlrs(record).saveTo(fid);
+            end
+
+            % Pack data to uint8 for fast writing.
+            offs=diag([...
+                lasFile.publicHeader.xOffset,...
+                lasFile.publicHeader.yOffset,...
+                lasFile.publicHeader.zOffset]);
+            
+            invSF=diag([...
+                1/lasFile.publicHeader.xScaleFactor,...
+                1/lasFile.publicHeader.yScaleFactor,...
+                1/lasFile.publicHeader.zScaleFactor]);
+
+            outPoints=int32(invSF*(lasFile.pPoints-...
+                offs*ones(size(lasFile.pPoints))));
+            
+            uintPoints = reshape(typecast(outPoints(:),'uint8'),...
+                12,lasFile.publicHeader.nPoints);
+
+            uintInt = reshape(typecast(lasFile.intensity(:),'uint8'),...
+                2,lasFile.publicHeader.nPoints);
+
+            ptInfo=bitand(lasFile.returnNumber,7);
+            ptInfo=bitor(bitshift(bitand(lasFile.numberOfReturns,7),3),ptInfo);
+            ptInfo=bitset(ptInfo,7,lasFile.scanDirection);
+            ptInfo=bitset(ptInfo,8,lasFile.edgeOfFlightLine);
+
+            ptClass=bitand(lasFile.classification,31);
+            ptClass=bitset(ptClass,6,lasFile.synthetic);
+            ptClass=bitset(ptClass,7,lasFile.keyPoint);
+            ptClass=bitset(ptClass,8,lasFile.withheld);
+
+            uintSA = reshape(typecast(lasFile.scanAngleRank(:),'uint8'),...
+                1,lasFile.publicHeader.nPoints);
+            
+            uintID = reshape(typecast(lasFile.pointSourceID(:),'uint8'),...
+                2,lasFile.publicHeader.nPoints);
+
+            switch lasFile.publicHeader.pointDataFormatID
+                case 0
+                    temp = [uintPoints;...
+                            uintInt;...
+                            ptInfo;...
+                            ptClass;...
+                            uintSA;...
+                            lasFile.userData;...
+                            uintID];
+                case 1
+                    uintGPS = reshape(typecast(lasFile.pGpsTime(:),'uint8'),...
+                        8,lasFile.publicHeader.nPoints);
+
+                    temp = [uintPoints;...
+                            uintInt;...
+                            ptInfo;...
+                            ptClass;...
+                            uintSA;...
+                            lasFile.userData;...
+                            uintID;...
+                            uintGPS];
+                case 2
+                    uintColor = reshape(typecast(lasFile.pColor(:),'uint8'),...
+                        6,lasFile.publicHeader.nPoints);
+                    
+                    temp = [uintPoints;...
+                            uintInt;...
+                            ptInfo;...
+                            ptClass;...
+                            uintSA;...
+                            lasFile.userData;...
+                            uintID;...
+                            uintColor];
+                case 3
+                    uintGPS = reshape(typecast(lasFile.pGpsTime(:),'uint8'),...
+                        8,lasFile.publicHeader.nPoints);
+                    
+                    uintColor = reshape(typecast(lasFile.pColor(:),'uint8'),...
+                        6,lasFile.publicHeader.nPoints);
+                    
+                    temp = [uintPoints;...
+                            uintInt;...
+                            ptInfo;...
+                            ptClass;...
+                            uintSA;...
+                            lasFile.userData;...
+                            uintID;...
+                            uintGPS;...
+                            uintColor];
+            end
+            
+            fseek(fid, lasFile.publicHeader.offsetToPointData, 'bof');
+            fwrite(fid,temp);
+
+            if (ischar(location))
+                % Close the file if it was opened  here.
+                fclose(fid);
+            end
+        end
+    end
 end
Index: Damkjer/Util/FileIO/LasFile/LasPublicHeader.m
===================================================================
--- Damkjer/Util/FileIO/LasFile/LasPublicHeader.m	(revision 15)
+++ Damkjer/Util/FileIO/LasFile/LasPublicHeader.m	(revision 0)
@@ -1,681 +1,580 @@
-% LasPublicHeader   ASPRS LAS format public header block
+%  LasPublicHeader
 %
-% File:
-%    LasPublicHeader.m
+%  File:  LasPublicHeader.m
 %
-% Description:
-%    This MATLAB class represents an ASPRS LAS version 1.2 file public header
-%    block.
+%  Description: This MATLAB class represents an ASPRS LAS version 1.2
+%               file public header block.
 %
-% Limitations:
-%    None.
+%  Software History:
+%     2012-AUG-29   K. Damkjer
+%        Initial Coding.
 %
-% Properties:
-%    fileSignature          - The File Signature
-%    fileSourceID           - The File Source ID
-%    globalEncoding         - The File Global Encoding
-%    projectID_GUID1        - The Globally Unique (Project) Identifier - Part 1
-%    projectID_GUID2        - The Globally Unique (Project) Identifier - Part 2
-%    projectID_GUID3        - The Globally Unique (Project) Identifier - Part 3
-%    projectID_GUID4        - The Globally Unique (Project) Identifier - Part 4
-%    systemIdentifier       - The System Identifier
-%    generatingSoftware     - The Generating Software
-%    headerSize             - The Header Size in Bytes
-%    offsetToPointData      - The Offset to Point Data
-%    nVLRs                  - The Number of Variable Length Records
-%    pointDataFormatID      - The Point Data Format ID
-%    pointDataRecordLength  - The Point Data Record Length
-%    nPoints                - The Number of Point Records
-%    nPointsByReturn        - The Number of Point Records by Return
-%    xScaleFactor           - The X Coordinate Scale Factor
-%    yScaleFactor           - The Y Coordinate Scale Factor
-%    zScaleFactor           - The Z Coordinate Scale Factor
-%    xOffset                - The X Coordinate Offset
-%    yOffset                - The Y Coordinate Offset
-%    zOffset                - The Z Coordinate Offset
-%    maxX                   - The Maximum X Coordinate
-%    minX                   - The Minimum X Coordinate
-%    maxY                   - The Maximum Y Coordinate
-%    minY                   - The Minimum Y Coordinate
-%    maxZ                   - The Maximum Z Coordinate
-%    minZ                   - The Minimum Z Coordinate
-%    extraData              - The Extra Data
-%    fileCreationDate       - The File Creation Date
-%    fileCreationDayOfYear  - The File Creation Day of Year
-%    fileCreationYear       - The File Creation Year
-%    version                - The Version Number
-%
-% Methods:
-%    [header] = LasPublicHeader(varargin)  - Constructor for LasPublicHeader
-%                                            objects.
-%    [header] = loadFrom(location)         - Load LAS file public header block
-%                                            from a given location.
-%               saveTo(location)           - Save LAS file public header block
-%                                            to a given location.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    http://asprs.org/a/society/committees/standards/asprs_las_format_v12.pdf
-%
-% See Also:
-%    LasFile
-%
-
-% Software History:
-%    2012-AUG-29   K. Damkjer
-%       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
-%
-
-%******************************************************************************
-% CLASS: LasPublicHeader
-%    An ASPRS LAS version 1.2 file public header block.
-%******************************************************************************
+
 classdef (Sealed = true) LasPublicHeader
-   properties (Constant)
-      % The File Signature
-      %
-      % The file signature must contain the four characters "LASF", and
-      % it is required by the LAS specification. These four characters
-      % can be checked by user software as a quick look initial
-      % determination of file type.
-      fileSignature         = 'LASF'
-   end
-   
-   properties
-      % The File Source ID
-      %
-      % This field should be set to a value between 1 and 65535,
-      % inclusive. A value of zero (0) is interpreted to mean that an ID
-      % has not been assigned. In this case, processing software is free
-      % to assign any valid number. Note that this scheme allows a LIDAR
-      % project to contain up to 65535 unique sources. A source can be
-      % considered an original flight line or it can be the result of
-      % merge and/or extract operations.
-      fileSourceID          = uint16(0)
-      
-      % The File Global Encoding
-      %
-      % This is a bit field used to indicate certain global properties
-      % about the file. In LAS 1.2 (the version in which this field is
-      % introduced), only the low bit is defined (this is the bit, that
-      % if set, would have the unsigned integer yield a value of 1). This
-      % bit field is defined as:
-      %
-      %   Bits | Field Name    | Description
-      %   -----|---------------|-----------------------------------------------
-      %   0    | GPS Time Type | The meaning of GPS Time in the Point Records
-      %   1:15 | Reserved      | Must be set to zero.
-      %
-      % The GPS Time Type bit carries the following interpretations:
-      %
-      %   Value       | Description
-      %   ------------|--------------------------------------------------------
-      %   0 (not set) | GPS Week Time (the same as previous versions of LAS)
-      %   1 (set)     | Standard GPS Time (satellite GPS Time) minus 1e9.*
-      %   * The offset moves the time back to near zero to improve floating
-      %     point resolution.
-      globalEncoding        = uint16(0)
-      
-      % The Globally Unique (Project) Identifier - Part 1
-      %
-      % The four fields that comprise a complete Globally Unique
-      % Identifier (GUID) are now reserved for use as a Project
-      % Identifier (Project ID). The field remains optional. The time of
-      % assignment of the Project ID is at the discretion of processing
-      % software. The Project ID should be the same for all files that
-      % are associated with a unique project. By assigning a Project ID
-      % and using a File Source ID (defined above) every file within a
-      % project and every point within a file can be uniquely identified,
-      % globally.
-      projectID_GUID1       = uint32(0)
-      
-      % The Globally Unique (Project) Identifier - Part 2
-      %
-      % The four fields that comprise a complete Globally Unique
-      % Identifier (GUID) are now reserved for use as a Project
-      % Identifier (Project ID). The field remains optional. The time of
-      % assignment of the Project ID is at the discretion of processing
-      % software. The Project ID should be the same for all files that
-      % are associated with a unique project. By assigning a Project ID
-      % and using a File Source ID (defined above) every file within a
-      % project and every point within a file can be uniquely identified,
-      % globally.
-      projectID_GUID2       = uint16(0)
-      
-      % The Globally Unique (Project) Identifier - Part 3
-      %
-      % The four fields that comprise a complete Globally Unique
-      % Identifier (GUID) are now reserved for use as a Project
-      % Identifier (Project ID). The field remains optional. The time of
-      % assignment of the Project ID is at the discretion of processing
-      % software. The Project ID should be the same for all files that
-      % are associated with a unique project. By assigning a Project ID
-      % and using a File Source ID (defined above) every file within a
-      % project and every point within a file can be uniquely identified,
-      % globally.
-      projectID_GUID3       = uint16(0)
-      
-      % The Globally Unique (Project) Identifier - Part 4
-      %
-      % The four fields that comprise a complete Globally Unique
-      % Identifier (GUID) are now reserved for use as a Project
-      % Identifier (Project ID). The field remains optional. The time of
-      % assignment of the Project ID is at the discretion of processing
-      % software. The Project ID should be the same for all files that
-      % are associated with a unique project. By assigning a Project ID
-      % and using a File Source ID (defined above) every file within a
-      % project and every point within a file can be uniquely identified,
-      % globally.
-      projectID_GUID4       = ''
-      
-      % The System Identifier
-      %
-      % The version 1.0 specification assumes that LAS files are
-      % exclusively generated as a result of collection by a hardware
-      % sensor. Version 1.1 recognizes that files often result from
-      % extraction, merging or modifying existing data files. Thus System
-      % ID becomes:
-      %
-      %   Generating Agent                       | System ID
-      %   ---------------------------------------|-----------------------
-      %   Hardware System                        | String identifying hardware (e.g., "ALTM 1210" or "ALS50")
-      %   Merge of one or more files             | "MERGE"
-      %   Modification of a single file          | "MODIFICATION"
-      %   Extraction from one or more files      | "EXTRACTION"
-      %   Reprojection, rescaling, warping, etc. | "TRANSFORMATION"
-      %   Some other operation                   | "OTHER" or a string up to 32 characters identifying the operation
-      systemIdentifier      = 'OTHER'
-      
-      % The Generating Software
-      %
-      % This information is ASCII data describing the generating software
-      % itself. This field provides a mechanism for specifying which
-      % generating software package and version was used during LAS file
-      % creation (e.g. "TerraScan V-10.8", "REALM V-4.2" and etc.). If
-      % the character data is less than 32 characters, the remaining data
-      % must be null.
-      generatingSoftware    = ['MATLAB ' version]
-      
-      % The Header Size
-      %
-      % The size, in bytes, of the Public Header Block itself. In the
-      % event that the header is extended by a software application
-      % through the addition of data at the end of the header, the Header
-      % Size field must be updated with the new header size. Extension of
-      % the Public Header Block is discouraged; the Variable Length
-      % Records should be used whenever possible to add custom header
-      % data. In the event a generating software package adds data to the
-      % Public Header Block, this data must be placed at the end of the
-      % structure and the Header Size must be updated to reflect the new
-      % size.
-      headerSize            = uint16(227)
-      
-      % The Offset to Point Data
-      %
-      % The actual number of bytes from the beginning of the file to the
-      % first field of the first point record data field. This data
-      % offset must be updated if any software adds data from the Public
-      % Header Block or adds/removes data to/from the Variable Length
-      % Records.
-      offsetToPointData     = uint32(227)
-      
-      % The Number of Variable Length Records
-      % This field contains the current number of Variable Length
-      % Records. This number must be updated if the number of Variable
-      % Length Records changes at any time.
-      nVLRs                 = uint32(0)
-      
-      % The Point Data Format ID
-      %
-      % The point data format ID corresponds to the point data record
-      % format type. LAS 1.2 defines types 0, 1, 2 and 3.
-      pointDataFormatID     = uint8(0)
-      
-      % The Point Data Record Length
-      %
-      % The size, in bytes, of the Point Data Record.
-      pointDataRecordLength = uint16(20)
-      
-      % The Number of Point Records
-      %
-      % This field contains the total number of point records within the
-      % file.
-      nPoints               = uint32(0)
-      
-      % The Number of Points by Return
-      %
-      % This field contains an array of the total point records per
-      % return. The first unsigned long value will be the total number of
-      % records from the first return, and the second contains the total
-      % number for return two, and so forth up to five returns.
-      nPointsByReturn       = zeros(5, 1, 'uint32')
-      
-      % The X Coordinate Scale Factor
-      %
-      % The scale factor fields contain a double floating point value
-      % that is used to scale the corresponding X, Y, and Z long values
-      % within the point records. The corresponding X, Y, and Z scale
-      % factor must be multiplied by the X, Y, or Z point record value to
-      % get the actual X, Y, or Z coordinate. For example, if the X, Y,
-      % and Z coordinates are intended to have two decimal point values,
-      % then each scale factor will contain the number 0.01.
-      xScaleFactor          = double(0)
-      
-      % The Y Coordinate Scale Factor
-      %
-      % The scale factor fields contain a double floating point value
-      % that is used to scale the corresponding X, Y, and Z long values
-      % within the point records. The corresponding X, Y, and Z scale
-      % factor must be multiplied by the X, Y, or Z point record value to
-      % get the actual X, Y, or Z coordinate. For example, if the X, Y,
-      % and Z coordinates are intended to have two decimal point values,
-      % then each scale factor will contain the number 0.01.
-      yScaleFactor          = double(0)
-      
-      % The Z Coordinate Scale Factor
-      %
-      % The scale factor fields contain a double floating point value
-      % that is used to scale the corresponding X, Y, and Z long values
-      % within the point records. The corresponding X, Y, and Z scale
-      % factor must be multiplied by the X, Y, or Z point record value to
-      % get the actual X, Y, or Z coordinate. For example, if the X, Y,
-      % and Z coordinates are intended to have two decimal point values,
-      % then each scale factor will contain the number 0.01.
-      zScaleFactor          = double(0)
-      
-      % The X Coordinate Offset
-      %
-      % The offset fields should be used to set the overall offset for
-      % the point records. In general these numbers will be zero, but for
-      % certain cases the resolution of the point data may not be large
-      % enough for a given projection system. However, it should always
-      % be assumed that these numbers are used. So to scale a given X
-      % from the point record, take the point record X multiplied by the
-      % X scale factor, and then add the X offset.
-      %
-      % X_coordinate = (X_record * X_scale) + X_offset
-      xOffset               = double(0)
-      
-      % The Y Coordinate Offset
-      %
-      % The offset fields should be used to set the overall offset for
-      % the point records. In general these numbers will be zero, but for
-      % certain cases the resolution of the point data may not be large
-      % enough for a given projection system. However, it should always
-      % be assumed that these numbers are used. So to scale a given Y
-      % from the point record, take the point record Y multiplied by the
-      % Y scale factor, and then add the Y offset.
-      %
-      % Y_coordinate = (Y_record * Y_scale) + Y_offset
-      yOffset               = double(0)
-      
-      % The Z Coordinate Offset
-      %
-      % The offset fields should be used to set the overall offset for
-      % the point records. In general these numbers will be zero, but for
-      % certain cases the resolution of the point data may not be large
-      % enough for a given projection system. However, it should always
-      % be assumed that these numbers are used. So to scale a given Z
-      % from the point record, take the point record Z multiplied by the
-      % Z scale factor, and then add the Z offset.
-      %
-      % Z_coordinate = (Z_record * Z_scale) + Z_offset
-      zOffset               = double(0)
-      
-      % The Maximum X Coordinate
-      %
-      % The max and min data fields are the actual unscaled extents of
-      % the LAS point file data, specified in the coordinate system of
-      % the LAS data.
-      maxX                  = double(0)
-      
-      % The Minimum X Coordinate
-      %
-      % The max and min data fields are the actual unscaled extents of
-      % the LAS point file data, specified in the coordinate system of
-      % the LAS data.
-      minX                  = double(0)
-      
-      % The Maximum Y Coordinate
-      %
-      % The max and min data fields are the actual unscaled extents of
-      % the LAS point file data, specified in the coordinate system of
-      % the LAS data.
-      maxY                  = double(0)
-      
-      % The Minimum Y Coordinate
-      %
-      % The max and min data fields are the actual unscaled extents of
-      % the LAS point file data, specified in the coordinate system of
-      % the LAS data.
-      minY                  = double(0)
-      
-      % The Maximum Z Coordinate
-      %
-      % The max and min data fields are the actual unscaled extents of
-      % the LAS point file data, specified in the coordinate system of
-      % the LAS data.
-      maxZ                  = double(0)
-      
-      % The Minimum Z Coordinate
-      %
-      % The max and min data fields are the actual unscaled extents of
-      % the LAS point file data, specified in the coordinate system of
-      % the LAS data.
-      minZ                  = double(0)
-      
-      % The Extra Data
-      %
-      % The public header may be extended, though it is highly
-      % discouraged. If it is extended, we have no way of knowing how to
-      % interpret the extra data. We can simply pass it through, though.
-      extraData = zeros(0,'uint8');
-   end
-   
-   properties (Access = private)
-      % The File Creation Date
-      %
-      % The date on which the file was created expressed as a serial date
-      % number.
-      pFileCreationDate
-      
-      % The Major Version Number
-      %
-      % The version number consists of a major and minor field. The major
-      % and minor fields combine to form the number that indicates the
-      % format number of the current specification itself. For example,
-      % specification number 1.2 (this version) would contain 1 in the
-      % major field and 2 in the minor field.
-      pVersionMajor          = uint8(1)
-      
-      % The Minor Version Number
-      %
-      % The version number consists of a major and minor field. The major
-      % and minor fields combine to form the number that indicates the
-      % format number of the current specification itself. For example,
-      % specification number 1.2 (this version) would contain 1 in the
-      % major field and 2 in the minor field.
-      pVersionMinor          = uint8(2)
-   end
-   
-   properties (Dependent, SetAccess = private)
-      % The File Creation Date
-      %
-      % The date on which the file was created expressed as a date
-      % string.
-      fileCreationDate
-      
-      % The File Creation Day of Year
-      %
-      % The day, expressed as an unsigned short, on which this file was
-      % created. Day is computed as the Greenwhich Mean Time (GMT) day.
-      % January 1 is considered day 1.
-      fileCreationDayOfYear
-      
-      % The File Creation Year
-      %
-      % The year, expressed as a four digit number, in which the file was
-      % created.
-      fileCreationYear
-      
-      % The Version Number
-      %
-      % The version number consists of a major and minor field. The major
-      % and minor fields combine to form the number that indicates the
-      % format number of the current specification itself. For example,
-      % specification number 1.2 (this version) would contain 1 in the
-      % major field and 2 in the minor field.
-      version
-   end
-   
-   methods
-      %************************************************************************
-      % LasPublicHeader/LasPublicHeader
-      %************************************************************************
-      function header = LasPublicHeader(varargin)
-         % Constructor for LasFile public header block objects
-         %
-         % LasPublicHeader objects may be constructed either by using a
-         % no-argument (default) constructor or by passing a file
-         % descriptor or file name.
-         switch (nargin)
-            case 0
-               header.pFileCreationDate = floor(datenum(1970,1,1)+...
-                  java.lang.System.currentTimeMillis/...
-                  (1e3*86400));
-            case 1
-               header = header.loadFrom(varargin{1});
-            otherwise
-               error('LasPublicHeader:UnexpectedInputs',...
-                     'Unexpected number of inputs encountered.');
-         end
-      end
-      
-      %************************************************************************
-      % LasPublicHeader/get.fileCreationDate
-      %************************************************************************
-      function theDate = get.fileCreationDate(header)
-         % The File Creation Date
-         %
-         % The date on which the file was created expressed as a date
-         % string.
-         theDate = datestr(header.pFileCreationDate);
-      end
-      
-      %************************************************************************
-      % LasPublicHeader/get.fileCreationDayOfYear
-      %************************************************************************
-      function theDOY = get.fileCreationDayOfYear(header)
-         % The File Creation Day of Year
-         %
-         % The day, expressed as an unsigned short, on which this file was
-         % created. Day is computed as the Greenwhich Mean Time (GMT) day.
-         % January 1 is considered day 1.
-         theDOY = header.pFileCreationDate-...
-                  datenum(...
-                     str2double(...
-                        datestr(header.pFileCreationDate,'yyyy')),1,1)+1;
-      end
-      
-      %************************************************************************
-      % LasPublicHeader/get.fileCreationYear
-      %************************************************************************
-      function theYear = get.fileCreationYear(header)
-         % The File Creation Year
-         %
-         % The year, expressed as a four digit number, in which the file was
-         % created.
-         theYear = uint16(...
-                      str2double(...
-                         datestr(header.pFileCreationDate,'yyyy')));
-      end
-      
-      %************************************************************************
-      % LasPublicHeader/get.version
-      %************************************************************************
-      function theVersion = get.version(header)
-         % The Version Number
-         %
-         % The version number consists of a major and minor field. The major
-         % and minor fields combine to form the number that indicates the
-         % format number of the current specification itself. For example,
-         % specification number 1.2 (this version) would contain 1 in the
-         % major field and 2 in the minor field.
-         theVersion = [num2str(header.pVersionMajor) '.'...
-                       num2str(header.pVersionMinor)];
-      end
-      
-      %************************************************************************
-      % LasPublicHeader/loadFrom
-      %************************************************************************
-      function header = loadFrom(header, location)
-         % Load the LAS file public header from the given location.
-         
-         if (ischar(location))
-            % Assume single argument is file name
-            [fid, msg]=fopen(location, 'r');
+    properties (SetAccess = private)
+        % The File Signature
+        % The file signature must contain the four characters "LASF", and
+        % it is required by the LAS specification. These four characters
+        % can be checked by user software as a quick look initial
+        % determination of file type.
+        fileSignature         = 'LASF'
+    end
+    
+    properties
+        % The File Source ID
+        % 
+        % This field should be set to a value between 1 and 65535,
+        % inclusive. A value of zero (0) is interpreted to mean that an ID
+        % has not been assigned. In this case, processing software is free
+        % to assign any valid number. Note that this scheme allows a LIDAR
+        % project to contain up to 65535 unique sources. A source can be
+        % considered an original flight line or it can be the result of
+        % merge and/or extract operations.
+        fileSourceID          = uint16(0)
+        
+        % The File Global Encoding
+        %
+        % This is a bit field used to indicate certain global properties
+        % about the file. In LAS 1.2 (the version in which this field is
+        % introduced), only the low bit is defined (this is the bit, that
+        % if set, would have the unsigned integer yield a value of 1). This
+        % bit field is defined as:
+        %
+        %   Bits | Field Name    | Description
+        %   -----+---------------+-----------------------------------------
+        %   0    | GPS Time Type | The meaning of GPS Time in the Point
+        %        |               | Records
+        %        |               | 0(not set) -> GPS Time in the point
+        %        |               | record fields is GPS Week Time (the same
+        %        |               | as previous versions of LAS)
+        %        |               | 1 (set) -> GPS Time is standard GPS Time
+        %        |               | (satellite GPS Time) minus 1 x 10^9. The
+        %        |               | offset moves the time back to near zero
+        %        |               | to improve floating point resolution.
+        %   -----+---------------+-----------------------------------------
+        %   1:15 | Reserved      | Must be set to zero.
+        globalEncoding        = uint16(0)
+        
+        % The Globally Unique (Project) Identifier - Part 1
+        %
+        % The four fields that comprise a complete Globally Unique
+        % Identifier (GUID) are now reserved for use as a Project
+        % Identifier (Project ID). The field remains optional. The time of
+        % assignment of the Project ID is at the discretion of processing
+        % software. The Project ID should be the same for all files that
+        % are associated with a unique project. By assigning a Project ID
+        % and using a File Source ID (defined above) every file within a
+        % project and every point within a file can be uniquely identified,
+        % globally.
+        projectID_GUID1       = uint32(0)
+        
+        % The Globally Unique (Project) Identifier - Part 2
+        %
+        % The four fields that comprise a complete Globally Unique
+        % Identifier (GUID) are now reserved for use as a Project
+        % Identifier (Project ID). The field remains optional. The time of
+        % assignment of the Project ID is at the discretion of processing
+        % software. The Project ID should be the same for all files that
+        % are associated with a unique project. By assigning a Project ID
+        % and using a File Source ID (defined above) every file within a
+        % project and every point within a file can be uniquely identified,
+        % globally.
+        projectID_GUID2       = uint16(0)
+        
+        % The Globally Unique (Project) Identifier - Part 3
+        %
+        % The four fields that comprise a complete Globally Unique
+        % Identifier (GUID) are now reserved for use as a Project
+        % Identifier (Project ID). The field remains optional. The time of
+        % assignment of the Project ID is at the discretion of processing
+        % software. The Project ID should be the same for all files that
+        % are associated with a unique project. By assigning a Project ID
+        % and using a File Source ID (defined above) every file within a
+        % project and every point within a file can be uniquely identified,
+        % globally.
+        projectID_GUID3       = uint16(0)
+        
+        % The Globally Unique (Project) Identifier - Part 4
+        %
+        % The four fields that comprise a complete Globally Unique
+        % Identifier (GUID) are now reserved for use as a Project
+        % Identifier (Project ID). The field remains optional. The time of
+        % assignment of the Project ID is at the discretion of processing
+        % software. The Project ID should be the same for all files that
+        % are associated with a unique project. By assigning a Project ID
+        % and using a File Source ID (defined above) every file within a
+        % project and every point within a file can be uniquely identified,
+        % globally.
+        projectID_GUID4       = ''
+        
+        % The System Identifier
+        %
+        % The version 1.0 specification assumes that LAS files are
+        % exclusively generated as a result of collection by a hardware
+        % sensor. Version 1.1 recognizes that files often result from
+        % extraction, merging or modifying existing data files. Thus System
+        % ID becomes:
+        %
+        %   Generating Agent                       | System ID
+        %   ---------------------------------------+-----------------------
+        %   Hardware System                        | String identifying
+        %                                          | hardware (e.g. "ALTM
+        %                                          | 1210" or "ALS50"
+        %   ---------------------------------------+-----------------------
+        %   Merge of one or more files             | "MERGE"
+        %   ---------------------------------------+-----------------------
+        %   Modification of a single file          | "MODIFICATION"
+        %   ---------------------------------------+-----------------------
+        %   Extraction from one or more files      | "EXTRACTION"
+        %   ---------------------------------------+-----------------------
+        %   Reprojection, rescaling, warping, etc. | "TRANSFORMATION"
+        %   ---------------------------------------+-----------------------
+        %   Some other operation                   | "OTHER" or a string up
+        %                                          | to 32 characters
+        %                                          | identifying the
+        %                                          | operation
+        systemIdentifier      = 'OTHER'
+        
+        % The Generating Software
+        %
+        % This information is ASCII data describing the generating software
+        % itself. This field provides a mechanism for specifying which
+        % generating software package and version was used during LAS file
+        % creation (e.g. "TerraScan V-10.8", "REALM V-4.2" and etc.). If
+        % the character data is less than 32 characters, the remaining data
+        % must be null.
+        generatingSoftware    = ['MATLAB ' version]
+        
+        % The Header Size
+        %
+        % The size, in bytes, of the Public Header Block itself. In the
+        % event that the header is extended by a software application
+        % through the addition of data at the end of the header, the Header
+        % Size field must be updated with the new header size. Extension of
+        % the Public Header Block is discouraged; the Variable Length
+        % Records should be used whenever possible to add custom header
+        % data. In the event a generating software package adds data to the
+        % Public Header Block, this data must be placed at the end of the
+        % structure and the Header Size must be updated to reflect the new
+        % size.
+        headerSize            = uint16(227)
+        
+        % The Offset to Point Data
+        %
+        % The actual number of bytes from the beginning of the file to the
+        % first field of the first point record data field. This data
+        % offset must be updated if any software adds data from the Public
+        % Header Block or adds/removes data to/from the Variable Length
+        % Records.
+        offsetToPointData     = uint32(227)
+        
+        % The Number of Variable Length Records
+        % This field contains the current number of Variable Length
+        % Records. This number must be updated if the number of Variable
+        % Length Records changes at any time.
+        nVLRs                 = uint32(0)
+        
+        % The Point Data Format ID
+        %
+        % The point data format ID corresponds to the point data record
+        % format type. LAS 1.2 defines types 0, 1, 2 and 3.
+        pointDataFormatID     = uint8(0)
+        
+        % The Point Data Record Length
+        %
+        % The size, in bytes, of the Point Data Record.
+        pointDataRecordLength = uint16(20)
+        
+        % The Number of Point Records
+        %
+        % This field contains the total number of point records within the
+        % file.
+        nPoints               = uint32(0)
+        
+        % The Number of Points by Return
+        % This field contains an array of the total point records per
+        % return. The first unsigned long value will be the total number of
+        % records from the first return, and the second contains the total
+        % number for return two, and so forth up to five returns.
+        nPointsByReturn       = zeros(5, 1, 'uint32')
+        
+        % The X Coordinate Scale Factor
+        %
+        % The scale factor fields contain a double floating point value
+        % that is uysed to scale the corresponding X, Y, and Z long values
+        % within the point records. The corresponding X, Y, and Z scale
+        % factor must be multiplied by the X, Y, or Z point record value to
+        % get the actual X, Y, or Z coordinate. For example, if the X, Y,
+        % and Z coordinates are intended to have two decimal point values,
+        % then each scale factor will contain the number 0.01.
+        xScaleFactor          = double(0)
+
+        % The Y Coordinate Scale Factor
+        %
+        % The scale factor fields contain a double floating point value
+        % that is uysed to scale the corresponding X, Y, and Z long values
+        % within the point records. The corresponding X, Y, and Z scale
+        % factor must be multiplied by the X, Y, or Z point record value to
+        % get the actual X, Y, or Z coordinate. For example, if the X, Y,
+        % and Z coordinates are intended to have two decimal point values,
+        % then each scale factor will contain the number 0.01.
+        yScaleFactor          = double(0)
+
+        % The Z Coordinate Scale Factor
+        %
+        % The scale factor fields contain a double floating point value
+        % that is uysed to scale the corresponding X, Y, and Z long values
+        % within the point records. The corresponding X, Y, and Z scale
+        % factor must be multiplied by the X, Y, or Z point record value to
+        % get the actual X, Y, or Z coordinate. For example, if the X, Y,
+        % and Z coordinates are intended to have two decimal point values,
+        % then each scale factor will contain the number 0.01.
+        zScaleFactor          = double(0)
+        
+        % The X Coordinate Offset
+        %
+        % The offset fields should be used to set the overall offset for
+        % the point records. In general these numbers will be zero, but for
+        % certain cases the resolution of the point data may not be large
+        % enough for a given projection system. However, it should always
+        % be assumed that these numbers are used. So to scale a given X
+        % from the point record, take the point record X multiplied by the
+        % X scale factor, and then add the X offset.
+        %
+        % X_coordinate = (X_record * X_scale) + X_offset
+        % Y_coordinate = (Y_record * Y_scale) + Y_offset
+        % Z_coordinate = (Z_record * Z_scale) + Z_offset
+        xOffset               = double(0)
+        
+        % The Y Coordinate Offset
+        %
+        % The offset fields should be used to set the overall offset for
+        % the point records. In general these numbers will be zero, but for
+        % certain cases the resolution of the point data may not be large
+        % enough for a given projection system. However, it should always
+        % be assumed that these numbers are used. So to scale a given X
+        % from the point record, take the point record X multiplied by the
+        % X scale factor, and then add the X offset.
+        %
+        % X_coordinate = (X_record * X_scale) + X_offset
+        % Y_coordinate = (Y_record * Y_scale) + Y_offset
+        % Z_coordinate = (Z_record * Z_scale) + Z_offset
+        yOffset               = double(0)
+        
+        % The Z Coordinate Offset
+        %
+        % The offset fields should be used to set the overall offset for
+        % the point records. In general these numbers will be zero, but for
+        % certain cases the resolution of the point data may not be large
+        % enough for a given projection system. However, it should always
+        % be assumed that these numbers are used. So to scale a given X
+        % from the point record, take the point record X multiplied by the
+        % X scale factor, and then add the X offset.
+        %
+        % X_coordinate = (X_record * X_scale) + X_offset
+        % Y_coordinate = (Y_record * Y_scale) + Y_offset
+        % Z_coordinate = (Z_record * Z_scale) + Z_offset
+        zOffset               = double(0)
+        
+        % The Maximum X Coordinate
+        %
+        % The max and min data fields are the actual unscaled extents of
+        % the LAS point file data, specified in the coordinate system of
+        % the LAS data.
+        maxX                  = double(0)
+        
+        % The Minimum X Coordinate
+        %
+        % The max and min data fields are the actual unscaled extents of
+        % the LAS point file data, specified in the coordinate system of
+        % the LAS data.
+        minX                  = double(0)
+        
+        % The Maximum Y Coordinate
+        %
+        % The max and min data fields are the actual unscaled extents of
+        % the LAS point file data, specified in the coordinate system of
+        % the LAS data.
+        maxY                  = double(0)
+        
+        % The Minimum Y Coordinate
+        %
+        % The max and min data fields are the actual unscaled extents of
+        % the LAS point file data, specified in the coordinate system of
+        % the LAS data.
+        minY                  = double(0)
+        
+        % The Maximum Z Coordinate
+        %
+        % The max and min data fields are the actual unscaled extents of
+        % the LAS point file data, specified in the coordinate system of
+        % the LAS data.
+        maxZ                  = double(0)
+        
+        % The Minimum Z Coordinate
+        %
+        % The max and min data fields are the actual unscaled extents of
+        % the LAS point file data, specified in the coordinate system of
+        % the LAS data.
+        minZ                  = double(0)
+
+        % The Extra Data
+        %
+        % The public header may be extended, though it is highly
+        % discouraged. If it is extended, we have no way of knowing how to
+        % interpret the extra data. We can simply pass it through, though.
+        extraData = zeros(0,'uint8');
+    end
+    
+    properties (Access = private)
+        % The File Creation Date
+        %
+        % The date on which the file was created expressed as a serial date
+        % number.
+        pFileCreationDate
+
+        % The Major Version Number
+        %
+        % The version number consists of a major and minor field. The major
+        % and minor fields combine to form the number that indicates the
+        % format number of the current specification itself. For example,
+        % specification number 1.2 (this version) would contain 1 in the
+        % major field and 2 in the minor field.
+        pVersionMajor          = uint8(1)
+
+        % The Minor Version Number
+        %
+        % The version number consists of a major and minor field. The major
+        % and minor fields combine to form the number that indicates the
+        % format number of the current specification itself. For example,
+        % specification number 1.2 (this version) would contain 1 in the
+        % major field and 2 in the minor field.
+        pVersionMinor          = uint8(2)
+    end
+    
+    properties (Dependent)
+        % The File Creation Date
+        %
+        % The date on which the file was created expressed as a date
+        % string.
+        fileCreationDate
+        
+        % The File Creation Day of Year
+        % 
+        % The day, expressed as an unsigned short, on which this file was
+        % created. Day is computed as the Greenwhich Mean Time (GMT) day.
+        % January 1 is considered day 1.
+        fileCreationDayOfYear
+        
+        % The File Creation Year
+        %
+        % The year, expressed as a four digit number, in which the file was
+        % created.
+        fileCreationYear
+        
+        % The Version Number
+        %
+        % The version number consists of a major and minor field. The major
+        % and minor fields combine to form the number that indicates the
+        % format number of the current specification itself. For example,
+        % specification number 1.2 (this version) would contain 1 in the
+        % major field and 2 in the minor field.
+        version
+    end
+    
+    methods
+        function header = LasPublicHeader(varargin)
+            % Constructor for LasFile public header block objects
+            %
+            % LasPublicHeader objects may be constructed either by using a
+            % no-argument (default) constructor or by passing a file
+            % descriptor or file name.
+            switch (nargin)
+                case 0
+                    header.pFileCreationDate = floor(datenum(1970,1,1)+...
+                        java.lang.System.currentTimeMillis/...
+                        (1e3*86400));
+                case 1
+                    header = header.loadFrom(varargin{1});
+                otherwise
+                    error('LasPublicHeader:UnexpectedInputs',...
+                        'Unexpected number of inputs encountered.');
+            end
+        end
+        
+        function theDate = get.fileCreationDate(header)
+            theDate = datestr(header.pFileCreationDate);
+        end
+        
+        function theDOY = get.fileCreationDayOfYear(header)
+            theDOY = header.pFileCreationDate-...
+                datenum(...
+                str2double(...
+                datestr(header.pFileCreationDate,'yyyy')),...
+                1,1)+1;
+        end
+        
+        function theYear = get.fileCreationYear(header)
+            theYear = uint16(...
+                str2double(...
+                datestr(header.pFileCreationDate,'yyyy')));
+        end
+        
+        function theVersion = get.version(header)
+            theVersion = [num2str(header.pVersionMajor) '.'...
+                num2str(header.pVersionMinor)];
+        end
+        
+        function header = loadFrom(header, location)
+            % Load the LAS file public header from the given location.
+
+            if (ischar(location))
+                % Assume single argument is file name
+                [fid, msg]=fopen(location, 'r');
+                
+                if (fid < 0)
+                    error('LasPublicHeader:FileError',msg);
+                end
+            elseif (isnumeric(location))
+                % Assume single argument is file ID
+                fid = location;
+                frewind(fid);
+            else
+                error('LasPublicHeader:InitError',...
+                    'Unknown argument initializer');
+            end
             
-            if (fid < 0)
-               error('LasPublicHeader:FileError',msg);
-            end
-         elseif (isnumeric(location))
-            % Assume single argument is file ID
-            fid = location;
-            frewind(fid);
-         else
-            error('LasPublicHeader:InitError',...
-                  'Unknown argument initializer');
-         end
-         
-         % Check the file signature to make sure we have a LAS file
-         if (~strcmp(sscanf(char(fread(fid,4,'uchar=>uchar')'),'%c'),...
-                     header.fileSignature))
-            error('LasPublicHeader:InvalidFile',...
-                  'File does not appear to be a valid LAS file.');
-         end
-         
-         header.fileSourceID = fread(fid,1,'uint16=>uint16');
-         header.globalEncoding = fread(fid,1,'uint16=>uint16');
-         header.projectID_GUID1 = fread(fid,1,'uint32=>uint32');
-         header.projectID_GUID2 = fread(fid,1,'uint16=>uint16');
-         header.projectID_GUID3 = fread(fid,1,'uint16=>uint16');
-         header.projectID_GUID4 = ...
-            sscanf(char(fread(fid,8,'uchar=>uchar')'),'%c');
-         header.pVersionMajor = fread(fid,1,'uchar=>uchar');
-         header.pVersionMinor = fread(fid,1,'uchar=>uchar');
-         header.systemIdentifier= ...
-            sscanf(char(fread(fid,32,'uchar=>uchar')'),'%c');
-         header.generatingSoftware = ...
-            sscanf(char(fread(fid,32,'uchar=>uchar')'),'%c');
-         dayOfYear = fread(fid,1,'uint16=>double');
-         year = fread(fid,1,'uint16=>double');
-         header.pFileCreationDate = datenum(year,1,dayOfYear);
-         header.headerSize = fread(fid,1,'uint16=>uint16');
-         header.offsetToPointData = fread(fid,1,'uint32=>uint32');
-         header.nVLRs = fread(fid,1,'uint32=>uint32');
-         header.pointDataFormatID = fread(fid,1,'uint8=>uint8');
-         header.pointDataRecordLength = fread(fid,1,'uint16=>uint16');
-         header.nPoints = fread(fid,1,'uint32=>uint32');
-         header.nPointsByReturn = fread(fid,5,'uint32=>uint32');
-         header.xScaleFactor = fread(fid,1,'double=>double');
-         header.yScaleFactor = fread(fid,1,'double=>double');
-         header.zScaleFactor = fread(fid,1,'double=>double');
-         header.xOffset = fread(fid,1,'double=>double');
-         header.yOffset = fread(fid,1,'double=>double');
-         header.zOffset = fread(fid,1,'double=>double');
-         header.maxX = fread(fid,1,'double=>double');
-         header.minX = fread(fid,1,'double=>double');
-         header.maxY = fread(fid,1,'double=>double');
-         header.minY = fread(fid,1,'double=>double');
-         header.maxZ = fread(fid,1,'double=>double');
-         header.minZ = fread(fid,1,'double=>double');
-         
-         if (header.headerSize > 227)
-            header.extraData = fread(fid,header.headerSize - 227,'uint8=>uint8');
-         end
-         
-         if (ischar(location))
-            % Close the file if it was opened  here.
-            fclose(fid);
-         end
-      end
-      
-      %************************************************************************
-      % LasPublicHeader/saveTo
-      %************************************************************************
-      function saveTo(header, location)
-         % Save the LAS file public header to the given location.
-         
-         if (ischar(location))
-            % Assume single argument is file name
-            [fid, msg]=fopen(location, 'w');
+            % Check the file signature to make sure we have a LAS file
+            if (~strcmp(sscanf(char(fread(fid,4,'uchar=>uchar')'),'%c'),...
+                    header.fileSignature))
+                error('LasPublicHeader:InvalidFile',...
+                    'File does not appear to be a valid LAS file.');
+            end
             
-            if (fid < 0)
-               error('LasPublicHeader:FileError',msg);
-            end
-         elseif (isnumeric(location))
-            % Assume single argument is file ID
-            fid = location;
-         else
-            error('LasPublicHeader:InitError',...
-               'Unknown argument initializer');
-         end
-         
-         fprintf(fid,'%4s',header.fileSignature);
-         fwrite(fid,header.fileSourceID,'uint16');
-         fwrite(fid,header.globalEncoding,'uint16');
-         fwrite(fid,header.projectID_GUID1,'uint32');
-         fwrite(fid,header.projectID_GUID2,'uint16');
-         fwrite(fid,header.projectID_GUID3,'uint16');
-
-         if (length(header.projectID_GUID4) > 8)
-            fwrite(fid,header.projectID_GUID4(1:8),'char');
-         else
-            GUID4=[header.projectID_GUID4...
-                   repmat(char(0),1,8-numel(header.projectID_GUID4))];
-            fwrite(fid,GUID4,'char');
-         end
-         
-         fprintf(fid,'%c',header.pVersionMajor);
-         fprintf(fid,'%c',header.pVersionMinor);
-
-         if (length(header.systemIdentifier) > 32)
-             fwrite(fid,header.systemIdentifier(1:32),'char');
-         else
-            sysID=[header.systemIdentifier...
-                   repmat(char(0),1,32-...
-                   numel(header.systemIdentifier))];
-            fwrite(fid,sysID,'char');
-         end
-         
-         if (length(header.generatingSoftware) > 32)
-            fwrite(fid,header.generatingSoftware(1:32),'char');
-         else
-            genSoft=[header.generatingSoftware...
-                     repmat(char(0),1,32-...
-                     numel(header.generatingSoftware))];
-            fwrite(fid,genSoft,'char');
-         end
-         
-         fwrite(fid,header.fileCreationDayOfYear,'uint16');
-         fwrite(fid,header.fileCreationYear,'uint16');
-         
-         fwrite(fid,header.headerSize,'uint16');
-         fwrite(fid,header.offsetToPointData,'uint32');
-         
-         fwrite(fid,header.nVLRs,'uint32');
-         fwrite(fid,header.pointDataFormatID,'uint8');
-         fwrite(fid,header.pointDataRecordLength,'uint16');
-         fwrite(fid,header.nPoints,'uint32');
-         fwrite(fid,header.nPointsByReturn,'uint32');
-         fwrite(fid,header.xScaleFactor,'double');
-         fwrite(fid,header.yScaleFactor,'double');
-         fwrite(fid,header.zScaleFactor,'double');
-         fwrite(fid,header.xOffset,'double');
-         fwrite(fid,header.yOffset,'double');
-         fwrite(fid,header.zOffset,'double');
-         fwrite(fid,header.maxX,'double');
-         fwrite(fid,header.minX,'double');
-         fwrite(fid,header.maxY,'double');
-         fwrite(fid,header.minY,'double');
-         fwrite(fid,header.maxZ,'double');
-         fwrite(fid,header.minZ,'double');
-         fwrite(fid,header.extraData,'uint8');
-         
-         if (ischar(location))
-            % Close the file if it was opened  here.
-            fclose(fid);
-         end
-      end
-   end
+            header.fileSourceID = fread(fid,1,'uint16=>uint16');
+            header.globalEncoding = fread(fid,1,'uint16=>uint16');
+            header.projectID_GUID1 = fread(fid,1,'uint32=>uint32');
+            header.projectID_GUID2 = fread(fid,1,'uint16=>uint16');
+            header.projectID_GUID3 = fread(fid,1,'uint16=>uint16');
+            header.projectID_GUID4 = ...
+                sscanf(char(fread(fid,8,'uchar=>uchar')'),'%c');
+            header.pVersionMajor = fread(fid,1,'uchar=>uchar');
+            header.pVersionMinor = fread(fid,1,'uchar=>uchar');
+            header.systemIdentifier= ...
+                sscanf(char(fread(fid,32,'uchar=>uchar')'),'%c');
+            header.generatingSoftware = ...
+                sscanf(char(fread(fid,32,'uchar=>uchar')'),'%c');
+            dayOfYear = fread(fid,1,'uint16=>double');
+            year = fread(fid,1,'uint16=>double');
+            header.pFileCreationDate = datenum(year,1,dayOfYear);
+            header.headerSize = fread(fid,1,'uint16=>uint16');
+            header.offsetToPointData = fread(fid,1,'uint32=>uint32');
+            header.nVLRs = fread(fid,1,'uint32=>uint32');
+            header.pointDataFormatID = fread(fid,1,'uint8=>uint8');
+            header.pointDataRecordLength = fread(fid,1,'uint16=>uint16');
+            header.nPoints = fread(fid,1,'uint32=>uint32');
+            header.nPointsByReturn = fread(fid,5,'uint32=>uint32');
+            header.xScaleFactor = fread(fid,1,'double=>double');
+            header.yScaleFactor = fread(fid,1,'double=>double');
+            header.zScaleFactor = fread(fid,1,'double=>double');
+            header.xOffset = fread(fid,1,'double=>double');
+            header.yOffset = fread(fid,1,'double=>double');
+            header.zOffset = fread(fid,1,'double=>double');
+            header.maxX = fread(fid,1,'double=>double');
+            header.minX = fread(fid,1,'double=>double');
+            header.maxY = fread(fid,1,'double=>double');
+            header.minY = fread(fid,1,'double=>double');
+            header.maxZ = fread(fid,1,'double=>double');
+            header.minZ = fread(fid,1,'double=>double');
+            
+            if (header.headerSize > 227)
+                header.extraData = fread(fid,header.headerSize - 227,'uint8=>uint8');
+            end
+
+            if (ischar(location))
+                % Close the file if it was opened  here.
+                fclose(fid);
+            end
+        end
+        
+        function saveTo(header, fileid)
+            % Save the LAS file public header to the given location.
+
+            if (ischar(fileid))
+                % Assume single argument is file name
+                [fid, msg]=fopen(fileid, 'w');
+                
+                if (fid < 0)
+                    error('LasPublicHeader:FileError',msg);
+                end
+            elseif (isnumeric(fileid))
+                % Assume single argument is file ID
+                fid = fileid;
+            else
+                error('LasPublicHeader:InitError',...
+                    'Unknown argument initializer');
+            end
+            
+            fprintf(fid,'%4s',header.fileSignature);
+            fwrite(fid,header.fileSourceID,'uint16');
+            fwrite(fid,header.globalEncoding,'uint16');
+            fwrite(fid,header.projectID_GUID1,'uint32');
+            fwrite(fid,header.projectID_GUID2,'uint16');
+            fwrite(fid,header.projectID_GUID3,'uint16');
+            if (length(header.projectID_GUID4) > 8)
+                fwrite(fid,header.projectID_GUID4(1:8),'char');
+            else
+                GUID4=[header.projectID_GUID4...
+                       repmat(char(0),1,8-numel(header.projectID_GUID4))];
+                fwrite(fid,GUID4,'char');
+            end
+            fprintf(fid,'%c',header.pVersionMajor);
+            fprintf(fid,'%c',header.pVersionMinor);
+            if (length(header.systemIdentifier) > 32)
+                fwrite(fid,header.systemIdentifier(1:32),'char');
+            else
+                sysID=[header.systemIdentifier...
+                       repmat(char(0),1,32-...
+                       numel(header.systemIdentifier))];
+                fwrite(fid,sysID,'char');
+            end
+            if (length(header.generatingSoftware) > 32)
+                fwrite(fid,header.generatingSoftware(1:32),'char');
+            else
+                genSoft=[header.generatingSoftware...
+                         repmat(char(0),1,32-...
+                         numel(header.generatingSoftware))];
+                fwrite(fid,genSoft,'char');
+            end
+            fwrite(fid,header.fileCreationDayOfYear,'uint16');
+            fwrite(fid,header.fileCreationYear,'uint16');
+
+            fwrite(fid,header.headerSize,'uint16');
+            fwrite(fid,header.offsetToPointData,'uint32');
+
+            fwrite(fid,header.nVLRs,'uint32');
+            fwrite(fid,header.pointDataFormatID,'uint8');
+            fwrite(fid,header.pointDataRecordLength,'uint16');
+            fwrite(fid,header.nPoints,'uint32');
+            fwrite(fid,header.nPointsByReturn,'uint32');
+            fwrite(fid,header.xScaleFactor,'double');
+            fwrite(fid,header.yScaleFactor,'double');
+            fwrite(fid,header.zScaleFactor,'double');
+            fwrite(fid,header.xOffset,'double');
+            fwrite(fid,header.yOffset,'double');
+            fwrite(fid,header.zOffset,'double');
+            fwrite(fid,header.maxX,'double');
+            fwrite(fid,header.minX,'double');
+            fwrite(fid,header.maxY,'double');
+            fwrite(fid,header.minY,'double');
+            fwrite(fid,header.maxZ,'double');
+            fwrite(fid,header.minZ,'double');
+            fwrite(fid,header.extraData,'uint8');
+            
+            if (ischar(fileid))
+                % Close the file if it was opened  here.
+                fclose(fid);
+            end
+        end
+    end
 end
Index: Damkjer/Util/FileIO/LasFile/LasVlr.m
===================================================================
--- Damkjer/Util/FileIO/LasFile/LasVlr.m	(revision 7)
+++ Damkjer/Util/FileIO/LasFile/LasVlr.m	(revision 0)
@@ -1,222 +1,179 @@
-% LasVlr   ASPRS LAS format variable length record
+%  LasVlr
 %
-% File:
-%    LasVlr.m
+%  File:  LasVlr.m
 %
-% Description:
-%    This MATLAB class represents an ASPRS LAS version 1.2 file variable length
-%    record.
+%  Description: This MATLAB class represents an ASPRS LAS version 1.2
+%               file variable length record.
 %
-% Limitations:
-%    None.
-%
-% Properties:
-%    userID                   - The User Identifier
-%    recordID                 - The Record Identifier
-%    recordLengthAfterHeader  - The Record Length After Header
-%    description              - The Description
-%    data                     - The Data
-%
-% Methods:
-%    [this] = LasVlr(varargin)  - Constructor for LAS VLR objects.
-%             saveTo(location)  - Save LAS VLR to a given location.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    http://asprs.org/a/society/committees/standards/asprs_las_format_v12.pdf
-%
-% See Also:
-%    LasFile
-%
-
 %  Software History:
-%    2012-AUG-29   K. Damkjer
-%       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
+%     2012-AUG-29   K. Damkjer
+%        Initial Coding.
 %
 
 classdef LasVlr
-   properties
-      % The User Identifier
-      %
-      % The User ID field is ASCII character data that identifies the
-      % user which created the variable length record. It is possible to
-      % have many Variable Length Records from different sources with
-      % different User IDs. If the character data is less than 16
-      % characters, the remaining data must be null. The User ID must be
-      % registered with the LAS specification managing body. The
-      % management of these User IDs ensures that no two individuals
-      % accidentally use the same User ID. The specification will
-      % initially use two IDs: one for globally specified records
-      % (LASF_Spec), and another for projection types (LASF_Projection).
-      % Keys may be requested at
-      % http://www.asprs.org/lasform/keyform.html.
-      userID = ''
-      
-      % The Record Identifier
-      %
-      % The Record ID is dependent upon the User ID. There can be 0 to
-      % 65535 Record IDs for every User ID. The LAS specification manages
-      % its own Record IDs (User IDs owned by the specification),
-      % otherwise Record IDs will be managed by the owner of the given
-      % User ID. Thus each User ID is allowed to assign 0 to 65535 Record
-      % IDs in any manner they desire. Publicizing the meaning of a given
-      % Record ID is left to the owner of the given User ID. Unknown
-      % User ID/Record ID combinations should be ignored.
-      recordID = uint16(0)
-      
-      % The Record Length After Header
-      %
-      % The record length is the number of bytes for the record after the
-      % end of the standard part of the header. Thus the entire record
-      % length is 54 bytes (the header size iversion 1.2) plus the number
-      % of bytes in the variable length portion of the record.
-      recordLengthAfterHeader = uint16(0)
-      
-      % The Description
-      %
-      % Optional, null terminated description of the data. Any remaining
-      % characters not used must be null.
-      description = ''
-      
-      % The Data
-      %
-      % The raw VLR data as a byte array.
-      data = zeros(0,'uint8');
-   end
-   
-   properties (Dependent)
-   end
-   
-   methods
-      function this = LasVlr(varargin)
-         % Constructor for LAS VLR objects
-         
-         switch (nargin)
-            case 0
-            case 1
-               if (isa(varargin{1}, 'LasVlr'))
-                  % Copy constructor
-                  rhs = varargin{1};
-                  fns = properties(rhs);
-                  for i=1:length(fns)
-                     this.(fns{i}) = rhs.(fns{i});
-                  end
-               else
-                  if (ischar(varargin{1}))
-                     % Assume single argument is file name
-                     [fid, msg]=fopen(varargin{1}, 'rb');
-                     
-                     if (fid < 0)
-                        error('LasVlr:FileError',msg);
-                     end
-                     
-                     % Check the file signature to make sure we have a LAS file
-                     if (~strcmp(sscanf(char(fread(fid,4,'uchar=>uchar')'),...
-                                        '%c'),...
-                                 'LASF'))
-                        error('LasVlr:InvalidFile',...
-                              'File does not appear to be a valid LAS file.');
-                     end
-                  elseif (isnumeric(varargin{1}))
-                     % Assume single argument is file ID
-                     fid = varargin{1};
-                  else
-                     error('LasVlr:InitError',...
-                           ['Unknown argument initializer: ' varargin{1}]);
-                  end
-                  
-                  fseek(fid, 94, 'bof');
-                  headerSize = fread(fid,1,'uint16=>uint16');
-                  
-                  fseek(fid, 100, 'bof');
-                  nVLRs = fread(fid,1,'uint16=>uint16');
-                  
-                  this(nVLRs) = LasVlr;
-                  
-                  fseek(fid,headerSize,'bof');
-                  
-                  for i=1:nVLRs
-                     fread(fid,1,'uint16=>uint16');
-                     this(i).userID = ...
-                        deblank(sscanf(char(fread(fid,16,'uchar=>uchar')'),'%c'));
-                     this(i).recordID = ...
+    properties
+        % The User Identifier
+        %
+        % The User ID field is ASCII character data that identifies the
+        % user which created the variable length record. It is possible to
+        % have many Variable Length Records from different sources with
+        % different User IDs. If the character data is less than 16
+        % characters, the remaining data must be null. The User ID must be
+        % registered with the LAS specification managing body. The
+        % management of these User IDs ensures that no two individuals
+        % accidentally use the same User ID. The specification will
+        % initially use two IDs: one for globally specified records
+        % (LASF_Spec), and another for projection types (LASF_Projection).
+        % Keys may be requested at
+        % http://www.asprs.org/lasform/keyform.html.
+        userID = ''
+        
+        % The Record Identifier
+        %
+        % The Record ID is dependent upon the User ID. There can be 0 to
+        % 65535 Record IDs for every User ID. The LAS specification manages
+        % its own Record IDs (User IDs owned by the specification),
+        % otherwise Record IDs will be managed by the owner of the given
+        % User ID. Thus each User ID is allowed to assign 0 to 65535 Record
+        % IDs in any manner they desire. Publicizing the meaning of a given
+        % Record ID is left to the owner of the given User ID. Unknown
+        % User ID/Record ID combinations should be ignored.
+        recordID = uint16(0)
+        
+        % The Record Length After Header
+        %
+        % The record length is the number of bytes for the record after the
+        % end of the standard part of the header. Thus the entire record
+        % length is 54 bytes (the header size iversion 1.2) plus the number
+        % of bytes in the variable length portion of the record.
+        recordLengthAfterHeader = uint16(0)
+
+        % The Description
+        %
+        % Optional, null terminated description of the data. Any remaining
+        % characters not used must be null.
+        description = ''
+        
+        % The Data
+        %
+        % The raw VLR data as a byte array.
+        data = zeros(0,'uint8');
+    end
+    
+    properties (Dependent)
+    end
+    
+    methods
+        function this = LasVlr(varargin)
+            % Constructor for LAS VLR Header objects
+            
+            switch (nargin)
+                case 0
+                case 1
+                    if (ischar(varargin{1}))
+                        % Assume single argument is file name
+                        [fid, msg]=fopen(varargin{1}, 'rb');
+                        
+                        if (fid < 0)
+                            error('LasVlrHeader:FileError',msg);
+                        end
+                        
+                        % Check the file signature to make sure we have a LAS file
+                        if (~strcmp(sscanf(char(fread(fid,4,'uchar=>uchar')'),...
+                                '%c'),...
+                                'LASF'))
+                            error('LasVlrHeader:InvalidFile',...
+                                'File does not appear to be a valid LAS file.');
+                        end
+                    elseif (isnumeric(varargin{1}))
+                        % Assume single argument is file ID
+                        fid = varargin{1};
+                    else
+                        error('LasVlrHeader:InitError',...
+                            'Unknown argument initializer');
+                    end
+                    
+                    fseek(fid, 94, 'bof');
+                    headerSize = fread(fid,1,'uint16=>uint16');
+                    
+                    fseek(fid, 100, 'bof');
+                    nVLRs = fread(fid,1,'uint16=>uint16');
+                    
+                    this(nVLRs) = LasVlr;
+                    
+                    fseek(fid,headerSize,'bof');
+                    
+                    for i=1:nVLRs
                         fread(fid,1,'uint16=>uint16');
-                     this(i).recordLengthAfterHeader = ...
-                        fread(fid,1,'uint16=>uint16');
-                     this(i).description = ...
-                        deblank(sscanf(char(fread(fid,32,'uchar=>uchar')'),'%c'));
-                     this(i).data = fread(fid,...
-                        this(i).recordLengthAfterHeader,'uint8=>uint8');
-                  end
-                  
-                  if (ischar(varargin{1}))
-                     % Close the file if it was opened  here.
-                     fclose(fid);
-                  end
-               end
-            otherwise
-               error('LasVlr:UnexpectedInputs',...
-                     'Unexpected number of inputs encountered.');
-         end
-      end
-      
-      function saveTo(this, location)
-         % Save the LAS file public header to the given location.
-         
-         if (ischar(location))
-            % Assume single argument is file name
-            [fid, msg]=fopen(location, 'w');
+                        this(i).userID = ...
+                            sscanf(char(fread(fid,16,'uchar=>uchar')'),'%c');
+                        this(i).recordID = ...
+                            fread(fid,1,'uint16=>uint16');
+                        this(i).recordLengthAfterHeader = ...
+                            fread(fid,1,'uint16=>uint16');
+                        this(i).description = ...
+                            sscanf(char(fread(fid,32,'uchar=>uchar')'),'%c');
+                        this(i).data = fread(fid,...
+                            this(i).recordLengthAfterHeader,'uint8=>uint8');
+                    end
+                    
+                    if (ischar(varargin{1}))
+                        % Close the file if it was opened  here.
+                        fclose(fid);
+                    end
+                otherwise
+                    error('LasVlrHeader:UnexpectedInputs',...
+                        'Unexpected number of inputs encountered.');
+            end
+        end
+
+        function saveTo(this, location)
+            % Save the LAS file public header to the given location.
+
+            if (ischar(location))
+                % Assume single argument is file name
+                [fid, msg]=fopen(location, 'w');
+                
+                if (fid < 0)
+                    error('LasPublicHeader:FileError',msg);
+                end
+            elseif (isnumeric(location))
+                % Assume single argument is file ID
+                fid = location;
+            else
+                error('LasPublicHeader:InitError',...
+                    'Unknown argument initializer');
+            end
+
+            fwrite(fid,0,'uint16');
+
+            if (length(this.userID) > 16)
+                fwrite(fid,this.userID(1:16),'char');
+            else
+                user=[this.userID...
+                    repmat(char(0),1,16-...
+                    numel(this.userID))];
+                fwrite(fid,user,'char');
+            end
+
+            fwrite(fid,this.recordID,'uint16');
+            fwrite(fid,this.recordLengthAfterHeader,'uint16');
+
+            if (length(this.description) > 32)
+                fwrite(fid,this.description(1:32),'char');
+            else
+                desc=[this.description...
+                    repmat(char(0),1,32-...
+                    numel(this.description))];
+                fwrite(fid,desc,'char');
+            end
+
+            fwrite(fid,this.data,'uint8');
             
-            if (fid < 0)
-               error('LasPublicHeader:FileError',msg);
+            if (ischar(location))
+                % Close the file if it was opened  here.
+                fclose(fid);
             end
-         elseif (isnumeric(location))
-            % Assume single argument is file ID
-            fid = location;
-         else
-            error('LasPublicHeader:InitError',...
-               'Unknown argument initializer');
-         end
-         
-         fwrite(fid,0,'uint16');
-         
-         if (length(this.userID) > 16)
-            fwrite(fid,this.userID(1:16),'char');
-         else
-            user=[this.userID...
-               repmat(char(0),1,16-...
-               numel(this.userID))];
-            fwrite(fid,user,'char');
-         end
-         
-         fwrite(fid,this.recordID,'uint16');
-         fwrite(fid,this.recordLengthAfterHeader,'uint16');
-         
-         if (length(this.description) > 32)
-            fwrite(fid,this.description(1:32),'char');
-         else
-            desc=[this.description...
-               repmat(char(0),1,32-...
-               numel(this.description))];
-            fwrite(fid,desc,'char');
-         end
-         
-         fwrite(fid,this.data,'uint8');
-         
-         if (ischar(location))
-            % Close the file if it was opened  here.
-            fclose(fid);
-         end
-      end
-   end
+        end
+    end
 end
Index: Damkjer/Util/FileIO/LasFile/LasVlrOld.m
===================================================================
--- Damkjer/Util/FileIO/LasFile/LasVlrOld.m	(revision 12)
+++ Damkjer/Util/FileIO/LasFile/LasVlrOld.m	(revision 0)
@@ -1,44 +1,18 @@
-% LasVlrOld   Obsolete Abstract Class for ASPRS LAS Format VLRs
+% LasfProjGeoAsciiParamsTagVLR
 %
-% File:
-%    LasVlrOld.m
+% File:  LasfProjGeoAsciiParamsTagVLR.m
 %
-% Description:
-%    This class was intended to define and abstract interface for LAS VLRs. It
-%    is now obsolete.
+% Description: This MATLAB class represents an ASPRS LAS version 1.2
+%              LASF Projection GeoAsciiParamsTag variable length record.
 %
-% Limitations:
-%    Obsolete Class.
-%
-% Properties:
-%    None.
-%
-% Methods:
-%    [vlr] = loadFrom(location)  - Load LAS VLR from a given location.
-%            saveTo(location)    - Save LAS VLR to a given location.
-%
-% Other m-files required:
-%    None.
-%
-% MAT-files required:
-%    None.
-%
-% References:
-%    http://asprs.org/a/society/committees/standards/asprs_las_format_v12.pdf
-%
-% See Also:
-%    LasFile
-
 % Software History:
 %    2012-AUG-29   K. Damkjer
 %       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
 %
 
 classdef LasVlrOld
-   methods (Abstract = true)
-      saveTo(vlr,location)
-      vlr=loadFrom(vlr,location)
-   end
+    methods (Abstract = true)
+        saveTo(vlr,location)
+        vlr=loadFrom(vlr,location)
+    end
 end
Index: Damkjer/Util/FileIO/LasFile/LasfProjGeoAsciiParamsTagVLR.m
===================================================================
--- Damkjer/Util/FileIO/LasFile/LasfProjGeoAsciiParamsTagVLR.m	(revision 7)
+++ Damkjer/Util/FileIO/LasFile/LasfProjGeoAsciiParamsTagVLR.m	(revision 0)
@@ -1,84 +1,32 @@
-% LasfProjGeoAsciiParamsTagVLR   LASF_Projection: GeoTIFF Tag - ASCII Parameters
+% LasfProjGeoAsciiParamsTagVLR
 %
-% File:
-%    LasfProjGeoAsciiParamsTagVLR.m
+% File:  LasfProjGeoAsciiParamsTagVLR.m
 %
-% Description:
-%    This MATLAB class represents a VLR that contains an array of ASCII data. It
-%    contains many strings separated by null terminator characters which are
-%    referenced by position from data in the GeoKeyDirectoryTag record.
+% Description: This MATLAB class represents an ASPRS LAS version 1.2
+%              LASF Projection GeoAsciiParamsTag variable length record.
 %
-% Limitations:
-%    None.
-%
-% Properties:
-%    params                   - The ASCII Parameters
-%    userID                   - The User Identifier
-%    recordID                 - The Record Identifier
-%    recordLengthAfterHeader  - The Record Length After Header
-%    description              - The Description
-%    data                     - The Data
-%
-% Methods:
-%    [this] = LasfProjGeoAsciiParamsTagVLR(varargin)  - Constructor.
-%             saveTo(location)                        - Save LAS VLR to a given
-%                                                       location.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    LasVlr.m
-%
-% MAT-files required:
-%    None.
-%
-% References:
-%    http://asprs.org/a/society/committees/standards/asprs_las_format_v12.pdf
-%    http://www.remotesensing.org/geotiff/spec/geotiffhome.html
-%
-% See Also:
-%    LasFile
-%    LasVlr
-%    LasfProjGeoKeyDirectoryTagVLR
-%
-
 % Software History:
 %    2012-AUG-29   K. Damkjer
 %       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
 %
 
 classdef (Sealed = true) LasfProjGeoAsciiParamsTagVLR < LasVlr
-   properties
-      params
-   end
-   
-   methods
-      function vlr = LasfProjGeoAsciiParamsTagVLR(varargin)
-         if (nargin == 0)
-            superargs = {};
-         elseif (nargin == 1)
-            if (~isa(varargin{1},'LasVlr'))
-               error('LasfProjGeoDoubleParamsTagVLR:InitError',...
-                     'Unknown argument initializer.');
+    properties
+        params
+    end
+    
+    methods
+        function vlr = LasfProjGeoAsciiParamsTagVLR(varargin)
+            if (nargin == 1)
+                if (~strcmp(class(varargin{1}),'uint8'))
+                    error('LasfProjGeoAsciiParamsTagVLR:InitError',...
+                        'Unknown argument initializer');
+                end
+
+                % The GeoKeyDirectoryTag data is a stream of unsigned
+                % shorts
+                vlr.params = char(varargin{1});
             end
-            
-            vlrHeader = varargin{1};
-            
-            superargs{1} = vlrHeader;
-         else
-            error('LasfProjGeoDoubleParamsTagVLR:InitError',...
-                  'Unexpected number of inputs.');
-         end
-         
-         vlr = vlr@LasVlr(superargs{:});
-         
-         if (nargin == 1)
-            % The GeoAsciiParamsTag data is a stream of null-terminated strings
-            vlr.params = char(vlrHeader.data);
-         end
-      end
-   end
+        end
+    end
 end
Index: Damkjer/Util/FileIO/LasFile/LasfProjGeoDoubleParamsTagVLR.m
===================================================================
--- Damkjer/Util/FileIO/LasFile/LasfProjGeoDoubleParamsTagVLR.m	(revision 7)
+++ Damkjer/Util/FileIO/LasFile/LasfProjGeoDoubleParamsTagVLR.m	(revision 0)
@@ -1,83 +1,32 @@
-% LasfProjGeoDoubleParamsTagVLR   LASF_Projection: GeoTIFF Tag - Double Parameters
+% LasfProjGeoAsciiParamsTagVLR
 %
-% File:
-%    LasfProjGeoDoubleParamsTagVLR.m
+% File:  LasfProjGeoAsciiParamsTagVLR.m
 %
-% Description:
-%    This MATLAB class represents a VLR that contains an array of double values
-%    referenced by tag sets in the GeoKeyDirectoryTag record.
+% Description: This MATLAB class represents an ASPRS LAS version 1.2
+%              LASF Projection GeoAsciiParamsTag variable length record.
 %
-% Limitations:
-%    None.
-%
-% Properties:
-%    params                   - The Double Parameters
-%    userID                   - The User Identifier
-%    recordID                 - The Record Identifier
-%    recordLengthAfterHeader  - The Record Length After Header
-%    description              - The Description
-%    data                     - The Data
-%
-% Methods:
-%    [this] = LasfProjGeoDoubleParamsTagVLR(varargin)  - Constructor.
-%             saveTo(location)                         - Save LAS VLR to a given
-%                                                        location.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    LasVlr.m
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    http://asprs.org/a/society/committees/standards/asprs_las_format_v12.pdf
-%    http://www.remotesensing.org/geotiff/spec/geotiffhome.html
-%
-% See Also:
-%    LasFile
-%    LasVlr
-%    LasfProjGeoKeyDirectoryTagVLR
-%
-
 % Software History:
 %    2012-AUG-29   K. Damkjer
 %       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
 %
 
 classdef (Sealed = true) LasfProjGeoDoubleParamsTagVLR < LasVlr
-   properties
-      params
-   end
-   
-   methods
-      function vlr = LasfProjGeoDoubleParamsTagVLR(varargin)
-         if (nargin == 0)
-            superargs = {};
-         elseif (nargin == 1)
-            if (~isa(varargin{1},'LasVlr'))
-               error('LasfProjGeoDoubleParamsTagVLR:InitError',...
-                     'Unknown argument initializer.');
+    properties
+        params
+    end
+    
+    methods
+        function vlr = LasfProjGeoDoubleParamsTagVLR(varargin)
+            if (nargin == 1)
+                if (~strcmp(class(varargin{1}),'uint8'))
+                    error('LasfProjGeoDoubleParamsTagVLR:InitError',...
+                        'Unknown argument initializer');
+                end
+
+                % The GeoKeyDirectoryTag data is a stream of unsigned
+                % shorts
+                vlr.params = typecast(varargin{1},'double');
             end
-            
-            vlrHeader = varargin{1};
-            
-            superargs{1} = vlrHeader;
-         else
-            error('LasfProjGeoDoubleParamsTagVLR:InitError',...
-                  'Unexpected number of inputs.');
-         end
-         
-         vlr = vlr@LasVlr(superargs{:});
-         
-         if (nargin == 1)
-            % The GeoDoubleParamsTag data is a stream of doubles
-            vlr.params = typecast(vlrHeader.data,'double');
-         end
-      end
-   end
+        end
+    end
 end
Index: Damkjer/Util/FileIO/LasFile/LasfProjGeoKeyDirectoryTagVLR.m
===================================================================
--- Damkjer/Util/FileIO/LasFile/LasfProjGeoKeyDirectoryTagVLR.m	(revision 7)
+++ Damkjer/Util/FileIO/LasFile/LasfProjGeoKeyDirectoryTagVLR.m	(revision 0)
@@ -1,120 +1,49 @@
-% LasfProjGeoKeyDirectoryTagVLR   LASF_Projection: GeoTIFF Tag - Key Directory
+% LasfProjGeoAsciiParamsTagVLR
 %
-% File:
-%    LasfProjGeoKeyDirectoryTagVLR.m
+% File:  LasfProjGeoAsciiParamsTagVLR.m
 %
-% Description:
-%    This MATLAB class represents a LAS File Projection VLR containing the key
-%    values that define the coordinate system. A complete description can be
-%    found in the GeoTIFF format specification.
+% Description: This MATLAB class represents an ASPRS LAS version 1.2
+%              LASF Projection GeoAsciiParamsTag variable length record.
 %
-% Limitations:
-%    None.
-%
-% Properties:
-%    keyDirectoryVersion      - The Key Directory Version (1)
-%    keyRevision              - The Key Revision (1)
-%    minorRevision            - The Minor Revision (0)
-%    numberOfKeys             - The Number of GeoTIFF Keys in this Directory
-%    keys                     - The GeoTIFF Keys
-%    userID                   - The User Identifier
-%    recordID                 - The Record Identifier
-%    recordLengthAfterHeader  - The Record Length After Header
-%    description              - The Description
-%    data                     - The Data
-%
-% Methods:
-%    [this] = LasfProjGeoKeyDirectoryTagVLR(varargin)  - Constructor.
-%             saveTo(location)                         - Save LAS VLR to a given
-%                                                        location.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    LasVlr.m
-%    geoKeyFactory.m
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    http://asprs.org/a/society/committees/standards/asprs_las_format_v12.pdf
-%    http://www.remotesensing.org/geotiff/spec/geotiffhome.html
-%
-% See Also:
-%    LasFile
-%    LasVlr
-%    geoKeyFactory
-%
-
 % Software History:
 %    2012-AUG-29   K. Damkjer
 %       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
 %
 
 classdef (Sealed = true) LasfProjGeoKeyDirectoryTagVLR < LasVlr
-   properties
-      keyDirectoryVersion = 1
-      keyRevision = 1
-      minorRevision = 0
-      numberOfKeys = 0
-      keys = {}
-   end
-   
-   methods
-      function vlr = LasfProjGeoKeyDirectoryTagVLR(varargin)
-         if (nargin == 0)
-            superargs = {};
-         elseif (nargin == 1)
-            if (~isa(varargin{1},'LasVlr'))
-               error('LasfProjGeoKeyDirectoryTagVLR:InitError',...
-                     'Unknown argument initializer.');
+    properties
+        keyDirectoryVersion = 1
+        keyRevision = 1
+        minorRevision = 0
+        numberOfKeys = 0
+    end
+    
+    methods
+        function vlr = LasfProjGeoKeyDirectoryTagVLR(varargin)
+            if (nargin == 1)
+                if (~strcmp(class(varargin{1}),'uint8'))
+                    error('LasfProjGeoKeyDirectoryTagVLR:InitError',...
+                        'Unknown argument initializer');
+                end
+
+                % The GeoKeyDirectoryTag data is a stream of unsigned
+                % shorts
+                data = typecast(varargin{1},'uint16');
+                
+                if (data(1) ~= 1 && data(2) ~= 1 && data(3) ~= 0)
+                    error('LasfProjGeoKeyDirectoryTagVLR:InitError',...
+                        'Invalid Format.');
+                end
+                
+                vlr.numberOfKeys = data(4);
+                
+                keys = reshape(data(5:end),4,vlr.numberOfKeys);
+                
+                for key=1:vlr.numberOfKeys
+                    tempKey=keys(:,key);
+                    geoKeyFactory(tempKey(1),tempKey(2),tempKey(3),tempKey(4))
+                end
             end
-            
-            vlrHeader = varargin{1};
-            
-            superargs{1} = vlrHeader;
-         else
-            error('LasfProjGeoKeyDirectoryTagVLR:InitError',...
-                  'Unexpected number of inputs.');
-         end
-         
-         vlr = vlr@LasVlr(superargs{:});
-         
-         if (nargin == 1)
-            
-            if (~(strcmp(vlrHeader.userID, 'LASF_Projection') &&...
-                  vlrHeader.recordID == 34735))
-               error('LasfProjGeoKeyDirectoryTagVLR:InitError',...
-                     'Invalid argument.');
-            end
-            
-            % The GeoKeyDirectoryTag data is a stream of unsigned shorts
-            data = typecast(vlrHeader.data,'uint16');
-            
-            if (data(1) ~= 1 && data(2) ~= 1 && data(3) ~= 0)
-               error('LasfProjGeoKeyDirectoryTagVLR:InitError',...
-                     'Invalid Format.');
-            end
-            
-            vlr.numberOfKeys = data(4);
-            
-            keyData = reshape(data(5:end),4,vlr.numberOfKeys);
-
-            vlr.keys = cell(vlr.numberOfKeys,1);
-            
-            for key=1:vlr.numberOfKeys
-               tempKey=keyData(:,key);
-               
-               if (~(tempKey(1) == 0 && tempKey(2) == 0))
-                  vlr.keys{key}=...
-                     geoKeyFactory(tempKey(1),tempKey(2),tempKey(3),tempKey(4));
-               end
-            end
-         end
-      end
-   end
+        end
+    end
 end
Index: Damkjer/Util/FileIO/LasFile/LasfSpecClassificationVLR.m
===================================================================
--- Damkjer/Util/FileIO/LasFile/LasfSpecClassificationVLR.m	(revision 7)
+++ Damkjer/Util/FileIO/LasFile/LasfSpecClassificationVLR.m	(revision 0)
@@ -1,102 +1,51 @@
-% LasfSpecClassificationVLR   LASF_Spec: Classification Dictionary
-%
-% File:
-%    LasfSpecClassificationVLR.m
-%
-% Description:
-%    This MATLAB class represents an ASPRS LAS version 1.2 file variable length
-%    record.
-%
-% Limitations:
-%    None.
-%
-% Properties:
-%    classes                  - The Classification Dictionary
-%    userID                   - The User Identifier
-%    recordID                 - The Record Identifier
-%    recordLengthAfterHeader  - The Record Length After Header
-%    description              - The Description
-%    data                     - The Data
-%
-% Methods:
-%    [this] = LasfSpecClassificationVLR(varargin)  - Constructor.
-%             saveTo(location)                     - Save LAS VLR to a given
-%                                                    location.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    LasVlr.m
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    http://asprs.org/a/society/committees/standards/asprs_las_format_v12.pdf
-%
-% See Also:
-%    LasFile
-%    LasVlr
-%
+classdef (Sealed = true) LasfSpecClassificationVLR < LasVlr
+    properties (SetAccess = private)
+        classes = containers.Map(...
+            {0,...
+            1,...
+            2,...
+            3,...
+            4,...
+            5,...
+            6,...
+            7,...
+            8,...
+            9,...
+            12},...
+            {'Not Classified',...
+            'Unclassified',...
+            'Ground',...
+            'Low Veg',...
+            'Medium Veg',...
+            'High Veg',...
+            'Building',...
+            'Noise',...
+            'Mass Point',...
+            'Water',...
+            'Overlap Point'});
+    end
+    
+    methods
+        function vlr = LasfSpecClassificationVLR(varargin)
+            if (nargin == 1)
+                if (~strcmp(class(varargin{1}),'uint8'))
+                    error('LasfSpecClassificationVLR:InitError',...
+                        'Unknown argument initializer');
+                end
 
-% Software History:
-%    2012-AUG-29   K. Damkjer
-%       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
-%
+                % The LasfSpecClassificationVLR data is a stream of uint8
+                % char[15]s
+                data = reshape(varargin{1},16,length(varargin{1})/16);
 
-classdef (Sealed = true) LasfSpecClassificationVLR < LasVlr
-   properties (SetAccess = private)
-      classes = containers.Map(...
-                               { 0,...
-                                 1,...
-                                 2,...
-                                 3,...
-                                 4,...
-                                 5,...
-                                 6,...
-                                 7,...
-                                 8,...
-                                 9,...
-                                12},...
-                               {'Not Classified',...
-                                'Unclassified',...
-                                'Ground',...
-                                'Low Veg',...
-                                'Medium Veg',...
-                                'High Veg',...
-                                'Building',...
-                                'Noise',...
-                                'Mass Point',...
-                                'Water',...
-                                'Overlap Point'});
-   end
-   
-   methods
-      function vlr = LasfSpecClassificationVLR(varargin)
-         vlr = vlr@LasVlr(varargin{1});
-         
-         if (nargin == 1)
-            if (~strcmp(class(varargin{1}),'uint8'))
-               error('LasfSpecClassificationVLR:InitError',...
-                     'Unknown argument initializer');
+                keySet=num2cell(data(1,:));
+                valueSet=cell(1,size(data,2));
+                
+                for i=1:size(data,2)
+                    valueSet{i}=sscanf(char(data(2:end,i)),'%c');
+                end
+                
+                vlr.classes = containers.Map(keySet,valueSet,'UniformValues',true);
             end
-            
-            % The LasfSpecClassificationVLR data is a stream of uint8
-            % char[15]s
-            data = reshape(varargin{1},16,length(varargin{1})/16);
-            
-            keySet=num2cell(data(1,:));
-            valueSet=cell(1,size(data,2));
-            
-            for i=1:size(data,2)
-               valueSet{i}=sscanf(char(data(2:end,i)),'%c');
-            end
-            
-            vlr.classes = containers.Map(keySet,valueSet,'UniformValues',true);
-         end
-      end
-   end
+        end
+    end
 end
Index: Damkjer/Util/FileIO/LasFile/lasVlrFactory.m
===================================================================
--- Damkjer/Util/FileIO/LasFile/lasVlrFactory.m	(revision 7)
+++ Damkjer/Util/FileIO/LasFile/lasVlrFactory.m	(revision 0)
@@ -1,63 +1,24 @@
-% lasVlrFactory   Abstract factory for LAS VLR objects
+% LasfProjGeoAsciiParamsTagVLR
 %
-% File:
-%    lasVlrFactory.m
+% File:  LasfProjGeoAsciiParamsTagVLR.m
 %
-% Description:
-%    This MATLAB function provides an interface similar to an abstract factory
-%    design pattern for constructing known LAS VLR objects.
-%
-% Limitations:
-%    None.
-%
-% Synopsis:
-%    [vlr] = lasVlrFactory(vlrHeader)
-%
-% Inputs:
-%    vlrHeader  - A LAS VLR object containing populated header data
-%
-% Outputs:
-%    vlr  - A specialized LAS VLR object
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    LasVlr.m
-%    lasfProjVlrFactory.m
-%    lasfSpecVlrFactory.m
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    http://asprs.org/a/society/committees/standards/asprs_las_format_v12.pdf
-%
-% See Also:
-%    LasFile
-%    LasVlr
-%    lasfProjVlrFactory
-%    lasfSpecVlrFactory
-%
-
-% Copyright (C)  2012 Kristian L. Damkjer.
+% Description: This MATLAB class represents an ASPRS LAS version 1.2
+%              LASF Projection GeoAsciiParamsTag variable length record.
 %
 % Software History:
 %    2012-AUG-29   K. Damkjer
 %       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
 %
 
 function [vlr] = lasVlrFactory(vlrHeader)
-
 switch vlrHeader.userID
-   case 'LASF_Projection'
-      vlr = lasfProjVlrFactory(vlrHeader);
-   case 'LASF_Spec'
-      vlr = lasfSpecVlrFactory(vlrHeader);
-   otherwise
-      disp(vlrHeader.userID);
-      disp(vlrHeader.description);
+    case 'LASF_Projection'
+        vlr = lasfProjVlrFactory(vlrHeader.recordID, vlrHeader.data);
+    case 'LASF_Spec'
+        vlr = lasfSpecVlrFactory(vlrHeader.recordID, vlrHeader.data);
+    otherwise
+        disp(vlrHeader.userID);
+        disp(vlrHeader.description);
+%        vlr = LasUnknownVlr(vlrHeader);
 end
 end
Index: Damkjer/Util/FileIO/LasFile/lasfProjVlrFactory.m
===================================================================
--- Damkjer/Util/FileIO/LasFile/lasfProjVlrFactory.m	(revision 7)
+++ Damkjer/Util/FileIO/LasFile/lasfProjVlrFactory.m	(revision 0)
@@ -1,67 +1,24 @@
-% lasfProjVlrFactory   Concrete factory for LAS File Projection VLR objects
+% LasfProjGeoAsciiParamsTagVLR
 %
-% File:
-%    lasfProjVlrFactory.m
+% File:  LasfProjGeoAsciiParamsTagVLR.m
 %
-% Description:
-%    This MATLAB function provides an interface similar to a concrete factory
-%    in the abstract factory design pattern for constructing defined LAS File
-%    Projection VLR objects.
+% Description: This MATLAB class represents an ASPRS LAS version 1.2
+%              LASF Projection GeoAsciiParamsTag variable length record.
 %
-% Limitations:
-%    None.
-%
-% Synopsis:
-%    [vlr] = lasfProjVlrFactory(vlrHeader)
-%
-% Inputs:
-%    vlrHeader  - A LAS VLR object containing populated header data
-%
-% Outputs:
-%    vlr  - A specialized LAS File VLR Projection object
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    LasVlr.m
-%    LasfProjGeoKeyDirectoryTagVLR.m
-%    LasfProjGeoDoubleParamsTagVLR.m
-%    LasfProjGeoAsciiParamsTagVLR.m
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    http://asprs.org/a/society/committees/standards/asprs_las_format_v12.pdf
-%
-% See Also:
-%    LasFile
-%    LasVlr
-%    lasVlrFactory
-%    LasfProjGeoKeyDirectoryTagVLR
-%    LasfProjGeoDoubleParamsTagVLR
-%    LasfProjGeoAsciiParamsTagVLR
-%
-
 % Software History:
 %    2012-AUG-29   K. Damkjer
 %       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
 %
 
-function [vlr] = lasfProjVlrFactory(vlrHeader)
-switch vlrHeader.recordID
-   case 34735
-      vlr = LasfProjGeoKeyDirectoryTagVLR(vlrHeader);
-   case 34736
-      vlr = LasfProjGeoDoubleParamsTagVLR(vlrHeader);
-   case 34737
-      vlr = LasfProjGeoAsciiParamsTagVLR(vlrHeader);
-   otherwise
-      disp(vlrHeader.userID);
-      disp(vlrHeader.recordID);
-      disp(vlrHeader.description);
+function [vlr] = lasfProjVlrFactory(recordID, data)
+switch recordID
+    case 34735
+        vlr = LasfProjGeoKeyDirectoryTagVLR(data);
+    case 34736
+        vlr = LasfProjGeoDoubleParamsTagVLR(data);
+    case 34737
+        vlr = LasfProjGeoAsciiParamsTagVLR(data);
+    otherwise
+        vlr = LasUnknownVlr(data);
 end
 end
Index: Damkjer/Util/FileIO/LasFile/lasfSpecVlrFactory.m
===================================================================
--- Damkjer/Util/FileIO/LasFile/lasfSpecVlrFactory.m	(revision 7)
+++ Damkjer/Util/FileIO/LasFile/lasfSpecVlrFactory.m	(revision 0)
@@ -1,63 +1,24 @@
-% lasfSpecVlrFactory   Concrete factory for LAS File Specification VLR objects
+% LasfProjGeoAsciiParamsTagVLR
 %
-% File:
-%    lasfSpecVlrFactory.m
+% File:  LasfProjGeoAsciiParamsTagVLR.m
 %
-% Description:
-%    This MATLAB function provides an interface similar to a concrete factory
-%    in the abstract factory design pattern for constructing defined LAS File
-%    Specification VLR objects.
+% Description: This MATLAB class represents an ASPRS LAS version 1.2
+%              LASF Projection GeoAsciiParamsTag variable length record.
 %
-% Limitations:
-%    LasfSpecHistogramVLR and LasfSpecTextAreaVLR are currently undefined.
-%
-% Synopsis:
-%    [vlr] = lasfSpecVlrFactory(vlrHeader)
-%
-% Inputs:
-%    vlrHeader  - A LAS VLR object containing populated header data
-%
-% Outputs:
-%    vlr  - A specialized LAS File VLR Specification object
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    LasVlr.m
-%    LasfSpecClassification.m
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    http://asprs.org/a/society/committees/standards/asprs_las_format_v12.pdf
-%
-% See Also:
-%    LasFile
-%    LasVlr
-%    lasVlrFactory
-%    LasfSpecClassificationVLR
-%
-
 % Software History:
 %    2012-AUG-29   K. Damkjer
 %       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
 %
 
-function [vlr] = lasfSpecVlrFactory(vlrHeader)
-switch vlrHeader.recordID
+function [vlr] = lasfSpecVlrFactory(recordID, data)
+switch recordID
     case 0
-        vlr = LasfSpecClassificationVLR(vlrHeader.data);
+        vlr = LasfSpecClassificationVLR(data);
     case 2
-        vlr = LasfSpecHistogramVLR(vlrHeader.data);
+        vlr = LasfSpecHistogramVLR(data);
     case 3
-        vlr = LasfSpecTextAreaVLR(vlrHeader.data);
+        vlr = LasfSpecTextAreaVLR(data);
     otherwise
-      disp(vlrHeader.userID);
-      disp(vlrHeader.recordID);
-      disp(vlrHeader.description);
+        vlr = LasUnknownVlr(data);
 end
 end
Index: Damkjer/Util/FileIO/PlyFile/readPly.m
===================================================================
--- Damkjer/Util/FileIO/PlyFile/readPly.m	(revision 6)
+++ Damkjer/Util/FileIO/PlyFile/readPly.m	(revision 0)
@@ -287,9 +287,7 @@
         propnames=fieldnames(element);
 
-        msg=['Loading element ' num2str(ielem) ' of '...
-             num2str(length(elemnames)) ' '];
+        msg=['Loading element ' ielem ' of ' length(elemnames)];
         tstart=tic;
-        h = timebar(1, length(elemnames), msg, tstart);
-        tic;
+        h = timebar(1, elements, msg, tstart);
 
         if (element.hasListProp)
Index: mkjer/Util/LPt.cc
===================================================================
--- Damkjer/Util/LPt.cc	(revision 16)
+++ 	(revision )
@@ -1,11 +1,0 @@
-#include "LPt.h"
-
-
-LPt::LPt(void)
-{
-}
-
-
-LPt::~LPt(void)
-{
-}
Index: mkjer/Util/LPt.h
===================================================================
--- Damkjer/Util/LPt.h	(revision 16)
+++ 	(revision )
@@ -1,57 +1,0 @@
-//****************************************************************************
-// FILE:        SplayTree.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The interface definition for splay trees.
-//<
-//
-// LIMITATIONS:
-//>   This class template file follows the template inclusion pattern. This
-//    header file should be the only file included by clients wishing to
-//    instantiate a VpTree specialization.
-//<
-//
-// SOFTWARE HISTORY:
-//
-//> 2013-DEC-02  K. Damkjer
-//               Initial Coding.
-//<
-//****************************************************************************
-#ifndef Damkjer_SplayTree_HEADER
-#define Damkjer_SplayTree_HEADER
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// CLASS: LPt
-//>   A LiDAR point type.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename T>
-class LPt
-{
-public:
-   typedef T value_type;
-   typedef T& reference;
-   typedef const T& const_reference;
-   typedef T* iterator;
-   // const_iterator;
-   // differe
-
-   LPt();
-
-   LPt(const LPt&);
-
-   virtual ~LPt(void);
-
-
-};
-
-}
-
-#endif
Index: Damkjer/Util/MATLAB/ClassHandle.cpp
===================================================================
--- Damkjer/Util/MATLAB/ClassHandle.cpp	(revision 0)
+++ Damkjer/Util/MATLAB/ClassHandle.cpp	(revision 0)
@@ -0,0 +1,39 @@
+#include "ClassHandle.h"
+
+#include <typeinfo>
+
+#include "mex.h"
+
+#define CLASS_HANDLE_SIGNATURE 0xfacade01
+
+//*************************************************************************
+// ClassHandle::ClassHandle
+//*************************************************************************
+template<typename BASE>
+inline ClassHandle<BASE>::ClassHandle(BASE* pointer)
+   : thePointer(pointer)
+   , theName(typeid(BASE).name())
+   , theSignature(CLASS_HANDLE_SIGNATURE)
+{
+}
+
+//*************************************************************************
+// ClassHandle::~ClassHandle
+//*************************************************************************
+template<typename BASE>
+inline ClassHandle<BASE>::~ClassHandle()
+{
+   delete thePointer;
+   thePointer = 0;
+   theSignature = 0;
+}
+
+//*************************************************************************
+// ClassHandle::isValid
+//*************************************************************************
+template<typename BASE>
+inline bool ClassHandle<BASE>::isValid() const
+{
+   return (theSignature == CLASS_HANDLE_SIGNATURE &&
+           theName == typeid(BASE).name());
+}
Index: Damkjer/Util/MATLAB/ClassHandle.h
===================================================================
--- Damkjer/Util/MATLAB/ClassHandle.h	(revision 13)
+++ Damkjer/Util/MATLAB/ClassHandle.h	(revision 0)
@@ -1,208 +1,142 @@
-//*****************************************************************************
+//*************************************************************************
 // FILE:        ClassHandle.h
 //
-//    Copyright (C)  2012 Kristian L. Damkjer.
+//    Copyright (C)  2012 Kristian Damkjer.
 //
-// DESCRIPTION:
-//>   The interface definition for C++ class handle objects.
-//<
+// DESCRIPTION: This class is intended to be used to wrap C++ objects for
+//              transport across mex function calls in MATLAB.
 //
-// LIMITATIONS:
-//>   No known limitations.
-//<
+// LIMITATIONS: To preserve the lifetime guarantees of the pointer, default
+//              construction, copy construction and assignment are
+//              explicitly disallowed.
+//
+//              The class handle owns the pointer it contains. Thus, when
+//              the class handle is destroyed, the pointer is deleted.
+//
+//              Class handles are forced to be allocated on the heap by
+//              using the named constructor idiom. Class handles should be
+//              destroyed using the destroyHandleTo template function.
 //
 // SOFTWARE HISTORY:
 //> 2012-OCT-08  K. Damkjer
 //               Initial Coding.
-//  2013-JUN-24  K. Damkjer
-//               Clarified Error ID.
 //<
-//*****************************************************************************
-#ifndef Damkjer_ClassHandle_HEADER
-#define Damkjer_ClassHandle_HEADER
+//*************************************************************************
+#ifndef ClassHandle_HEADER
+#define ClassHandle_HEADER
 
-#include <typeinfo>   // USES the typeid operator
-#include <string>     // HASA std::string data member
-
-//***
-// Fix "wide char" definition for older versions of MATLAB. This must be placed
-// after other includes and before the MathWorks includes.
-//***
-#if (defined(MATLAB_MAJOR) && defined(MATLAB_MINOR))
-   #if MATLAB_MAJOR <= 7 && MATLAB_MINOR <= 10 && defined(_CHAR16T)
-      #define CHAR16_T
+#ifndef EXPORT
+   #if defined(MAKE_DEPENDING) || defined(TEMPLATE_INCLUSION)
+      #define EXPORT
+   #else
+      #define EXPORT export
    #endif
 #endif
 
-#include <tmwtypes.h> // USES MathWorks types
-#include "matrix.h"   // HASA mxArray interface, USES matrix interfaces
-#include "mex.h"      // USES MEX error interfaces, mexLock and mexUnlock
+#include <string>
 
-namespace Damkjer
-{
-//*****************************************************************************
-// CLASS: ClassHandle
-//>   A C++ object wrapper to enable object persistence across MEX function
-//    calls in MATLAB.
-//
-//    This class implements an encapsulation scheme to wrap an object in a
-//    generic handle container that's allocated on the heap. This container is
-//    then reinterpreted as a MATLAB memory-managed matrix for safe transport
-//    between MEX function calls. The general scheme was developed through
-//    collaboration on the MathWorks forums:
-//
-//    http://www.mathworks.com/matlabcentral/newsreader/view_thread/278243
-//
-//    @note
-//    Default construction, copy construction and assignment are explicitly
-//    disallowed to preserve the lifetime guarantees of the pointer.
-//    ClassHandle owns the pointer it contains. Thus, when the ClassHandle is
-//    destroyed, the pointer is deleted to free the resources for the wrapped
-//    object. ClassHandle objects are encouraged to be allocated on the heap
-//    via ClassHandle::createHandle by using the named constructor idiom. From
-//    a MEX source file, the ClassHandle objects should be destroyed using the
-//    ClassHandle::destroyHandle method.
-//
-//    @tparam ObjectT The wrapped object type.
-//<
-//*****************************************************************************
-template<typename ObjectT>
+#ifdef _CHAR16T
+#define CHAR16_T
+#endif
+
+#include "mex.h"
+
+template<typename BASE>
+mxArray* ptrAsMat(BASE*);
+
+template<typename BASE>
 class ClassHandle
 {
 public:
    ~ClassHandle();
-      //> Destroy the ClassHandle object and perform clean-up activities.
-      //<
-   
-   ObjectT& object() const { return *thePointer; }
-      //> Return the object encapsulated by the ClassHandle.
-      //
-      //  @tparam ObjectT The wrapped object type.
-      //  @return         A reference to the base class object.
-      //<
+
+   const BASE& obj() const { return *thePointer; }
    
    bool isValid() const;
-      //> Perform a validity check on the ClassHandle object.
-      //<
 
-   static mxArray* createHandle(ObjectT*);
-      //> Create a MathWorks index handle to the argument.
-      //<
-
-   static ObjectT& handleReference(const mxArray*);
-      //> Reinterpret a MathWorks index as a C++ object reference.
-      //<
-
-   static void destroyHandle(const mxArray*);
-      //> Free resources for the handle object represented by the MathWorks
-      //  index.
-      //<
+   friend mxArray* ptrAsMat<BASE>(BASE*);
 
 private:
+   // We want to force objects to be created using the ptrAsMat named
+   // constructor idiom. This also forces ClassHandles to be allocated on
+   // the heap instead of on the stack.
+   ClassHandle(BASE*);
 
-//   typedef typename ClassHandle<ObjectT> HandleT;
-   typedef ClassHandle<ObjectT> HandleT;
-      //> Shortcut reference to this class type.
-      //<
+   // Explicitly disable "default" constructors.
+   ClassHandle();
+   ClassHandle(const ClassHandle<BASE>&);
+   ClassHandle<BASE>& operator=(const ClassHandle<BASE>&);
 
-   ClassHandle();
-      //> Explicitly disable the compiler-generated default constructor. No
-      //  definition provided.
-      //<
-
-   ClassHandle(const ClassHandle<ObjectT>&);
-      //> Explicitly disable the compiler-generated copy constructor. No
-      //  definition provided.
-      //<
-
-   ClassHandle<ObjectT>& operator=(const ClassHandle<ObjectT>&);
-      //> Explicitly disable the compiler-generated assignment operator. No
-      //  definition provided.
-      //
-      //  @return The updated left-hand side when not disabled.
-      //<
-
-   ClassHandle(ObjectT*);
-      //> Initialize a ClassHandle with a pointer to an ObjectT object.
-      //<
-
-   ObjectT* thePointer;
-      //> The pointer to the encapsulated object.
-      //<
-   
-   std::string theSignature;
-      //> The file signature. Used for validation.
-      //<
+   BASE* thePointer;
+   std::string theName;
+   uint32_T theSignature;
 };
 
-//*****************************************************************************
-// ClassHandle::~ClassHandle
-//>   Destroy the ClassHandle object and perform clean-up activities.
-//
-//    Free resources for the ClassHandle object and invoke mexUnock to allow
-//    calling MEX files to be cleared after memory management tasks have
-//    completed.
-//
-//    @tparam ObjectT The wrapped object type.
-//<
-//*****************************************************************************
-template<typename ObjectT>
-inline
-ClassHandle<ObjectT>::~ClassHandle()
+//*************************************************************************
+// Function: ptrAsMat
+//*************************************************************************
+template<typename BASE>
+mxArray* ptrAsMat(BASE* ptr)
 {
-   delete thePointer;
-   thePointer = 0;
-
-   mexUnlock();
+   mxArray* mat = mxCreateNumericMatrix(1, 1, mxINDEX_CLASS, mxREAL);
+   *((mwIndex*)mxGetData(mat)) =
+                     reinterpret_cast<mwIndex>(new ClassHandle<BASE>(ptr));
+   return mat;
 }
 
-//*****************************************************************************
-// ClassHandle::isValid()
-//>   Perform a validity check on the ClassHandle object.
-//
-//    This method returns true if and only if the ClassHandle object passes
-//    validity checks. This method prevents the arbitrary reinterpretation of
-//    non-ClassWHandle objects.
-//
-//    @tparam  ObjectT The wrapped object type.
-//    @returns         true if and only if the ClassHandle object passes
-//                     validity checks.
-//<
-//*****************************************************************************
-template<typename ObjectT>
-inline
-bool
-ClassHandle<ObjectT>::isValid() const
+//*************************************************************************
+// FUNCTION: matAsObj
+//*************************************************************************
+template<typename BASE>
+const BASE& matAsObj(const mxArray* mat)
 {
-   return (theSignature == typeid(ObjectT).name());
+   if (mxGetNumberOfElements(mat) != 1    ||
+       mxGetClassID(mat) != mxINDEX_CLASS ||
+       mxIsComplex(mat))
+   {
+      mexErrMsgIdAndTxt("Damkjer:matAsPtr:invalidHandle",
+                          "Input must be real-valued index-class scalar.");
+   }
+   
+   ClassHandle<BASE>* handle =
+         reinterpret_cast<ClassHandle<BASE>*>(*((mwIndex*)mxGetData(mat)));
+
+   if (!(handle->isValid()))
+   {
+      mexErrMsgIdAndTxt("Damkjer:matAsPtr:invalidHandle",
+                        "Handle not valid.");
+   }
+
+   return handle->obj();
 }
 
-//*****************************************************************************
-// ClassHandle::ClassHandle(ObjectT* const)
-//>   Initialize a ClassHandle with a pointer to an ObjectT object.
-//
-//    This constructor is private to force objects to be created using the
-//    ptrAsMat named constructor idiom. This also forces ClassHandles to be
-//    allocated on the heap instead of on the stack. This method is responsible
-//    for invoking mexLock to prevent MATLAB from arbitrarily clearing memory
-//    managed by the wrapper.
-//
-//    @tparam ObjectT  The wrapped object type.
-//    @param  aPointer A pointer to an object to be wrapped with a ClassHandle.
-//<
-//*****************************************************************************
-template<typename ObjectT>
-inline
-ClassHandle<ObjectT>::ClassHandle(ObjectT* aPointer)
-   : thePointer(aPointer)
-   , theSignature(typeid(ObjectT).name())
+//*************************************************************************
+// FUNCTION: destroyHandleTo
+//*************************************************************************
+template<typename BASE>
+void destroyHandleTo(const mxArray* mat)
 {
-   mexLock();
+   if (mxGetNumberOfElements(mat) != 1    ||
+       mxGetClassID(mat) != mxINDEX_CLASS ||
+       mxIsComplex(mat))
+   {
+      mexErrMsgIdAndTxt("Damkjer:matAsPtr:invalidHandle",
+                          "Input must be real-valued index-class scalar.");
+   }
+   
+   ClassHandle<BASE>* handle =
+         reinterpret_cast<ClassHandle<BASE>*>(*((mwIndex*)mxGetData(mat)));
+
+   if (!(handle->isValid()))
+   {
+      mexErrMsgIdAndTxt("Damkjer:matAsPtr:invalidHandle",
+                        "Handle not valid.");
+   }
+
+   delete handle;
 }
 
-}
-
-#if MAKE_DEPENDING || TEMPLATE_INCLUSION
-#include "ClassHandle.hpp"
+#if defined(MAKE_DEPENDING) || defined(TEMPLATE_INCLUSION)
+#include "ClassHandle.cpp"
 #endif
 
Index: mkjer/Util/MATLAB/ClassHandle.hpp
===================================================================
--- Damkjer/Util/MATLAB/ClassHandle.hpp	(revision 13)
+++ 	(revision )
@@ -1,135 +1,0 @@
-//****************************************************************************
-// FILE:        ClassHandle.hpp
-//
-//    Copyright (C)  2012 Kristian L. Damkjer.
-//
-// DESCRIPTION:
-//>   The template implementation for C++ class handle objects.
-//<
-//
-// LIMITATIONS:
-//>   No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-OCT-08  K. Damkjer
-//               Initial Coding.
-//  2013-JUN-24  K. Damkjer
-//               Clarified Error ID.
-//<
-//*****************************************************************************
-
-#include "ClassHandle.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// ClassHandle::createHandle(ObjectT* const)
-//>   Create a MathWorks index handle to the argument.
-//
-//    Safely encapsulate a pointer to a C++ object as a MathWorks matrix for
-//    persistence between MEX function calls.
-//
-//    @note
-//    This function is a named constructor for ClassHandle objects.
-//
-//    @tparam ObjectT  The wrapped object type.
-//    @param  aPointer A pointer to an object to be wrapped with a
-//                     ClassHandle.
-//    @returns         A pointer to a MATLAB matrix object holding the pointer
-//                     to the wrapped object handle encoded as an a MathWorks
-//                     index value.
-//<
-//*****************************************************************************
-template<typename ObjectT>
-mxArray*
-ClassHandle<ObjectT>::createHandle(ObjectT* aPointer)
-{
-   mxArray* aMatrix = mxCreateNumericMatrix(1, 1, mxINDEX_CLASS, mxREAL);
-
-   *(static_cast<mwIndex*>(mxGetData(aMatrix))) =
-      reinterpret_cast<mwIndex>(new HandleT(aPointer));
-
-   return aMatrix;
-}
-
-//*****************************************************************************
-// ClassHandle::object(const mxArray* const)
-//>   Reinterpret a MathWorks index as a C++ object reference.
-//
-//    @tparam ObjectT The wrapped object type.
-//    @param  aMatrix A MathWorks matrix containing a single index value to be
-//                    reinterpretted as a reference to an object of type
-//                    ObjectT.
-//    @returns        A reference the wrapped object of type ObjectT.
-//<
-//*****************************************************************************
-template<typename ObjectT>
-ObjectT&
-ClassHandle<ObjectT>::handleReference(const mxArray* aMatrix)
-{
-   if (mxGetNumberOfElements(aMatrix) != 1    ||
-       mxGetClassID(aMatrix) != mxINDEX_CLASS ||
-       mxIsComplex(aMatrix))
-   {
-      mexErrMsgIdAndTxt("Damkjer:matAsObj:invalidHandle",
-                        "Input must be real-valued index-class scalar.");
-   }
-
-   HandleT* handle =
-      reinterpret_cast<HandleT*>(*(static_cast<mwIndex*>(mxGetData(aMatrix))));
-
-   if (handle == 0 || !handle->isValid())
-   {
-      mexErrMsgIdAndTxt("Damkjer:matAsObj:invalidHandle",
-                        "Handle not valid.");
-   }
-
-   return handle->object();
-}
-
-//*****************************************************************************
-// ClassHandle::destroyHandle(const mxArray*)
-//>   Free resources for the handle object represented by the MathWorks index.
-//
-//    @note
-//    The mxArray argument is intentionally a non-const pointer to a const
-//    mxArray. This signature matches the expected signature for handles passed
-//    through the MEX gateway function (mexFunction) on the right-hand side. It
-//    is very important that the right-hand side arrays be treated as const and
-//    that the memory not be explicitly cleared here. MATLAB will destruct and
-//    deallocate the mxArrays when the MEX file is cleared.
-//
-//    @tparam ObjectT The wrapped object type.
-//    @param  aMatrix A MathWorks matrix containing a single index value to be
-//                    reinterpretted as a reference to an object of type
-//                    ObjectT.
-//<
-//*****************************************************************************
-template<typename ObjectT>
-void
-ClassHandle<ObjectT>::destroyHandle(const mxArray* aMatrix)
-{
-   if (mxGetNumberOfElements(aMatrix) != 1    ||
-       mxGetClassID(aMatrix) != mxINDEX_CLASS ||
-       mxIsComplex(aMatrix))
-   {
-      mexErrMsgIdAndTxt("Damkjer:destroyHandleTo:invalidHandle",
-                        "Input must be real-valued index-class scalar.");
-   }
-
-   HandleT* handle =
-      reinterpret_cast<HandleT*>(*(static_cast<mwIndex*>(mxGetData(aMatrix))));
-
-   if (handle == 0 || !handle->isValid())
-   {
-      mexErrMsgIdAndTxt("Damkjer:destroyHandleTo:invalidHandle",
-                        "Handle not valid.");
-   }
-
-   delete handle;
-   handle = 0;
-}
-
-}
Index: mkjer/Util/MATLAB/SplayTree.m
===================================================================
--- Damkjer/Util/MATLAB/SplayTree.m	(revision 14)
+++ 	(revision )
@@ -1,193 +1,0 @@
-% SplayTree   Splay Tree indexed search data structure
-%
-% File: SearchTree.m
-%
-% Description:
-%    This MATLAB class represents a splay tree data structure. The
-%    class is derived from the MATLAB handle class to provide automated object
-%    descruction on calls to "clear".
-%
-% Limitations:
-%    See SplayTree.h for complete description of limitations.
-%
-% Properties:
-%    None.
-%
-% Methods:
-%        [tree] = SplayTree(varargin)              - VP Tree Constructor
-%                 delete(tree)                     - Release this object and
-%                                                    free memory.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    None.
-%
-% Data requirements:
-%    SplayTreeAPI MEX library.
-%
-% References:
-%    Put the Splay Tree paper reference here. If the line wraps (which it
-%       probably will), then indent the subsequent lines.
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2012 Kristian L. Damkjer.
-%
-% Software History:
-%    2013-DEC-28   K. Damkjer
-%       Initial Coding.
-%
-
-%******************************************************************************
-% CLASS: SplayTree
-%    Splay Tree indexed search data structure. The class is derived
-%    from the MATLAB handle class to provide automated object descruction on
-%    calls to "clear".
-%******************************************************************************
-classdef (Sealed = true) SplayTree < handle
-  
-   properties (Hidden=true, Access = private)
-      % The C++ Splay-tree object owned by this handle class.
-      theTree
-   end
-   
-   methods
-      %************************************************************************
-      % SplayTree/SplayTree
-      %************************************************************************
-      function this = SplayTree(weights, elems)
-         % Build the index structure for the database.
-         %
-         % Parameters:
-         %    varargin - Variable-length input argument list. Currently, only a
-         %               single argument is permitted in the argument list.
-         %               Specifically, a set of point observations that will be
-         %               spatially indexed by the tree structure.
-         
-         if (nargin ~= 2)
-            error('SplayTree:InvalidArgumentList',...
-                  'SplayTree must be constructed with a set of indexes');
-         end
-
-         this.theTree = SplayTreeAPI('create', weights, uint64(elems));
-      end
-
-      %************************************************************************
-      % SplayTree/delete
-      %************************************************************************
-      function delete(this)
-         % This function frees memory on delete (clear) of the SplayTree.
-         SplayTreeAPI('destroy', this.theTree);
-      end
-      
-      %************************************************************************
-      % VpTree/pop_head
-      %************************************************************************
-      function [wgt,idx] = pop_head(this)
-         % Perform a k-nearest neighbor search on the database with the
-         % set of queries.
-         %
-         % Parameters:
-         %
-         % Returns:
-         %
-         
-         [wgt,idx] = SplayTreeAPI('pop_head', this.theTree);
-      end
-
-      %************************************************************************
-      % VpTree/head
-      %************************************************************************
-      function [wgt,idx] = head(this)
-         % Perform a k-nearest neighbor search on the database with the
-         % set of queries.
-         %
-         % Parameters:
-         %
-         % Returns:
-         %
-         
-         [wgt,idx] = SplayTreeAPI('head', this.theTree);
-      end
-      
-      %************************************************************************
-      % VpTree/insert
-      %************************************************************************
-      function insert(this, weights, elems)
-         % Perform a k-nearest neighbor search on the database with the
-         % set of queries.
-         %
-         % Parameters:
-         %
-         % Returns:
-         %
-         
-         SplayTreeAPI('insert', this.theTree, weights, elems);
-      end
-      
-      %************************************************************************
-      % VpTree/update
-      %************************************************************************
-      function update(this, weights, elems)
-         % Perform a k-nearest neighbor search on the database with the
-         % set of queries.
-         %
-         % Parameters:
-         %
-         % Returns:
-         %
-         
-         SplayTreeAPI('update', this.theTree, weights, elems);
-      end
-      
-      %************************************************************************
-      % VpTree/erase
-      %************************************************************************
-      function erase(this, weights, elems)
-         % Perform a k-nearest neighbor search on the database with the
-         % set of queries.
-         %
-         % Parameters:
-         %
-         % Returns:
-         %
-         
-         SplayTreeAPI('erase', this.theTree, weights, elems);
-      end
-      
-      %************************************************************************
-      % VpTree/erase_index
-      %************************************************************************
-      function erase_index(this, elems)
-         % Perform a k-nearest neighbor search on the database with the
-         % set of queries.
-         %
-         % Parameters:
-         %
-         % Returns:
-         %
-         
-         SplayTreeAPI('erase_index', this.theTree, elems);
-      end
-      
-      %************************************************************************
-      % VpTree/size
-      %************************************************************************
-      function [tree_size] = size(this)
-         % Perform a k-nearest neighbor search on the database with the
-         % set of queries.
-         %
-         % Parameters:
-         %
-         % Returns:
-         %
-         
-         [tree_size] = SplayTreeAPI('size', this.theTree);
-      end
-   end
-end
-
Index: mkjer/Util/MATLAB/SplayTreeAPI/SplayTreeAPI.cpp
===================================================================
--- Damkjer/Util/MATLAB/SplayTreeAPI/SplayTreeAPI.cpp	(revision 14)
+++ 	(revision )
@@ -1,778 +1,0 @@
-//*****************************************************************************
-// FILE:        SplayTreeAPI.cpp
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The application interface for working with VP Trees in MATLAB.
-//<
-//
-// LIMITATIONS:
-//>   All interfaces to the VP Tree objects from MATLAB must be routed through
-//    this gateway file. This interface is required until and unless MATLAB
-//    provides a mechanism for modifying locks on MEX files other than the
-//    current file.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2013-DEC-13  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#if _OPENMP
-#include <omp.h>
-#endif
-
-#include "Util/MATLAB/ClassHandle.h"
-#include "Util/Dictionaries/SplayTree.h"                  // USES 
-
-#include <vector>
-#include <deque>
-#include <utility>
-#include <sstream>
-
-//***
-// Fix "wide char" definition for older versions of MATLAB. This must be placed
-// after other includes and before the mex.h include.
-//***
-#if (defined(MATLAB_MAJOR) && defined(MATLAB_MINOR))
-   #if MATLAB_MAJOR <= 7 && MATLAB_MINOR <= 10 && defined(_CHAR16T)
-      #define CHAR16_T
-   #endif
-#endif
-
-#include "mex.h"
-
-//*****************************************************************************
-// NAMESPACE:
-//>   Splay Tree MEX API types, interfaces, and implementations.
-//<
-//*****************************************************************************
-namespace
-{
-
-typedef double WeightT;
-   //> The MATLAB SplayTree weight (key) type.
-
-typedef std::deque<WeightT> WeightSetT;
-   //> The MATLAB SplayTree weight set type.
-   //<
-
-typedef std::pair<WeightT, mwSize> WeightedPointT;
-   //> The MATLAB SplayTree weighted point type.
-   //<
-
-typedef std::deque<WeightedPointT> WeightedPointSetT;
-   //> The MATLAB SplayTree weighted point set type.
-   //<
-
-typedef Damkjer::SplayTree<WeightedPointT> TreeT;
-   //> The MATLAB SplayTree type.
-   //<
-
-typedef Damkjer::ClassHandle<TreeT> HandleT;
-   //> The SplayTree MATLAB Class Handle type.
-   //<
-
-//*****************************************************************************
-// FUNCTION: splayTreeCreate
-//>   Create a SplayTree for use in MATLAB.
-//
-//    New objects are wrapped by the ClassHandle template to ensure that locks
-//    are managed correctly to avoid double frees of memory managed by this
-//    class, to ensure objects have a life span separate from this function's
-//    scope, and to provide convenience methods for passing the pointer to the
-//    object between MATLAB and C++.
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-splayTreeCreate(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs < 3 || nrhs > 3)
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeCreate:nargin",
-                        "The splayTreeCreate function requires a two inputs.");
-   }
-   
-   if (nlhs > 1)
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeCreate:nargout",
-                        "The splayTreeCreate function requires a single output.");
-   }
-
-   //***
-   // The two inputs required by splayTreeErase is the collection of indices
-   // and the collection of weights.
-   //***
-   const mxArray* weights=prhs[1];
-   const mxArray* indices=prhs[2];
-   
-   // Check to make sure that weights are real-valued numerics
-   if (mxIsSparse(indices) ||
-       mxGetNumberOfDimensions(indices) != 2 ||
-       mxIsComplex(indices) ||
-       !mxIsNumeric(indices))
-   {
-      std::stringstream msg;
-      msg << ((mxIsSparse(indices)) ? "" : "not ") << "sparse, "
-          << (mxGetNumberOfDimensions(indices)) << "-dimensions, "
-          << ((mxIsComplex(indices)) ? "" : "not ") << "complex, "
-          << ((mxIsNumeric(indices)) ? "" : "not ") << "numeric, "
-          << "Index input to splayTreeInsert must be a full vector "
-             "of real-valued data representing point indices.";
-      mexErrMsgIdAndTxt("Damkjer:splayTreeInsert:prhs",
-                        msg.str().c_str());
-   }
-
-   // Check to make sure that weights are real-valued numerics
-   if (mxIsSparse(weights) ||
-       mxGetNumberOfDimensions(weights) != 2 ||
-       mxIsComplex(weights) ||
-       !mxIsNumeric(weights))
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeInsert:prhs",
-                        "Weight input to splayTreeInsert must be a full vector "
-                        "of real-valued data representing point significance.");
-   }
-
-   // Attempt to make the Splay Tree.
-   const mwSize iElems = mxGetN(indices);
-   const mwSize wElems = mxGetN(weights);
-
-   // Check to make sure that weights are real-valued numerics
-   if (iElems != wElems)
-   {
-      std::stringstream msg;
-      msg << "Index elements : " << iElems << "\n"
-          << "Weight elements: " << wElems << "\n" 
-          << "Must provide exactly one weight for each index.";
-      mexErrMsgIdAndTxt("Damkjer:splayTreeInsert:prhs",
-                        msg.str().c_str());
-   }
-
-   mwIndex* iData = (mwIndex*)mxGetData(indices);
-   double*  wData = mxGetPr(weights);
-
-   TreeT* returnTree = new TreeT();
-
-//   for (mwSize elem = iElems; elem --> 0;)
-   for (mwSize elem = 0; elem < iElems; ++elem)
-   {
-      returnTree->insert((WeightedPointT)std::make_pair(wData[elem],
-                                                        iData[elem]));
-   }
-   
-   //***
-   // Use the ClassHandle named constructor to provide a handle to the new
-   // Splay Tree object.
-   //***
-   try
-   {
-      plhs[0] = HandleT::createHandle(returnTree);
-   }
-   catch (const std::exception& e)
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeCreate:initError", e.what());
-   }
-}
-
-//*****************************************************************************
-// FUNCTION: splayTreeDestroy
-//>   Destroy the SplayTree referenced by a ClassHandle object.
-//
-//    Destroying objects through the ClassHandle wrapper ensures memory leaks
-//    are not introduced through this MEX function and allows the MEX library
-//    to be unlocked once all objects have been destroyed and their memory
-//    returned to the system.
-//
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-inline
-void
-splayTreeDestroy(int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs != 2 || !mxIsNumeric(prhs[1]))
-   {
-       mexErrMsgIdAndTxt("Damkjer:splayTreeDestroy:varargin",
-                         "The splayTreeDestroy function requires a single "
-                         "input.");
-   }
-
-   // Free the Splay Tree through the ClassHandle named destructor.
-   HandleT::destroyHandle(prhs[1]);
-}
-
-//*****************************************************************************
-// FUNCTION: splayTreeHead
-//>   Find minumum element in splay tree.
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-splayTreeHead(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs != 2 || !mxIsNumeric(prhs[1]))
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeHead:nargin",
-                        "The splayTreeHead function requires a single input.");
-   }
-
-   if (nlhs != 2)
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeHead:nargout",
-                        "The splayTreeHead function requires two outputs.");
-   }
-
-   // Retrieve the tree object through the ClassHandle helper method.
-   TreeT& tree = HandleT::handleReference(prhs[1]);
-
-   const WeightedPointT& head=tree.head();
-
-   plhs[0]=mxCreateNumericMatrix(1, 1, mxDOUBLE_CLASS, mxREAL);
-   double* weight = (double*) mxGetData(plhs[0]);
-   weight[0] = head.first;
-
-   plhs[1]=mxCreateNumericMatrix(1, 1, mxINDEX_CLASS, mxREAL);
-   mwSize* index = (mwSize*) mxGetData(plhs[1]);
-   index[0] = head.second;
-}
-
-//*****************************************************************************
-// FUNCTION: splayTreePopHead
-//>   Find minumum element in splay tree.
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-splayTreePopHead(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs != 2 || !mxIsNumeric(prhs[1]))
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreePopHead:nargin",
-                        "The splayTreePopHead function requires a single input.");
-   }
-
-   if (nlhs != 2)
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreePopHead:nargout",
-                        "The splayTreePopHead function requires two outputs.");
-   }
-
-   // Retrieve the tree object through the ClassHandle helper method.
-   TreeT& tree = HandleT::handleReference(prhs[1]);
-
-   const WeightedPointT& head=tree.head();
-
-   plhs[0]=mxCreateNumericMatrix(1, 1, mxDOUBLE_CLASS, mxREAL);
-   double* weight = (double*) mxGetData(plhs[0]);
-   weight[0] = head.first;
-
-   plhs[1]=mxCreateNumericMatrix(1, 1, mxINDEX_CLASS, mxREAL);
-   std::size_t* index = (std::size_t*) mxGetData(plhs[1]);
-   index[0] = head.second;
-
-//   tree.erase(head);
-   tree.eraseIndex(head.second);
-   
-//    if (tree.find(head) != 0)
-//    {
-//       mexErrMsgIdAndTxt("Damkjer:splayTreePopHead:nargout",
-//                         "Pop failed.");
-//    }
-}
-
-//*****************************************************************************
-// FUNCTION: splayTreeInsert
-//>   Find minumum element in splay tree.
-//
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-splayTreeInsert(int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs != 4 || !mxIsNumeric(prhs[1]))
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeInsert:nargin",
-                        "The splayTreeInsert function requires three inputs.");
-   }
-
-   // Retrieve the tree object through the ClassHandle helper method.
-   TreeT& tree = HandleT::handleReference(prhs[1]);
-  
-   //***
-   // The two inputs required by splayTreeErase is the collection of indices
-   // and the collection of weights.
-   //***
-   const mxArray* weights=prhs[2];
-   const mxArray* indices=prhs[3];
-   
-   // Check to make sure that weights are real-valued numerics
-   if (mxIsSparse(indices) ||
-       mxGetNumberOfDimensions(indices) != 2 ||
-       mxIsComplex(indices) ||
-       !mxIsNumeric(indices))
-   {
-      std::stringstream msg;
-      msg << ((mxIsSparse(indices)) ? "" : "not ") << "sparse "
-          << (mxGetNumberOfDimensions(indices)) << " "
-          << ((mxIsComplex(indices)) ? "" : "not ") << "complex "
-          << ((mxIsNumeric(indices)) ? "" : "not ") << "numeric "
-          << "Index input to splayTreeInsert must be a full vector "
-             "of real-valued data representing point indices.";
-      mexErrMsgIdAndTxt("Damkjer:splayTreeInsert:prhs",
-                        msg.str().c_str());
-   }
-
-   // Check to make sure that weights are real-valued numerics
-   if (mxIsSparse(weights) ||
-       mxGetNumberOfDimensions(weights) != 2 ||
-       mxIsComplex(weights) ||
-       !mxIsNumeric(weights))
-   {
-      std::stringstream msg;
-      msg << ((mxIsSparse(weights)) ? "" : "not ") << "sparse "
-          << (mxGetNumberOfDimensions(weights)) << " "
-          << ((mxIsComplex(weights)) ? "" : "not ") << "complex "
-          << ((mxIsNumeric(weights)) ? "" : "not ") << "numeric "
-          << "Weight input to splayTreeInsert must be a full vector "
-                        "of real-valued data representing point significance.";
-      mexErrMsgIdAndTxt("Damkjer:splayTreeInsert:prhs",
-                        msg.str().c_str());
-   }
-
-   // Attempt to make the Splay Tree.
-   const mwSize iElems = mxGetN(indices);
-   const mwSize wElems = mxGetN(weights);
-
-   // Check to make sure that weights are real-valued numerics
-   if (iElems != wElems)
-   {
-      std::stringstream msg;
-      msg << "Index elements : " << mxGetM(indices) << "x" << iElems << "\n"
-          << "Weight elements: " << mxGetM(weights) << "x" << wElems << "\n" 
-          << "Must provide exactly one weight for each index.";
-      mexErrMsgIdAndTxt("Damkjer:splayTreeInsert:prhs",
-                        msg.str().c_str());
-   }
-
-   mwIndex* iData = (mwIndex*)mxGetData(indices);
-   double*  wData = mxGetPr(weights);
-
-   //***
-   // Selection of data structure for the point database is not arbitrary.
-   //
-   // 1. Point coordinates are passed in as double-precision values. Preserve
-   //    the data fidelity.
-   // 2. Individual points are often low-dimensional. Keep the coordinates for
-   //    a single point in contiguous memory by using a std::vector container.
-   // 3. The point database can be quite large. Since VP Tree is an online data
-   //    structure, allow references to points to occupy non-contiguous memory.
-   //    This also speeds construction and destruction of the point database.
-   //***
-//   WeightedPointSetT pointData(elems);
-   
-   for (mwSize elem = iElems; elem --> 0;)
-   {
-      tree.insert((WeightedPointT)std::make_pair(wData[elem], iData[elem]));
-   }
-}
-
-
-//*****************************************************************************
-// FUNCTION: splayTreeUpdate
-//>   Find minumum element in splay tree.
-//
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-splayTreeUpdate(int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs != 4 || !mxIsNumeric(prhs[1]))
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeInsert:nargin",
-                        "The splayTreeInsert function requires three inputs.");
-   }
-
-   // Retrieve the tree object through the ClassHandle helper method.
-   TreeT& tree = HandleT::handleReference(prhs[1]);
-  
-   //***
-   // The two inputs required by splayTreeErase is the collection of indices
-   // and the collection of weights.
-   //***
-   const mxArray* weights=prhs[2];
-   const mxArray* indices=prhs[3];
-   
-   // Check to make sure that weights are real-valued numerics
-   if (mxIsSparse(indices) ||
-       mxGetNumberOfDimensions(indices) != 2 ||
-       mxIsComplex(indices) ||
-       !mxIsNumeric(indices))
-   {
-      std::stringstream msg;
-      msg << ((mxIsSparse(indices)) ? "" : "not ") << "sparse "
-          << (mxGetNumberOfDimensions(indices)) << " "
-          << ((mxIsComplex(indices)) ? "" : "not ") << "complex "
-          << ((mxIsNumeric(indices)) ? "" : "not ") << "numeric "
-          << "Index input to splayTreeInsert must be a full vector "
-             "of real-valued data representing point indices.";
-      mexErrMsgIdAndTxt("Damkjer:splayTreeInsert:prhs",
-                        msg.str().c_str());
-   }
-
-   // Check to make sure that weights are real-valued numerics
-   if (mxIsSparse(weights) ||
-       mxGetNumberOfDimensions(weights) != 2 ||
-       mxIsComplex(weights) ||
-       !mxIsNumeric(weights))
-   {
-      std::stringstream msg;
-      msg << ((mxIsSparse(weights)) ? "" : "not ") << "sparse "
-          << (mxGetNumberOfDimensions(weights)) << " "
-          << ((mxIsComplex(weights)) ? "" : "not ") << "complex "
-          << ((mxIsNumeric(weights)) ? "" : "not ") << "numeric "
-          << "Weight input to splayTreeInsert must be a full vector "
-                        "of real-valued data representing point significance.";
-      mexErrMsgIdAndTxt("Damkjer:splayTreeInsert:prhs",
-                        msg.str().c_str());
-   }
-
-   // Attempt to make the Splay Tree.
-   const mwSize iElems = mxGetN(indices);
-   const mwSize wElems = mxGetN(weights);
-
-   // Check to make sure that weights are real-valued numerics
-   if (iElems != wElems)
-   {
-      std::stringstream msg;
-      msg << "Index elements : " << mxGetM(indices) << "x" << iElems << "\n"
-          << "Weight elements: " << mxGetM(weights) << "x" << wElems << "\n" 
-          << "Must provide exactly one weight for each index.";
-      mexErrMsgIdAndTxt("Damkjer:splayTreeInsert:prhs",
-                        msg.str().c_str());
-   }
-
-   mwIndex* iData = (mwIndex*)mxGetData(indices);
-   double*  wData = mxGetPr(weights);
-
-   //***
-   // Selection of data structure for the point database is not arbitrary.
-   //
-   // 1. Point coordinates are passed in as double-precision values. Preserve
-   //    the data fidelity.
-   // 2. Individual points are often low-dimensional. Keep the coordinates for
-   //    a single point in contiguous memory by using a std::vector container.
-   // 3. The point database can be quite large. Since VP Tree is an online data
-   //    structure, allow references to points to occupy non-contiguous memory.
-   //    This also speeds construction and destruction of the point database.
-   //***
-//   WeightedPointSetT pointData(elems);
-   
-   for (mwSize elem = iElems; elem --> 0;)
-   {
-      tree.update((WeightedPointT)std::make_pair(wData[elem], iData[elem]),
-                  iData[elem]);
-   }
-}
-
-//*****************************************************************************
-// FUNCTION: splayTreeErase
-//>   Find minumum element in splay tree.
-//
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-splayTreeErase(int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs != 4 || !mxIsNumeric(prhs[1]))
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeErase:nargin",
-                        "The splayTreeErase function requires three inputs.");
-   }
-
-   // Retrieve the tree object through the ClassHandle helper method.
-   TreeT& tree = HandleT::handleReference(prhs[1]);
-  
-   //***
-   // The two inputs required by splayTreeErase is the collection of indices
-   // and the collection of weights.
-   //***
-   const mxArray* weights=prhs[2];
-   const mxArray* indices=prhs[3];
-   
-   // Check to make sure that weights are real-valued numerics
-   if (mxIsSparse(indices) ||
-       mxGetNumberOfDimensions(indices) != 2 ||
-       mxIsComplex(indices) ||
-       !mxIsNumeric(indices))
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeErase:prhs",
-                        "Index input to splayTreeErase must be a full vector "
-                        "of real-valued data representing point significance.");
-   }
-
-   // Check to make sure that weights are real-valued numerics
-   if (mxIsSparse(weights) ||
-       mxGetNumberOfDimensions(weights) != 2 ||
-       mxIsComplex(weights) ||
-       !mxIsNumeric(weights))
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeErase:prhs",
-                        "Weight input to splayTreeErase must be a full vector "
-                        "of real-valued data representing point significance.");
-   }
-
-   // Attempt to make the Splay Tree.
-   const mwSize iElems = mxGetN(indices);
-   const mwSize wElems = mxGetN(weights);
-
-   // Check to make sure that weights are real-valued numerics
-   if (iElems != wElems)
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeErase:prhs",
-                        "Must provide exactly one weight for each index.");
-   }
-
-   mwIndex* iData = (mwIndex*)mxGetData(indices);
-   double*  wData = mxGetPr(weights);
-
-   //***
-   // Selection of data structure for the point database is not arbitrary.
-   //
-   // 1. Point coordinates are passed in as double-precision values. Preserve
-   //    the data fidelity.
-   // 2. Individual points are often low-dimensional. Keep the coordinates for
-   //    a single point in contiguous memory by using a std::vector container.
-   // 3. The point database can be quite large. Since VP Tree is an online data
-   //    structure, allow references to points to occupy non-contiguous memory.
-   //    This also speeds construction and destruction of the point database.
-   //***
-//   WeightedPointSetT pointData(elems);
-   
-   for (mwSize elem = iElems; elem --> 0;)
-   {
-      tree.erase((WeightedPointT)std::make_pair(wData[elem], iData[elem]));
-   }
-}
-
-//*****************************************************************************
-// FUNCTION: splayTreeEraseIndex
-//>   Find minumum element in splay tree.
-//
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-splayTreeEraseIndex(int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs != 3 || !mxIsNumeric(prhs[1]))
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeErase:nargin",
-                        "The splayTreeErase function requires two inputs.");
-   }
-
-   // Retrieve the tree object through the ClassHandle helper method.
-   TreeT& tree = HandleT::handleReference(prhs[1]);
-  
-   //***
-   // The two inputs required by splayTreeErase is the collection of indices
-   // and the collection of weights.
-   //***
-   const mxArray* indices=prhs[2];
-   
-   // Check to make sure that weights are real-valued numerics
-   if (mxIsSparse(indices) ||
-       mxGetNumberOfDimensions(indices) != 2 ||
-       mxIsComplex(indices) ||
-       !mxIsNumeric(indices))
-   {
-      mexErrMsgIdAndTxt("Damkjer:splayTreeErase:prhs",
-                        "Index input to splayTreeErase must be a full vector "
-                        "of real-valued data representing point significance.");
-   }
-
-   // Attempt to make the Splay Tree.
-   const mwSize iElems = mxGetN(indices);
-
-   mwIndex* iData = (mwIndex*)mxGetData(indices);
-
-   //***
-   // Selection of data structure for the point database is not arbitrary.
-   //
-   // 1. Point coordinates are passed in as double-precision values. Preserve
-   //    the data fidelity.
-   // 2. Individual points are often low-dimensional. Keep the coordinates for
-   //    a single point in contiguous memory by using a std::vector container.
-   // 3. The point database can be quite large. Since VP Tree is an online data
-   //    structure, allow references to points to occupy non-contiguous memory.
-   //    This also speeds construction and destruction of the point database.
-   //***
-//   WeightedPointSetT pointData(elems);
-   
-   for (mwSize elem = iElems; elem --> 0;)
-   {
-      tree.eraseIndex(iData[elem]);
-   }
-}
-
-}
-
-//*****************************************************************************
-// FUNCTION: mexFunction
-//>   The MATLAB Executable Gateway Function.
-//
-//    Provides the application interface for working with VP Trees in MATLAB.
-//    All functional interfaces are routed through this single function to
-//    ensure locks and memory management are handled properly by MATLAB.
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-mexFunction(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs)
-{
-   //***
-   // This MEX function should always have at least one input parameter to
-   // handle function dispatching through the MEX gateway.
-   //***
-   if (nrhs < 1)
-   {
-      mexErrMsgIdAndTxt("Damkjer:SplayTreeAPI:nargin",
-                        "SplayTreeAPI requires at least one input which "
-                        "specifies the operation to be performed.");
-   }
-
-   // The operation switch is simply a string.
-   char* operation = mxArrayToString(prhs[0]);
-   
-   if (!operation)
-   {
-      mexErrMsgIdAndTxt("Damkjer:SplayTreeAPI:InvalidOperation",
-                        "Invalid mode supplied to SplayTreeAPI.");
-      return; // error should force return.
-   }
-   
-   // Dispatch to helper functions. Err if operation is not recognized.
-   if (!strcmp("create", operation))
-   {
-      splayTreeCreate(nlhs, plhs, nrhs, prhs);
-   }
-   else if (!strcmp("destroy", operation))
-   {
-      if (nlhs != 0)
-      {
-      mexErrMsgIdAndTxt("Damkjer:SplayTreeAPI:nargout",
-                        "Nothing to return.");
-      }
-
-      splayTreeDestroy(nrhs, prhs);
-   }
-   else if (!strcmp("head", operation))
-   {
-      splayTreeHead(nlhs, plhs, nrhs, prhs);
-   }
-   else if (!strcmp("pop_head", operation))
-   {
-      splayTreePopHead(nlhs, plhs, nrhs, prhs);
-   }
-   else if (!strcmp("insert", operation))
-   {
-      splayTreeInsert(nrhs, prhs);
-   }
-   else if (!strcmp("update", operation))
-   {
-      splayTreeUpdate(nrhs, prhs);
-   }
-   else if (!strcmp("erase", operation))
-   {
-      splayTreeErase(nrhs, prhs);
-   }
-   else if (!strcmp("erase_index", operation))
-   {
-      splayTreeEraseIndex(nrhs, prhs);
-   }
-   else if (!strcmp("size", operation))
-   {
-      TreeT& tree = HandleT::handleReference(prhs[1]);
-      
-      const std::size_t& size=tree.size();
-
-      plhs[0]=mxCreateNumericMatrix(1, 1, mxINDEX_CLASS, mxREAL);
-      mwIndex* return_array = (mwIndex*) mxGetData(plhs[0]);
-      return_array[0] = size;
-   }
-   else
-   {
-       mexErrMsgIdAndTxt("Damkjer:SplayTreeAPI:UnknownOperation",
-                         "Unrecognized mode provided to SplayTreeAPI.");
-   }
-
-   // Prevent a slow memory leak.
-   mxFree(operation);
-}
Index: mkjer/Util/MATLAB/SplayTreeAPI/SplayTreeAPI.vcxproj
===================================================================
--- Damkjer/Util/MATLAB/SplayTreeAPI/SplayTreeAPI.vcxproj	(revision 13)
+++ 	(revision )
@@ -1,284 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="DebugOMP|Win32">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="DebugOMP|x64">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|Win32">
-      <Configuration>OpenMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|x64">
-      <Configuration>OpenMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\Util.vcxproj">
-      <Project>{20fe2624-c64f-d61a-bd8f-1725a8e68a42}</Project>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="SplayTreeAPI.cpp" />
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <Keyword>Win32Proj</Keyword>
-    <ProjectName>SplayTreeAPI</ProjectName>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <TargetExt>.mexw32</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <TargetExt>.mexw32</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <TargetExt>.mexw64</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <TargetExt>.mexw64</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <TargetExt>.mexw32</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <TargetExt>.mexw32</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <TargetExt>.mexw64</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <TargetExt>.mexw64</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <AdditionalOptions>/wd4514 /wd4571 /wd4668 /wd4710 /wd4711 /wd4820 /wd4986 %(AdditionalOptions)</AdditionalOptions>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
Index: mkjer/Util/MATLAB/SplayTreeAPI/SplayTreeAPI.vcxproj.filters
===================================================================
--- Damkjer/Util/MATLAB/SplayTreeAPI/SplayTreeAPI.vcxproj.filters	(revision 13)
+++ 	(revision )
@@ -1,18 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4010ed24-e68d-4e6e-97b0-8b8bb335aa86}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{0c039d31-de79-478b-9dc5-c3378145e52a}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="SplayTreeAPI.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-</Project>
Index: mkjer/Util/MATLAB/SplayTreeAPI/makeSplayTree.m
===================================================================
--- Damkjer/Util/MATLAB/SplayTreeAPI/makeSplayTree.m	(revision 13)
+++ 	(revision )
@@ -1,126 +1,0 @@
-% makeVpTree   Build VpTree spatial indexing library MEX functions and classes.
-%
-% File:
-%    makeVpTree.m
-%
-% Description:
-%    This MATLAB function provides an simplified interface for building the
-%    VpTree C++ and MEX files.
-%
-% Limitations:
-%    Assumes mex -setup has been successfully run.
-%
-% Synopsis:
-%    makeVpTree(options...)
-%
-% Inputs:
-%   Option strings may be provided as abbreviations as long as they resolve to
-%   a unique option.
-%
-%   'debug'     - Compile with debug flags and fully populated symbol table.
-%   'parallel'  - Enable OpenMP pragmas for multi-threaded computing.
-%   'verbose'   - Provide verbose output while compiling.
-%   'warnings'  - Provide compiler warning output for production-ready code.
-%                 Implies 'verbose'.
-%
-% Outputs:
-%    None.
-%
-% Toolbox requirements:
-%    None.
-%
-% Code requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    None.
-%
-% See Also:
-%    VpTree
-%
-
-% Software History:
-%    2012-AUG-29   K. Damkjer
-%       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
-%
-
-function makeSplayTree(varargin)
-
-command = 'mex -largeArrayDims -DTEMPLATE_INCLUSION';
-
-matlab_ver = regexp(version, '[. ]', 'split');
-command = [command...
-           ' -DMATLAB_MAJOR=' matlab_ver{1}...
-           ' -DMATLAB_MINOR=' matlab_ver{2}...
-           ' -DMATLAB_REVIS=' matlab_ver{3}...
-           ' -DMATLAB_BUILD=' matlab_ver{4}...
-           ' -DMATLAB_REL=' matlab_ver{5}(2:end-1)];
-
-flags = {'verbose', 'debug', 'warnings', 'parallel'};
-options = '';
-
-isVerbose = 0;
-
-while ~isempty(varargin)
-   flag = varargin{1};
-
-   % If the property has been supplied in a shortened form, lengthen it
-   iFlag = find(strncmpi(flag, flags, length(flag)));
-   
-   if isempty(iFlag)
-      % Pass through any arguments we don't recognize
-      options = strcat(options, [' ' flag]);
-      
-      % Alternatively, escalate to an error.
-      %error('Damkjer:makeVpTree:InvalidFlag', ['Invalid Flag: ' flag]);
-   elseif length(iFlag) > 1
-      error('Damkjer:makeSplayTree:AmbiguousFlag', ...
-            ['Supplied shortened flag is ambiguous: ' flag]);
-   else
-      flag = flags{iFlag};
-      
-      switch flag
-      case 'verbose'
-         command = strcat(command, ' -v');
-         isVerbose = 1;
-      case 'debug'
-         command = strcat(command, ' -g');
-      case 'parallel'
-         if (ispc)
-            command = strcat(command, ' COMPFLAGS="$COMPFLAGS /openmp"');
-         else
-            command = strcat(command, ' CFLAGS="\$CFLAGS -fopenmp"',...
-                                      ' CXXFLAGS="\$CXXFLAGS -fopenmp"',...
-                                      ' LDFLAGS="\$LDFLAGS -fopenmp"');
-         end
-      case 'warnings'
-         if (ispc)
-            command = strcat(command, ' -v COMPFLAGS="$COMPFLAGS -W3"');
-         else
-            command = strcat(command, ' -v',...
-                                      ' CFLAGS="\$CFLAGS -Wall -Wextra"',...
-                                      ' CXXFLAGS="\$CXXFLAGS -Wall -Wextra"');
-         end
-      otherwise
-         error('Damkjer:makeVpTree:NotImplementedFlag', ...
-               ['Flag recognized, but not supported: ' flag]);
-      end
-   end
-   
-   varargin(1) = [];
-end
-
-[path,~,~]=fileparts(mfilename('fullpath'));
-command = [command options ' -I' fullfile(path,'..','..','..')...
-           ' -outdir ' path ' ' path '/'];
-
-disp([command 'SplayTreeAPI.cpp']);
-
-eval([command 'SplayTreeAPI.cpp']);
-
-end
Index: mkjer/Util/MATLAB/VpTree.m
===================================================================
--- Damkjer/Util/MATLAB/VpTree.m	(revision 13)
+++ 	(revision )
@@ -1,220 +1,0 @@
-% VpTree   Vantage Point Tree spatial indexing data structure
-%
-% File: VpTree.m
-%
-% Description:
-%    This MATLAB class represents a vantage-point tree data structure. The
-%    class is derived from the MATLAB handle class to provide automated object
-%    descruction on calls to "clear".
-%
-% Limitations:
-%    See VpTree.h for complete description of limitations.
-%
-% Properties:
-%    None.
-%
-% Methods:
-%        [tree] = VpTree(varargin)                 - VP Tree Constructor
-%                 delete(tree)                     - Release this object and
-%                                                    free memory.
-%    [idx,dist] = knn(this, queries, k, varargin)  - Perform a k-nearest
-%                                                    neighbor search against
-%                                                    the tree.
-%    [idx,dist] = rnn(this, data, radius)          - Perform a fixed-radius
-%                                                    nearest neighbor search
-%                                                    against the tree.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    None.
-%
-% Data requirements:
-%    VpTreeAPI MEX library.
-%
-% References:
-%    Yianilos, P. N. (1993). Data Structures and Algorithms for Nearest
-%       Neighbor Search in General Metric Spaces. In Proceedings of the Fourth
-%       Annual ACM-SIAM Symposium on Discrete Algorithms (pp. 311321). SODA
-%       93. Philadelphia, PA, USA: Society for Industrial and Applied
-%       Mathematics. http://dl.acm.org/citation.cfm?id=313559.313789
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2012 Kristian L. Damkjer.
-%
-% Software History:
-%    2012-AUG-29   K. Damkjer
-%       Initial Coding.
-%
-
-%******************************************************************************
-% CLASS: VpTree
-%    Vantage Point Tree spatial indexing data structure. The class is derived
-%    from the MATLAB handle class to provide automated object descruction on
-%    calls to "clear".
-%******************************************************************************
-classdef (Sealed = true) VpTree < handle
-  
-   properties (Hidden=true, Access = private)
-      % The C++ VP-tree object owned by this handle class.
-      theTree
-   end
-   
-   methods
-      %************************************************************************
-      % VpTree/VpTree
-      %************************************************************************
-      function this = VpTree(varargin)
-         % Build the index structure for the database.
-         %
-         % Parameters:
-         %    varargin - Variable-length input argument list. Currently, only a
-         %               single argument is permitted in the argument list.
-         %               Specifically, a set of point observations that will be
-         %               spatially indexed by the tree structure.
-         
-         if (nargin ~= 1)
-            error('VpTree:InvalidArgumentList',...
-                  'VpTree must be constructed with a set of observations');
-         end
-
-         this.theTree = VpTreeAPI('create', varargin{1});
-      end
-
-      %************************************************************************
-      % VpTree/delete
-      %************************************************************************
-      function delete(this)
-         % This function frees memory on delete (clear) of the VpTree.
-         VpTreeAPI('destroy', this.theTree);
-      end
-
-      %************************************************************************
-      % VpTree/excludeWithin
-      %************************************************************************
-      function excludeWithin(this, radius)
-         % This function establishes a closeness threshold for searches on the
-         % VpTree.
-         VpTreeAPI('exclude_within', this.theTree, radius);
-      end
-
-      %************************************************************************
-      % VpTree/includeAll
-      %************************************************************************
-      function includeAll(this)
-         % This function clears closeness thresholds for searches on the
-         % VpTree.
-         VpTreeAPI('include_all', this.theTree);
-      end
-
-      %************************************************************************
-      % VpTree/knn
-      %************************************************************************
-      function [idx,dist] = knn(this, queries, k, varargin)
-         % Perform a k-nearest neighbor search on the database with the
-         % set of queries.
-         %
-         % Parameters:
-         %    queries  - The set of search locations about which to establish
-         %               k-nearest neighborhoods.
-         %
-         %    k        - The number of nearest neighbors to find for the
-         %               neighborhood.
-         %
-         %    varargin - Variable-length input argument list. The only defined
-         %               argument at this time is 'limit' which is used to
-         %               establish an upper bound on the radius of the
-         %               k-nearest neighborhood.
-         %
-         % Returns:
-         %    idx  - The indices for the k-nearest neighbors, sorted by
-         %           distance to the query, for each of the input query points.
-         %
-         %    dist - The distance to each k-nearest neighbor, sorted by
-         %           distance to the query, for each of the input query points.
-         
-         userParams = struct('limit', realmax);
-         
-         % Parse the Property/Value pairs
-         if rem(length(varargin), 2) ~= 0
-            error('Damkjer:PropertyValueNotPair', ...
-                  ['Additional arguments must take the form of'...
-                   'Property/Value pairs']);
-         end
-         
-         propertyNames = {'limit'};
-         
-         while ~isempty(varargin)
-            property = varargin{1};
-            value    = varargin{2};
-            
-            % If the property has been supplied in a shortened form,
-            % lengthen it
-            iProperty = find(strncmpi(property, propertyNames, ...
-                                      length(property)));
-            
-            if isempty(iProperty)
-               error('Damkjer:InvalidProperty', 'Invalid Property');
-            elseif length(iProperty) > 1
-               error('Damkjer:AmbiguousProperty', ...
-                     'Supplied shortened property name is ambiguous');
-            end
-            
-            property = propertyNames{iProperty};
-            
-            switch property
-               case 'limit'
-                  if (isscalar(value) && isnumeric(value) && ...
-                      isreal(value) && value > 0)
-                     userParams.limit = value;
-                  else
-                     error('Damkjer:InvalidLimit', ...
-                           'Limit must be a real valued positive scalar');
-                  end
-            end
-            
-            varargin(1:2) = [];
-         end
-         
-         if (nargout == 1)
-             idx = VpTreeAPI('search_kann', this.theTree,...
-                             queries, k, userParams.limit);
-         else
-             [idx,dist] = VpTreeAPI('search_kann', this.theTree,...
-                                    queries, k, userParams.limit);
-         end
-      end
-      
-      %************************************************************************
-      % VpTree/rnn
-      %************************************************************************
-      function [idx,dist] = rnn(this, queries, radius)
-         % Perform a fixed-radius nearest neighbor search on the
-         % database with the set of queries.
-         %
-         % Parameters:
-         %    queries - The set of search locations about which to establish
-         %              k-nearest neighborhoods.
-         %
-         %    radius  - The maximum permitted distance to a nearest neighbor.
-         %
-         % Returns:
-         %    idx  - The indices for the k-nearest neighbors, sorted by
-         %           distance to the query, for each of the input query points.
-         %
-         %    dist - The distance to each k-nearest neighbor, sorted by
-         %           distance to the query, for each of the input query points.
-         if (nargout == 1)
-             idx = VpTreeAPI('search_frann', this.theTree, queries, radius);
-         else
-             [idx,dist] = VpTreeAPI('search_frann', this.theTree,...
-                                    queries, radius);
-         end
-      end
-   end
-end
-
Index: mkjer/Util/MATLAB/VpTreeAPI/VpTreeAPI.cpp
===================================================================
--- Damkjer/Util/MATLAB/VpTreeAPI/VpTreeAPI.cpp	(revision 15)
+++ 	(revision )
@@ -1,890 +1,0 @@
-//*****************************************************************************
-// FILE:        VpTreeAPI.cpp
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The application interface for working with VP Trees in MATLAB.
-//<
-//
-// LIMITATIONS:
-//>   All interfaces to the VP Tree objects from MATLAB must be routed through
-//    this gateway file. This interface is required until and unless MATLAB
-//    provides a mechanism for modifying locks on MEX files other than the
-//    current file.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-19  K. Damkjer
-//               Improved structure and documentation. Prevented double free of
-//               VP Tree memory and infinite locking of MEX library.
-//  2013-JUL-23  K. Damkjer
-//               Set typedefs to make code more readable and to allow for
-//               varying container and metric types. This is useful when the
-//               default double-precision is overkill. It is now easy to set
-//               types to float.
-//<
-//*****************************************************************************
-
-#if _OPENMP
-#include <omp.h>
-#endif
-
-#include "Util/MATLAB/ClassHandle.h"
-#include "Util/SpatialIndexing/VpTree/VpTree.h"                  // USES 
-
-#include <vector>
-#include <deque>
-
-//***
-// Fix "wide char" definition for older versions of MATLAB. This must be placed
-// after other includes and before the mex.h include.
-//***
-#if (defined(MATLAB_MAJOR) && defined(MATLAB_MINOR))
-   #if MATLAB_MAJOR <= 7 && MATLAB_MINOR <= 10 && defined(_CHAR16T)
-      #define CHAR16_T
-   #endif
-#endif
-
-#include "mex.h"
-
-//*****************************************************************************
-// NAMESPACE:
-//>   Vantage Point Tree MEX API types, interfaces, and implementations.
-//<
-//*****************************************************************************
-namespace
-{
-
-typedef double CoordT;
-   //> The MATLAB VpTree point coordinate type.
-   //<
-
-typedef std::vector<CoordT> PointT;
-   //> The MATLAB VpTree point type.
-   //<
-
-typedef std::deque<PointT> PointSetT;
-   //> The MATLAB VpTree point set type.
-   //<
-
-typedef Damkjer::EuclideanDistance<PointT> MetricT;
-   //> The MATLAB VpTree distance metric type.
-   //<
-
-typedef Damkjer::VpTree<MetricT> TreeT;
-   //> The MATLAB VpTree type.
-   //<
-
-typedef Damkjer::ClassHandle<TreeT> HandleT;
-   //> The VpTree MATLAB Class Handle type.
-   //<
-
-//*****************************************************************************
-// FUNCTION: vpTreeCreate
-//>   Create a VpTree for use in MATLAB.
-//
-//    New objects are wrapped by the ClassHandle template to ensure that locks
-//    are managed correctly to avoid double frees of memory managed by this
-//    class, to ensure objects have a life span separate from this function's
-//    scope, and to provide convenience methods for passing the pointer to the
-//    object between MATLAB and C++.
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-vpTreeCreate(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs < 2 || nrhs > 2)
-   {
-      mexErrMsgIdAndTxt("Damkjer:vpTreeCreate:nargin",
-                        "The vpTreeCreate function requires a single input.");
-   }
-   
-   if (nlhs > 1)
-   {
-      mexErrMsgIdAndTxt("Damkjer:vpTreeCreate:nargout",
-                        "The vpTreeCreate function requires a single output.");
-   }
-
-   //***
-   // The single input required by vpTreeCreate is the collection of points to
-   // be indexed.
-   //***
-   const mxArray* points=prhs[1];
-   
-   // Check to make sure that points are real-valued numerics
-   if (mxIsSparse(points) ||
-       mxGetNumberOfDimensions(points) != 2 ||
-       mxIsComplex(points) ||
-       !mxIsNumeric(points))
-   {
-      mexErrMsgIdAndTxt("Damkjer:vpTreeCreate:prhs",
-                        "Input to vpTreeCreate must be a full, 2-D matrix "
-                        "of real-valued data representing N-dimensional "
-                        "observations.");
-   }
-
-   // Attempt to make the VP Tree.
-   const mwSize dims = mxGetM(points);
-   const mwSize elems = mxGetN(points);
-   
-   double* data = mxGetPr(points);
-
-   //***
-   // Selection of data structure for the point database is not arbitrary.
-   //
-   // 1. Point coordinates are passed in as double-precision values. Preserve
-   //    the data fidelity.
-   // 2. Individual points are often low-dimensional. Keep the coordinates for
-   //    a single point in contiguous memory by using a std::vector container.
-   // 3. The point database can be quite large. Since VP Tree is an online data
-   //    structure, allow references to points to occupy non-contiguous memory.
-   //    This also speeds construction and destruction of the point database.
-   //***
-   PointSetT pointData(elems, PointT(dims));
-   
-   for (mwSize elem = elems; elem --> 0;)
-   {
-      for (mwSize dim = dims; dim --> 0;)
-      {
-         pointData[elem][dim]=(CoordT)(data[elem*dims+dim]);
-      }
-   }
-
-   //***
-   // Use the ClassHandle named constructor to provide a handle to the new VP
-   // Tree object.
-   //***
-   try
-   {
-      plhs[0] = HandleT::createHandle(new TreeT(pointData, MetricT()));
-   }
-   catch (const std::exception& e)
-   {
-      mexErrMsgIdAndTxt("Damkjer:vpTreeCreate:initError", e.what());
-   }
-}
-
-//*****************************************************************************
-// FUNCTION: vpTreeDestroy
-//>   Destroy the VpTree referenced by a ClassHandle object.
-//
-//    Destroying objects through the ClassHandle wrapper ensures memory leaks
-//    are not introduced through this MEX function and allows the MEX library
-//    to be unlocked once all objects have been destroyed and their memory
-//    returned to the system.
-//
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-inline
-void
-vpTreeDestroy(int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs != 2 || !mxIsNumeric(prhs[1]))
-   {
-       mexErrMsgIdAndTxt("Damkjer:vpTreeDestroy:varargin",
-                         "The vpTreeDestroy function requires a single "
-                         "input.");
-   }
-
-   // Free the VP Tree through the ClassHandle named destructor.
-   HandleT::destroyHandle(prhs[1]);
-}
-
-//*****************************************************************************
-// FUNCTION: vpTreeExclude
-//>   Establish keep-out threshold for searches against the VpTree.
-//
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-inline
-void
-vpTreeExclude(int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs != 3 || !mxIsNumeric(prhs[1]))
-   {
-       mexErrMsgIdAndTxt("Damkjer:vpTreeExclude:varargin",
-                         "The vpTreeExclude function requires two "
-                         "inputs.");
-   }
-
-   // Retrieve the tree object through the ClassHandle helper method.
-   TreeT& tree = HandleT::handleReference(prhs[1]);
-
-   // The second parameter should be the threshold radius.
-   const mxArray* rData=prhs[2];
-
-   // Check to make sure that radius is a real-valued numeric scalar.
-   if (mxIsSparse(rData) ||
-       mxGetNumberOfElements(rData) != 1 ||
-       mxIsComplex(rData) ||
-       !mxIsNumeric(rData))
-   {
-      mexErrMsgIdAndTxt("Damkjer:vpTreeExclude:prhs",
-                        "Second input parameter to vpTreeExclude must be a "
-                        "real-valued scalar representing desired search "
-                        "threshold radius limit.");
-   }
-
-   // Get the desired neighborhood radius limit.
-   TreeT::DistT radius = (TreeT::DistT)(*(double*)mxGetData(rData));
-
-   tree.excludeWithin(radius);
-}
-
-//*****************************************************************************
-// FUNCTION: vpTreeInclude
-//>   Clear keep-out threshold for searches against the VpTree.
-//
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-inline
-void
-vpTreeInclude(int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs != 2 || !mxIsNumeric(prhs[1]))
-   {
-       mexErrMsgIdAndTxt("Damkjer:vpTreeInclude:varargin",
-                         "The vpTreeDestroy function requires a single "
-                         "input.");
-   }
-
-   // Retrieve the tree object through the ClassHandle helper method.
-   TreeT& tree = HandleT::handleReference(prhs[1]);
-
-   tree.includeAllMatches();
-}
-
-//*****************************************************************************
-// FUNCTION: vpTreeFRANN
-//>   Perform a fixed-radius all nearest neighbor (FRANN) search on a VpTree.
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-vpTreeFRANN(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs < 3 || nrhs > 4 || !mxIsNumeric(prhs[1]))
-   {
-       mexErrMsgIdAndTxt("Damkjer:vpTreeFRANN:varargin",
-                         "Invalid number of input arguments.");
-   }
-
-   if (nlhs>2)
-   {
-       mexErrMsgIdAndTxt("Damkjer:vpTreeFRANN:varargout",
-                         "Invalid number of output arguments.");
-   }
-
-   // Retrieve the tree object through the ClassHandle helper method.
-   const TreeT& tree = HandleT::handleReference(prhs[1]);
-
-   // The second parameter should be the query points.
-   const mxArray* queries=prhs[2];
-    
-   // Check to make sure that query points are real-valued numerics
-   if (mxIsSparse(queries) ||
-       mxGetNumberOfDimensions(queries) != 2 ||
-       mxIsComplex(queries) ||
-       !mxIsNumeric(queries))
-   {
-      mexErrMsgIdAndTxt("Damkjer:vpTreeFRANN:prhs",
-                        "Second input parameter to vpTreeFRANN must be a "
-                        "full, 2-D matrix of real-valued data representing "
-                        "multi-dimensional queries.");
-   }
-
-   // The third parameter should be the query radius.
-   const mxArray* rData=prhs[3];
-
-   // Check to make sure that radius is a real-valued numeric scalar.
-   if (mxIsSparse(rData) ||
-       mxGetNumberOfElements(rData) != 1 ||
-       mxIsComplex(rData) ||
-       !mxIsNumeric(rData))
-   {
-      mexErrMsgIdAndTxt("Damkjer:vpTreeFRANN:prhs",
-                        "Third input parameter to vpTreeFRANN must be a "
-                        "real-valued scalar representing desired neighborhood "
-                        "radius limit.");
-   }
-
-   //***
-   // Get the query points.
-   //
-   // Selection of data structure for the query database is not arbitrary.
-   //
-   // 1. Point coordinates are passed in as double-precision values. Preserve
-   //    the data fidelity.
-   // 2. Individual points are often low-dimensional. Keep the coordinates for
-   //    a single point in contiguous memory by using a std::vector container.
-   // 3. The query database can be quite large. Allow references to points to
-   //    occupy non-contiguous memory.
-   //***
-   const mwSize dims = mxGetM(queries);
-   const mwSize elems = mxGetN(queries);
-    
-   double* data = mxGetPr(queries);
-   PointSetT queryData(elems, PointT(dims));
-
-   for (mwIndex elem = elems; elem --> 0;)
-   {
-      for (mwIndex dim = dims; dim --> 0;)
-      {
-         queryData[elem][dim]=(CoordT)(data[elem*dims+dim]);
-      }
-   }
-   
-   // Get the desired neighborhood radius limit.
-   TreeT::DistT radius = (TreeT::DistT)(*(double*)mxGetData(rData));
-
-   //***
-   // The first output parameter holds the nearest neighbor indices. This
-   // collection is represented as a cell array of vectors with a cell for each
-   // query point.
-   //***
-   plhs[0] = mxCreateCellMatrix(elems, 1);
-
-   //***
-   // If desired, the distance from the query point to each of the nearest
-   // neighbors can also be provided. This collection is represented as a cell 
-   // array of vectors with a cell for each query point.
-   //***
-   if (nlhs==2)
-   {
-       plhs[1] = mxCreateCellMatrix(elems, 1);
-   }
-
-   //***
-   // The following logic flows may seem counter-intuitive, but are structured
-   // to intentionally avoid nested critical sections in parallelized code.
-   //
-   // Unfortunately, any calls to the MATLAB API must be treated as belonging
-   // to a critical section since none of the API is thread-safe.
-   //***
-
-#if _OPENMP
-   if (omp_get_num_threads() == 1)
-   {
-      omp_set_dynamic(1);
-      omp_set_num_threads(omp_get_num_procs());
-   }
-#endif
-
-   //***
-   // The VP Tree data structure always provides results as a set of pairs of
-   // indices and distances. There is no performance benefit to omitting the
-   // distance computations since they are required for the search algorithm.
-   //***
-   std::deque<TreeT::SearchResultsT> results(queryData.size());
-
-   //***
-   // The first embarassingly parallelizable section simply searches for each
-   // query point's neighbors in parallel. This is much simpler than attempting
-   // to parallelize the search for a single point, and likely to yield 
-   // superior results.
-   //***
-   #pragma omp parallel for schedule(guided)
-   for (int q = 0; q < queryData.size(); ++q)
-   {
-      unsigned int uq = static_cast<unsigned int>(q);
-      results[uq] = tree.rnn(queryData[uq], radius);
-   }
-
-   //***
-   // Allocating memory for the results to be passed back to MATLAB must take
-   // place in a "critical section" since it involves exercising the MEX API.
-   //***
-   std::deque<mxArray*> nbr_idxs;
-   std::deque<mwIndex*> point_idxs;
-   
-   for (int q = 0; q < queryData.size(); ++q)
-   {
-      unsigned int uq = static_cast<unsigned int>(q);
-      mwSize neighbors = results[uq].first.size();
-
-      nbr_idxs.push_back(mxCreateNumericMatrix(0, 0, mxINDEX_CLASS, mxREAL));
-      mxSetM(nbr_idxs[uq], neighbors);
-      mxSetN(nbr_idxs[uq], 1);
-      mxSetData(nbr_idxs[uq], mxMalloc(sizeof(mwIndex)*neighbors*1));
-      
-      point_idxs.push_back((mwIndex*)mxGetData(nbr_idxs[uq]));
-   }
-
-   //***
-   // Once memory has been allocated, the actual results can be populated in
-   // parallel.
-   //***
-   #pragma omp parallel for schedule(guided)
-   for (int q = 0; q < queryData.size(); ++q)
-   {  
-      unsigned int uq = static_cast<unsigned int>(q);
-      mwSize neighbors = results[uq].first.size();
-
-      mwIndex* idxs = point_idxs[uq];
-      
-      for (mwIndex idx = neighbors; idx --> 0;)
-      {
-         idxs[idx]=results[uq].first[idx]+1;
-      }
-   }
-
-   //***
-   // Marking the data for return to MATLAB must take place in a "critical 
-   // section" since it involves exercising the MEX API. This also changes
-   // ownership and memory management responsibilities to MATLAB. We will not
-   // free this data.
-   //***   
-   for (unsigned int q = 0; q < queryData.size(); ++q)
-   {
-      mxSetCell(plhs[0], q, nbr_idxs[q]);
-   }
-
-   // Repeat the "hand-off" to MATLAB for distance data, if it was requested.
-   if (nlhs==2)
-   {
-      //***
-      // Allocating memory for the results to be passed back to MATLAB must
-      // take place in a "critical section" since it involves exercising the
-      // MEX API.
-      //***
-      std::deque<mxArray*> nbr_dists;
-      std::deque<double*>  point_dists;
-
-      for (unsigned int q = 0; q < queryData.size(); ++q)
-      {
-         mwSize neighbors = results[q].first.size();
-
-         nbr_dists[q] = mxCreateDoubleMatrix(0, 0, mxREAL);
-         mxSetM(nbr_dists[q], neighbors);
-         mxSetN(nbr_dists[q], 1);
-         mxSetData(nbr_dists[q], mxMalloc(sizeof(double)*neighbors*1));
-         
-         point_dists.push_back(mxGetPr(nbr_dists[q]));
-      }
-      
-      //***
-      // Once memory has been allocated, the actual results can be populated in
-      // parallel.
-      //***
-      #pragma omp parallel for schedule(guided)
-      for (int q = 0; q < queryData.size(); ++q)
-      {
-         unsigned int uq = static_cast<unsigned int>(q);
-         mwSize neighbors = results[uq].first.size();
-         
-         double* dists = point_dists[uq];
-
-         for (mwIndex idx = neighbors; idx --> 0;)
-         {
-            dists[idx]=results[uq].second[idx];
-         }
-      }
-
-      //***
-      // Marking the data for return to MATLAB must take place in a "critical 
-      // section" since it involves exercising the MEX API. This also changes
-      // ownership and memory management responsibilities to MATLAB. We will
-      // not free this data.
-      //***   
-      for (unsigned int q = 0; q < queryData.size(); ++q)
-      {
-         mxSetCell(plhs[1], q, nbr_dists[q]);
-      }
-   }
-}
-
-//*****************************************************************************
-// FUNCTION: vpTreeKANN
-//>   Perform a k all nearest neighbor (KANN) search on a VpTree.
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-vpTreeKANN(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs)
-{
-   //***
-   // Check parameters. Remember that we always have one "extra" input
-   // parameter to handle function dispatching through the MEX gateway. It
-   // always occupies the first input parameter position.
-   //***
-   if (nrhs != 5 || !mxIsNumeric(prhs[1]))
-   {
-      mexErrMsgIdAndTxt("Damkjer:kannVpTree:varargin",
-                        "Invalid number of arguments");
-   }
-
-   // Retrieve the tree object through the ClassHandle helper method.
-   const TreeT& tree = HandleT::handleReference(prhs[1]);
-
-   // The second parameter should be the query points.
-   const mxArray* queries=prhs[2];
-
-   // Check to make sure that query points are real-valued numerics.
-   if (mxIsSparse(queries) ||
-       mxGetNumberOfDimensions(queries) != 2 ||
-       mxIsComplex(queries) ||
-       !mxIsNumeric(queries))
-   {
-      mexErrMsgIdAndTxt("Damkjer:vpTreeKANN:prhs",
-                        "Second input parameter to vpTreeKANN must be a full, "
-                        "2-D matrix of real-valued data representing "
-                        "multi-dimensional queries.");
-   }
-
-   // The third parameter should be the desired neighborhood cardinality.
-   const mxArray* kData=prhs[3];
-
-   // Check to make sure that cardinality is a real-valued numeric scalar.
-   if (mxIsSparse(kData) ||
-       mxGetNumberOfElements(kData) != 1 ||
-       mxIsComplex(kData) ||
-       !mxIsNumeric(kData))
-   {
-      mexErrMsgIdAndTxt("Damkjer:vpTreeKANN:prhs",
-                        "Third input parameter to vpTreeKANN must be an "
-                        "real-valued scalar representing desired neighborhood "
-                        "cardinality.");
-   }
-
-   // The fourth parameter should be the desired radius limit.
-   const mxArray* rData=prhs[4];
-
-   // Check to make sure that radius is a real-valued numeric scalar.
-   if (mxIsSparse(rData) ||
-       mxGetNumberOfElements(rData) != 1 ||
-       mxIsComplex(rData) ||
-       !mxIsNumeric(rData))
-   {
-      mexErrMsgIdAndTxt("Damkjer:vpTreeKANN:prhs",
-                        "Fourth input parameter to vpTreeKANN must be an "
-                        "real-valued scalar representing desired neighborhood "
-                        "radius limit.");
-   }
-
-   //***
-   // Get the query points.
-   //
-   // Selection of data structure for the query database is not arbitrary.
-   //
-   // 1. Point coordinates are passed in as double-precision values. Preserve
-   //    the data fidelity.
-   // 2. Individual points are often low-dimensional. Keep the coordinates for
-   //    a single point in contiguous memory by using a std::vector container.
-   // 3. The query database can be quite large. Allow references to points to
-   //    occupy non-contiguous memory.
-   //***
-   const mwSize dims = mxGetM(queries);
-   const mwSize elems = mxGetN(queries);
-
-   double* data = mxGetPr(queries);
-   PointSetT queryData(elems, PointT(dims));
-
-   for (mwIndex elem = elems; elem --> 0;)
-   {
-      for (mwIndex dim = dims; dim --> 0;)
-      {
-         queryData[elem][dim]=(CoordT)(data[elem*dims+dim]);
-      }
-   }
-
-   // Get the desired neighborhood cardinality.
-   mwSize k = (mwSize)(*((double*)mxGetData(kData)));
-
-   // Get the desired neighborhood radius limit.
-   TreeT::DistT radius = (TreeT::DistT)(*(double*)mxGetData(rData));
-
-   //***
-   // The first output parameter holds the nearest neighbor indices. This
-   // collection is represented as a cell array of vectors with a cell for each
-   // query point.
-   //***
-   plhs[0] = mxCreateCellMatrix(elems, 1);
-
-   //***
-   // If desired, the distance from the query point to each of the nearest
-   // neighbors can also be provided. This collection is represented as a cell 
-   // array of vectors with a cell for each query point.
-   //***
-   if (nlhs==2)
-   {
-      plhs[1] = mxCreateCellMatrix(elems, 1);
-   }
-
-   //***
-   // The following logic flows may seem counter-intuitive, but are structured
-   // to intentionally avoid nested critical sections in parallelized code.
-   //
-   // Unfortunately, any calls to the MATLAB API must be treated as belonging
-   // to a critical section since none of the API is thread-safe.
-   //***
-
-#if _OPENMP
-   if (omp_get_num_threads() == 1)
-   {
-      omp_set_dynamic(1);
-      omp_set_num_threads(omp_get_num_procs());
-   }
-#endif
-
-   //***
-   // The VP Tree data structure always provides results as a set of pairs of
-   // indices and distances. There is no performance benefit to omitting the
-   // distance computations since they are required for the search algorithm.
-   //***
-   std::deque<TreeT::SearchResultsT> results(queryData.size());
-
-   //***
-   // The first embarassingly parallelizable section simply searches for each
-   // query point's neighbors in parallel. This is much simpler than attempting
-   // to parallelize the search for a single point, and likely to yield 
-   // superior results.
-   //***
-   #pragma omp parallel for schedule(guided)
-   for (int q = 0; q < queryData.size(); ++q)
-   {
-      unsigned int uq = static_cast<unsigned int>(q);
-      results[uq] = tree.knn(queryData[uq], k, radius);
-   }
-
-   //***
-   // Allocating memory for the results to be passed back to MATLAB must take
-   // place in a "critical section" since it involves exercising the MEX API.
-   //***
-   std::deque<mxArray*> nbr_idxs;
-   std::deque<mwIndex*> point_idxs;
-   
-   for (unsigned int q = 0; q < queryData.size(); ++q)
-   {
-      mwSize neighbors = results[q].first.size();
-
-      nbr_idxs.push_back(mxCreateNumericMatrix(0, 0, mxINDEX_CLASS, mxREAL));
-      mxSetM(nbr_idxs[q], neighbors);
-      mxSetN(nbr_idxs[q], 1);
-      mxSetData(nbr_idxs[q], mxMalloc(sizeof(mwIndex)*neighbors*1));
-      
-      point_idxs.push_back((mwIndex*)mxGetData(nbr_idxs[q]));
-   }
-
-   //***
-   // Once memory has been allocated, the actual results can be populated in
-   // parallel.
-   //***
-   #pragma omp parallel for schedule(guided)
-   for (int q = 0; q < queryData.size(); ++q)
-   {  
-      unsigned int uq = static_cast<unsigned int>(q);
-      mwSize neighbors = results[uq].first.size();
-
-      mwIndex* idxs = point_idxs[uq];
-      
-      for (mwIndex idx = neighbors; idx --> 0;)
-      {
-         idxs[idx]=results[uq].first[idx]+1;
-      }
-   }
-
-   //***
-   // Marking the data for return to MATLAB must take place in a "critical 
-   // section" since it involves exercising the MEX API. This also changes
-   // ownership and memory management responsibilities to MATLAB. We will not
-   // free this data.
-   //***   
-   for (unsigned int q = 0; q < queryData.size(); ++q)
-   {
-      mxSetCell(plhs[0], q, nbr_idxs[q]);
-   }
-
-   // Repeat the "hand-off" to MATLAB for distance data, if it was requested.
-   if (nlhs==2)
-   {
-      //***
-      // Allocating memory for the results to be passed back to MATLAB must
-      // take place in a "critical section" since it involves exercising the
-      // MEX API.
-      //***
-      std::deque<mxArray*> nbr_dists;
-      std::deque<double*>  point_dists;
-
-      for (unsigned int q = 0; q < queryData.size(); ++q)
-      {
-         mwSize neighbors = results[q].first.size();
-
-         nbr_dists.push_back(mxCreateDoubleMatrix(0, 0, mxREAL));
-         mxSetM(nbr_dists[q], neighbors);
-         mxSetN(nbr_dists[q], 1);
-         mxSetData(nbr_dists[q], mxMalloc(sizeof(double)*neighbors*1));
-         
-         point_dists.push_back(mxGetPr(nbr_dists[q]));
-      }
-      
-      //***
-      // Once memory has been allocated, the actual results can be populated in
-      // parallel.
-      //***
-      #pragma omp parallel for schedule(guided)
-      for (int q = 0; q < queryData.size(); ++q)
-      {
-         unsigned int uq = static_cast<unsigned int>(q);
-         mwSize neighbors = results[uq].first.size();
-         
-         double* dists = point_dists[uq];
-
-         for (mwIndex idx = neighbors; idx --> 0;)
-         {
-            dists[idx]=results[uq].second[idx];
-         }
-      }
-
-      //***
-      // Marking the data for return to MATLAB must take place in a "critical 
-      // section" since it involves exercising the MEX API. This also changes
-      // ownership and memory management responsibilities to MATLAB. We will
-      // not free this data.
-      //***   
-      for (unsigned int q = 0; q < queryData.size(); ++q)
-      {
-         mxSetCell(plhs[1], q, nbr_dists[q]);
-      }
-   }
-}
-
-}
-
-//*****************************************************************************
-// FUNCTION: mexFunction
-//>   The MATLAB Executable Gateway Function.
-//
-//    Provides the application interface for working with VP Trees in MATLAB.
-//    All functional interfaces are routed through this single function to
-//    ensure locks and memory management are handled properly by MATLAB.
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-mexFunction(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs)
-{
-   //***
-   // This MEX function should always have at least one input parameter to
-   // handle function dispatching through the MEX gateway.
-   //***
-   if (nrhs < 1)
-   {
-      mexErrMsgIdAndTxt("Damkjer:VpTreeAPI:nargin",
-                        "VpTreeAPI requires at least one input which "
-                        "specifies the operation to be performed.");
-   }
-
-   // The operation switch is simply a string.
-   char* operation = mxArrayToString(prhs[0]);
-   
-   if (!operation)
-   {
-      mexErrMsgIdAndTxt("Damkjer:VpTreeAPI:InvalidOperation",
-                        "Invalid mode supplied to VpTreeAPI.");
-      return; // error should force return.
-   }
-   
-   // Dispatch to helper functions. Err if operation is not recognized.
-   if (!strcmp("create", operation))
-   {
-      vpTreeCreate(nlhs, plhs, nrhs, prhs);
-
-   }
-   else if (!strcmp("destroy", operation))
-   {
-      if (nlhs != 0)
-      {
-      mexErrMsgIdAndTxt("Damkjer:VpTreeAPI:nargout",
-                        "Nothing to return.");
-      }
-
-      vpTreeDestroy(nrhs, prhs);
-   }   
-   else if (!strcmp("exclude_within", operation))
-   {
-      if (nlhs != 0)
-      {
-      mexErrMsgIdAndTxt("Damkjer:VpTreeAPI:nargout",
-                        "Nothing to return.");
-      }
-
-      vpTreeExclude(nrhs, prhs);
-   }
-   else if (!strcmp("include_all", operation))
-   {
-      if (nlhs != 0)
-      {
-      mexErrMsgIdAndTxt("Damkjer:VpTreeAPI:nargout",
-                        "Nothing to return.");
-      }
-
-      vpTreeInclude(nrhs, prhs);
-   }
-   else if (!strcmp("search_frann", operation))
-   {
-      vpTreeFRANN(nlhs, plhs, nrhs, prhs);
-   }
-   else if (!strcmp("search_kann", operation))
-   {  
-      vpTreeKANN(nlhs, plhs, nrhs, prhs);
-   }
-   else
-   {
-       mexErrMsgIdAndTxt("Damkjer:VpTreeAPI:UnknownOperation",
-                         "Unrecognized mode provided to VpTreeAPI.");
-   }
-
-   // Prevent a slow memory leak.
-   mxFree(operation);
-}
Index: mkjer/Util/MATLAB/VpTreeAPI/VpTreeAPI.vcxproj
===================================================================
--- Damkjer/Util/MATLAB/VpTreeAPI/VpTreeAPI.vcxproj	(revision 12)
+++ 	(revision )
@@ -1,284 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="DebugOMP|Win32">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="DebugOMP|x64">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|Win32">
-      <Configuration>OpenMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|x64">
-      <Configuration>OpenMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="VpTreeAPI.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\Util.vcxproj">
-      <Project>{20fe2624-c64f-d61a-bd8f-1725a8e68a42}</Project>
-    </ProjectReference>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <Keyword>Win32Proj</Keyword>
-    <ProjectName>VpTreeAPI</ProjectName>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <TargetExt>.mexw32</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <TargetExt>.mexw32</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <TargetExt>.mexw64</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <TargetExt>.mexw64</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <TargetExt>.mexw32</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <TargetExt>.mexw32</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <TargetExt>.mexw64</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <TargetExt>.mexw64</TargetExt>
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <AdditionalOptions>/wd4514 /wd4571 /wd4668 /wd4710 /wd4711 /wd4820 /wd4986 %(AdditionalOptions)</AdditionalOptions>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
Index: mkjer/Util/MATLAB/VpTreeAPI/VpTreeAPI.vcxproj.filters
===================================================================
--- Damkjer/Util/MATLAB/VpTreeAPI/VpTreeAPI.vcxproj.filters	(revision 12)
+++ 	(revision )
@@ -1,18 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4010ed24-e68d-4e6e-97b0-8b8bb335aa86}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{0c039d31-de79-478b-9dc5-c3378145e52a}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="VpTreeAPI.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-</Project>
Index: mkjer/Util/MATLAB/VpTreeAPI/makeVpTree.m
===================================================================
--- Damkjer/Util/MATLAB/VpTreeAPI/makeVpTree.m	(revision 13)
+++ 	(revision )
@@ -1,126 +1,0 @@
-% makeVpTree   Build VpTree spatial indexing library MEX functions and classes.
-%
-% File:
-%    makeVpTree.m
-%
-% Description:
-%    This MATLAB function provides an simplified interface for building the
-%    VpTree C++ and MEX files.
-%
-% Limitations:
-%    Assumes mex -setup has been successfully run.
-%
-% Synopsis:
-%    makeVpTree(options...)
-%
-% Inputs:
-%   Option strings may be provided as abbreviations as long as they resolve to
-%   a unique option.
-%
-%   'debug'     - Compile with debug flags and fully populated symbol table.
-%   'parallel'  - Enable OpenMP pragmas for multi-threaded computing.
-%   'verbose'   - Provide verbose output while compiling.
-%   'warnings'  - Provide compiler warning output for production-ready code.
-%                 Implies 'verbose'.
-%
-% Outputs:
-%    None.
-%
-% Toolbox requirements:
-%    None.
-%
-% Code requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    None.
-%
-% See Also:
-%    VpTree
-%
-
-% Software History:
-%    2012-AUG-29   K. Damkjer
-%       Initial Coding.
-%    2013-JUN-17   K. Damkjer
-%       Additional Commenting.
-%
-
-function makeVpTree(varargin)
-
-command = 'mex -largeArrayDims -DTEMPLATE_INCLUSION';
-
-matlab_ver = regexp(version, '[. ]', 'split');
-command = [command...
-           ' -DMATLAB_MAJOR=' matlab_ver{1}...
-           ' -DMATLAB_MINOR=' matlab_ver{2}...
-           ' -DMATLAB_REVIS=' matlab_ver{3}...
-           ' -DMATLAB_BUILD=' matlab_ver{4}...
-           ' -DMATLAB_REL=' matlab_ver{5}(2:end-1)];
-
-flags = {'verbose', 'debug', 'warnings', 'parallel'};
-options = '';
-
-isVerbose = 0;
-
-while ~isempty(varargin)
-   flag = varargin{1};
-
-   % If the property has been supplied in a shortened form, lengthen it
-   iFlag = find(strncmpi(flag, flags, length(flag)));
-   
-   if isempty(iFlag)
-      % Pass through any arguments we don't recognize
-      options = strcat(options, [' ' flag]);
-      
-      % Alternatively, escalate to an error.
-      %error('Damkjer:makeVpTree:InvalidFlag', ['Invalid Flag: ' flag]);
-   elseif length(iFlag) > 1
-      error('Damkjer:makeVpTree:AmbiguousFlag', ...
-            ['Supplied shortened flag is ambiguous: ' flag]);
-   else
-      flag = flags{iFlag};
-      
-      switch flag
-      case 'verbose'
-         command = strcat(command, ' -v');
-         isVerbose = 1;
-      case 'debug'
-         command = strcat(command, ' -g');
-      case 'parallel'
-         if (ispc)
-            command = strcat(command, ' COMPFLAGS="$COMPFLAGS /openmp"');
-         else
-            command = strcat(command, ' CFLAGS="\$CFLAGS -fopenmp"',...
-                                      ' CXXFLAGS="\$CXXFLAGS -fopenmp"',...
-                                      ' LDFLAGS="\$LDFLAGS -fopenmp"');
-         end
-      case 'warnings'
-         if (ispc)
-            command = strcat(command, ' -v COMPFLAGS="$COMPFLAGS -W3"');
-         else
-            command = strcat(command, ' -v',...
-                                      ' CFLAGS="\$CFLAGS -Wall -Wextra"',...
-                                      ' CXXFLAGS="\$CXXFLAGS -Wall -Wextra"');
-         end
-      otherwise
-         error('Damkjer:makeVpTree:NotImplementedFlag', ...
-               ['Flag recognized, but not supported: ' flag]);
-      end
-   end
-   
-   varargin(1) = [];
-end
-
-[path,~,~]=fileparts(mfilename('fullpath'));
-command = [command options ' -I' fullfile(path,'..','..','..')...
-           ' -outdir ' path ' ' path '/'];
-
-disp([command 'VpTreeAPI.cpp']);
-
-eval([command 'VpTreeAPI.cpp']);
-
-end
Index: Damkjer/Util/Math/fastcenter.cpp
===================================================================
--- Damkjer/Util/Math/fastcenter.cpp	(revision 15)
+++ Damkjer/Util/Math/fastcenter.cpp	(revision 0)
@@ -1,14 +1,11 @@
-//*****************************************************************************
-// FILE:        fastcenter.cpp
+//=========================================================================
+// FILE:        fastcov.cpp
 //
 //    Copyright (C)  2012 Kristian Damkjer.
 //
-// DESCRIPTION:
-//>   @todo Describe this file
-//<
+// DESCRIPTION: This MEX source file provides a fast implementation of cov
+//              method for cell-arrays of real valued matrices.
 //
-// LIMITATIONS:
-//>   Does not work for cell-arrays of complex matrices.
-//<
+// LIMITATIONS: Does not work for cell-arrays of complex matrices.
 //
 // SOFTWARE HISTORY:
@@ -16,5 +13,5 @@
 //               Initial Coding.
 //<
-//*****************************************************************************
+//=========================================================================
 
 #ifdef _OPENMP
@@ -24,28 +21,10 @@
 #include <vector>
 
-//***
-// Fix "wide char" definition for older versions of MATLAB. This must be placed
-// after other includes and before the mex.h include.
-//***
-#if (defined(MATLAB_MAJOR) && defined(MATLAB_MINOR))
-   #if MATLAB_MAJOR <= 7 && MATLAB_MINOR <= 10 && defined(_CHAR16T)
-      #define CHAR16_T
-   #endif
+#ifdef _CHAR16T
+#define CHAR16_T
 #endif
 
 #include "mex.h"
 
-//*****************************************************************************
-// FUNCTION: mexFunction
-//>   The MATLAB Executable Gateway Function.
-//
-//    @todo Describe this MEX function
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
 void mexFunction(
         int nlhs, mxArray* plhs[],
@@ -93,5 +72,5 @@
 #endif
 
-   #pragma omp parallel for schedule(guided)
+   #pragma omp parallel for
    for (int cellp = 0; cellp < cells; ++cellp)
    {
Index: mkjer/Util/Math/fastcoeffvar.cpp
===================================================================
--- Damkjer/Util/Math/fastcoeffvar.cpp	(revision 15)
+++ 	(revision )
@@ -1,136 +1,0 @@
-//*****************************************************************************
-// FILE:        fastcoeffvar.cpp
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   This MEX source file provides a fast implementation of cov method for
-//    cell-arrays of real valued matrices.
-//<
-//
-// LIMITATIONS:
-//>   Does not work for cell-arrays of complex matrices.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifdef _OPENMP
-#include <omp.h>
-#endif
-
-#include <vector>
-
-//***
-// Fix "wide char" definition for older versions of MATLAB. This must be placed
-// after other includes and before the mex.h include.
-//***
-#if (defined(MATLAB_MAJOR) && defined(MATLAB_MINOR))
-   #if MATLAB_MAJOR <= 7 && MATLAB_MINOR <= 10 && defined(_CHAR16T)
-      #define CHAR16_T
-   #endif
-#endif
-
-#include "mex.h"
-
-//*****************************************************************************
-// FUNCTION: mexFunction
-//>   The MATLAB Executable Gateway Function.
-//
-//    Perform a parallelized computation of the coefficient of variance.
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void
-mexFunction(int nlhs, mxArray* plhs[],
-            int nrhs, const mxArray* prhs[])
-{
-   if (nrhs != 1 || !mxIsCell(prhs[0]))
-   {
-      mexErrMsgIdAndTxt("Damkjer:fastcoeffvar:varargin",
-                        "Missing or invalid input argument.");
-   }
-
-   if (nlhs > 1)
-   {
-      mexErrMsgIdAndTxt("Damkjer:fastcoeffvar:varargout",
-                        "Too many output arguments.");
-   }
-
-   mwSize cells = mxGetNumberOfElements (prhs[0]);
-
-   plhs[0] = mxCreateCellMatrix(cells, 1);
-
-   std::vector<const double*> vals(cells,0);
-   std::vector<mwSize> Ms(cells,0);
-   std::vector<mwSize> Ns(cells,0);
-
-   std::vector<mxArray*> covs(cells,0);
-   std::vector<double*> cov_vals(cells,0);
-
-   for (int cell = 0; cell < cells; ++cell)
-   {
-       vals[cell]=mxGetPr(mxGetCell(prhs[0], cell));
-       Ms[cell]=mxGetM(mxGetCell(prhs[0], cell));
-       Ns[cell]=mxGetN(mxGetCell(prhs[0], cell));
-       
-       covs[cell] = mxCreateDoubleMatrix(0, 0, mxREAL);
-       mxSetM(covs[cell], Ns[cell]);
-       mxSetN(covs[cell], Ns[cell]);
-       mxSetData(covs[cell], mxMalloc(sizeof(double)));
-       cov_vals[cell] = mxGetPr(covs[cell]);
-   }
-
-#ifdef _OPENMP
-   omp_set_dynamic(1);
-   omp_set_num_threads(omp_get_num_procs());
-#endif
-
-   #pragma omp parallel for schedule(guided)
-   for (int cellp = 0; cellp < cells; ++cellp)
-   {
-      std::vector<double> dist(Ms[cellp], 0.);
-      double mean=0;
-      
-      // calculate the average distance to this point
-      double w1 = 1./Ms[cellp];
-      
-      for (mwSize m = Ms[cellp]; m --> 0;)
-      {
-         for (mwSize n = Ns[cellp]; n --> 0;)
-         {
-            double diff = vals[cellp][m + Ms[cellp] * n]-vals[cellp][Ms[cellp] * n];
-            dist[n]+=diff*diff;
-         }
-
-         mean+=sqrt(dist[m])*w1;
-      }
-      
-      double w2 = 1./(Ms[cellp]-1);
-      
-      for (mwSize n = Ns[cellp]; n --> 0;)
-      {
-         cov_vals[cellp] = 0;
-
-         for (mwSize mc = Ms[cellp]; mc --> 0;)
-         {
-            cov_vals[cellp] +=
-               w2
-               * (vals[cellp][mc + Ms[cellp] * n]-mean[n]
-               * (vals[cellp][mc + Ms[cellp] * n]-vals[cellp][Ms[cellp] * n2]);
-         }
-      }
-   }
-
-   for (int cell = 0; cell < cells; ++cell)
-   {
-      mxSetCell(plhs[0], cell, covs[cell]);
-   }
-}
Index: Damkjer/Util/Math/fastcov.cpp
===================================================================
--- Damkjer/Util/Math/fastcov.cpp	(revision 15)
+++ Damkjer/Util/Math/fastcov.cpp	(revision 0)
@@ -1,14 +1,11 @@
-//*****************************************************************************
+//=========================================================================
 // FILE:        fastcov.cpp
 //
 //    Copyright (C)  2012 Kristian Damkjer.
 //
-// DESCRIPTION:
-//>   @todo Describe this file
-//<
+// DESCRIPTION: This MEX source file provides a fast implementation of cov
+//              method for cell-arrays of real valued matrices.
 //
-// LIMITATIONS:
-//>   Does not work for cell-arrays of complex matrices.
-//<
+// LIMITATIONS: Does not work for cell-arrays of complex matrices.
 //
 // SOFTWARE HISTORY:
@@ -16,5 +13,5 @@
 //               Initial Coding.
 //<
-//*****************************************************************************
+//=========================================================================
 
 #ifdef _OPENMP
@@ -23,30 +20,11 @@
 
 #include <vector>
-#include <sstream>
 
-//***
-// Fix "wide char" definition for older versions of MATLAB. This must be placed
-// after other includes and before the mex.h include.
-//***
-#if (defined(MATLAB_MAJOR) && defined(MATLAB_MINOR))
-   #if MATLAB_MAJOR <= 7 && MATLAB_MINOR <= 10 && defined(_CHAR16T)
-      #define CHAR16_T
-   #endif
+#ifdef _CHAR16T
+#define CHAR16_T
 #endif
 
 #include "mex.h"
 
-//*****************************************************************************
-// FUNCTION: mexFunction
-//>   The MATLAB Executable Gateway Function.
-//
-//    @todo Describe this MEX function
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
 void mexFunction(
         int nlhs, mxArray* plhs[],
@@ -58,6 +36,6 @@
                         "Missing or invalid input argument.");
    }
-
-   if (nlhs > 3)
+    
+   if (nlhs > 1)
    {
       mexErrMsgIdAndTxt("Damkjer:fastcov:varargout",
@@ -65,27 +43,8 @@
    }
    
-   mwSize cells = mxGetNumberOfElements(prhs[0]);
-//   mwSize ctrs  = mxGetNumberOfElements(prhs[1]);
+   mwSize cells = mxGetNumberOfElements (prhs[0]);
 
-//   if (useCenters && cells != ctrs)
-//   {
-//      mexErrMsgIdAndTxt("Damkjer:fastcov:varargout",
-//                        "Size of neighborhoods and centers does not agree.");
-//   }
-   
    plhs[0] = mxCreateCellMatrix(cells, 1);
 
-   // Better way?
-   if (nlhs > 1)
-   {
-      plhs[1] = mxCreateCellMatrix(cells, 1);
-   }
-   
-   // Better way?
-   if (nlhs > 2)
-   {
-      plhs[2] = mxCreateCellMatrix(cells, 1);
-   }
-   
    std::vector<const double*> vals(cells,0);
    std::vector<mwSize> Ms(cells,0);
@@ -95,13 +54,4 @@
    std::vector<double*> cov_vals(cells,0);
 
-   //HACK: Probably a more efficient way to do this
-   std::vector<mxArray*> dist2mean(cells,0);
-   std::vector<double*> dist2mean_vals(cells,0);
-   
-   //HACK: Probably a more efficient way to do this
-   std::vector<mxArray*> inty(cells,0);
-   std::vector<double*> inty_vals(cells,0);
-   
-   // Note for future: Ms - points, Ns - dimensions
    for (int cell = 0; cell < cells; ++cell)
    {
@@ -109,6 +59,5 @@
        Ms[cell]=mxGetM(mxGetCell(prhs[0], cell));
        Ns[cell]=mxGetN(mxGetCell(prhs[0], cell));
-
-       // We will be setting each value, so don't bother to initialize to zero.
+       
        covs[cell] = mxCreateDoubleMatrix(0, 0, mxREAL);
        mxSetM(covs[cell], Ns[cell]);
@@ -116,12 +65,4 @@
        mxSetData(covs[cell], mxMalloc(sizeof(double)*Ns[cell]*Ns[cell]));
        cov_vals[cell] = mxGetPr(covs[cell]);
-       
-       //HACK: Probably a more efficient way to do this
-       dist2mean[cell] = mxCreateDoubleMatrix(1, 1, mxREAL);
-       dist2mean_vals[cell] = mxGetPr(dist2mean[cell]);       
-       
-       //HACK: Probably a more efficient way to do this
-       inty[cell] = mxCreateDoubleMatrix(1, 1, mxREAL);
-       inty_vals[cell] = mxGetPr(inty[cell]);       
    }
 
@@ -131,25 +72,18 @@
 #endif
 
-   #pragma omp parallel for schedule(guided)
+   #pragma omp parallel for
    for (int cellp = 0; cellp < cells; ++cellp)
    {
       std::vector<double> mean(Ns[cellp], 0.);
-      std::vector<double> skewmean(Ns[cellp], 0.);
       
-      // Comment out to remove mean calculation when centering to first point.
       double w1 = 1./Ms[cellp];
       
       for (mwSize n = Ns[cellp]; n --> 0;)
       {
-         for (mwSize m = Ms[cellp]; m --> 1;)
+         for (mwSize m = Ms[cellp]; m --> 0;)
          {
             mean[n] += vals[cellp][m + Ms[cellp] * n] * w1;
          }
-         
-         skewmean[n] = mean[n] / ((Ms[cellp] - 1) * w1);
-         
-         mean[n] += vals[cellp][Ms[cellp] * n] * w1;
       }
-      // End comment.
       
       double w2 = 1./(Ms[cellp]-1);
@@ -157,6 +91,5 @@
       for (mwSize n1 = Ns[cellp]; n1 --> 0;)
       {
-//         for (mwSize n2 = Ns[cellp]; n2 --> 0;)
-         for (mwSize n2 = Ns[cellp]; n2 --> n1;)
+         for (mwSize n2 = Ns[cellp]; n2 --> 0;)
          {
             cov_vals[cellp][n2 + Ns[cellp] * n1] = 0;
@@ -164,55 +97,9 @@
             for (mwSize mc = Ms[cellp]; mc --> 0;)
             {
-               // Center to mean.
                cov_vals[cellp][n2 + Ns[cellp] * n1] +=
-                        w2
-                        * (vals[cellp][mc + Ms[cellp] * n1]-mean[n1])
-                        * (vals[cellp][mc + Ms[cellp] * n2]-mean[n2]);
-
-               // Center to first point.
-//               cov_vals[cellp][n2 + Ns[cellp] * n1] +=
-//                       w2
-//                       * (vals[cellp][mc + Ms[cellp] * n1]-vals[cellp][Ms[cellp] * n1])
-//                       * (vals[cellp][mc + Ms[cellp] * n2]-vals[cellp][Ms[cellp] * n2]);
-               // End comment.
+                       w2
+                       * (vals[cellp][mc + Ms[cellp] * n1]-mean[n1])
+                       * (vals[cellp][mc + Ms[cellp] * n2]-mean[n2]);
             }
-
-            cov_vals[cellp][n1 + Ns[cellp] * n2] =
-                                           cov_vals[cellp][n2 + Ns[cellp] * n1];
-         }
-      }
-      
-      if (nlhs > 1)
-      {
-         // Experiment: Estimate distance from first item to mean
-         
-         //std::vector<double> diff_loc(Ns[cellp], 0.);
-         //std::vector<double> diff_ext(Ns[cellp], 0.);
-
-         double diff_loc = 0;
-         double diff_ext = 0;
-         double temp;
-         
-         for (mwSize n = Ns[cellp]; n --> 0;)
-         {
-            // We can't assume anything about point ordering
-            temp = vals[cellp][Ms[cellp] * n] - skewmean[n];
-            diff_loc += temp * temp;
-            
-            temp = vals[cellp][Ms[cellp] * n] -
-                   vals[cellp][Ms[cellp] * (n + 1) - 1];
-            diff_ext +=  temp * temp;
-         }
-         
-//         dist2mean_vals[cellp][0] = std::sqrt(diff_loc)/std::sqrt(diff_ext);
-         dist2mean_vals[cellp][0] = std::sqrt(diff_loc);
-         // End comment.
-
-         if (nlhs > 2)
-         {
-            // Experiment: Estimate intensity, i.e., how "dense" is our mass?
-            // Assumes last point is farthest from first.
-            inty_vals[cellp][0] = Ms[cellp]/(4./3.*M_PI*diff_ext*sqrt(diff_ext));
-            // End comment.
          }
       }
@@ -223,19 +110,3 @@
       mxSetCell(plhs[0], cell, covs[cell]);
    }
-
-   if (nlhs > 1)
-   {
-      for (int cell = 0; cell < cells; ++cell)
-      {
-         mxSetCell(plhs[1], cell, dist2mean[cell]);
-      }
-   }
-
-   if (nlhs > 2)
-   {
-      for (int cell = 0; cell < cells; ++cell)
-      {
-         mxSetCell(plhs[2], cell, inty[cell]);
-      }
-   }
 }
Index: mkjer/Util/Math/fastsetdual.cpp
===================================================================
--- Damkjer/Util/Math/fastsetdual.cpp	(revision 15)
+++ 	(revision )
@@ -1,163 +1,0 @@
-//*****************************************************************************
-// FILE:        fastsetdual.cpp
-//
-//    Copyright (C)  2014 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   @todo Describe this file
-//<
-//
-// LIMITATIONS:
-//>   Does not work for cell-arrays of complex matrices.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2014-JAN-13  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifdef _OPENMP
-#include <omp.h>
-#endif
-
-#include <deque>
-#include <vector>
-#include <sstream>
-
-//***
-// Fix "wide char" definition for older versions of MATLAB. This must be placed
-// after other includes and before the mex.h include.
-//***
-#if (defined(MATLAB_MAJOR) && defined(MATLAB_MINOR))
-   #if MATLAB_MAJOR <= 7 && MATLAB_MINOR <= 10 && defined(_CHAR16T)
-      #define CHAR16_T
-   #endif
-#endif
-
-#include "mex.h"
-
-//*****************************************************************************
-// FUNCTION: mexFunction
-//>   The MATLAB Executable Gateway Function.
-//
-//    @todo Describe this MEX function
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void mexFunction(
-        int nlhs, mxArray* plhs[],
-        int nrhs, const mxArray* prhs[])
-{
-   if (nrhs != 1 || !mxIsCell(prhs[0]))
-   {
-      mexErrMsgIdAndTxt("Damkjer:fastsetdual:varargin",
-                        "Missing or invalid input argument.");
-   }
-
-   if (!(mxIsUint32(mxGetCell(prhs[0], 0)) ||
-         mxIsUint64(mxGetCell(prhs[0], 0))))
-   {
-      mexErrMsgIdAndTxt("Damkjer:fastsetdual:varargin",
-                        "Invalid input argument.");
-   }
-
-   if (nlhs != 1)
-   {
-      mexErrMsgIdAndTxt("Damkjer:fastsetdual:varargout",
-                        "Fast set dual requires a single output.");
-   }
-   
-   mwSize cells = mxGetNumberOfElements (prhs[0]);
-
-   std::vector<const mwSize*> nbrs(cells,0);
-   std::vector<mwSize> Ms(cells,0);
-   std::vector<mwSize> Ns(cells,0);
-
-   mwSize maxElem = 0;
-   
-   // Note for future: Ms - neighbors, Ns - 1
-   for (mwSize cell = 0; cell < cells; ++cell)
-   {      
-      nbrs[cell]=(mwIndex*)(mxGetData(mxGetCell(prhs[0], cell)));
-      Ms[cell]=mxGetM(mxGetCell(prhs[0], cell));
-      Ns[cell]=mxGetN(mxGetCell(prhs[0], cell));
-       
-      for (mwSize n = Ns[cell]; n --> 0;)
-      {
-         for (mwSize m = Ms[cell]; m --> 0;)
-         {
-            mwSize idx = nbrs[cell][m + Ms[cell] * n];
-            maxElem = (idx > maxElem) ? idx : maxElem;
-         }
-      }
-   }
-   
-   std::deque<std::vector<mwSize> > duals(maxElem);
-
-   for (mwSize cell = 0; cell < cells; ++cell)
-   {
-      for (mwSize n = Ns[cell]; n --> 0;)
-      {
-         for (mwSize m = Ms[cell]; m --> 0;)
-         {
-            mwIndex idx = nbrs[cell][m + Ms[cell] * n];
-            duals[idx-1].push_back(cell + 1);
-         }  
-      }
-   }
-   
-   plhs[0] = mxCreateCellMatrix(maxElem, 1);
-   
-   std::deque<mxArray*> returns;
-   std::deque<mwIndex*> return_data;
-   
-   //***
-   // Allocating memory for the results to be passed back to MATLAB must take
-   // place in a "critical section" since it involves exercising the MEX API.
-   //***
-   for (std::size_t elem = 0; elem < maxElem; ++elem)
-   {
-      mwSize neighborhoods = duals[elem].size();
-
-      returns.push_back(mxCreateNumericMatrix(0, 0, mxINDEX_CLASS, mxREAL));
-      mxSetM(returns[elem], neighborhoods);
-      mxSetN(returns[elem], 1);
-      mxSetData(returns[elem], mxMalloc(sizeof(mwIndex)*neighborhoods*1));
-      
-      return_data.push_back((mwIndex*)mxGetData(returns[elem]));
-   }
-
-   //***
-   // Once memory has been allocated, the actual results can be populated in
-   // parallel.
-   //***
-   #pragma omp parallel for schedule(guided)
-   for (int elem = 0; elem < maxElem; ++elem)
-   {  
-      std::size_t size_elem = static_cast<std::size_t>(elem);
-      mwSize neighborhoods = duals[elem].size();
-
-      mwIndex* data = return_data[size_elem];
-      
-      for (mwIndex idx = neighborhoods; idx --> 0;)
-      {
-         data[idx]=duals[elem][idx];
-      }
-   }
-
-   //***
-   // Marking the data for return to MATLAB must take place in a "critical 
-   // section" since it involves exercising the MEX API. This also changes
-   // ownership and memory management responsibilities to MATLAB. We will not
-   // free this data.
-   //***   
-   for (std::size_t elem = 0; elem < maxElem; ++elem)
-   {
-      mxSetCell(plhs[0], elem, returns[elem]);
-   }
-}
Index: mkjer/Util/Math/fastsetunion.cpp
===================================================================
--- Damkjer/Util/Math/fastsetunion.cpp	(revision 13)
+++ 	(revision )
@@ -1,131 +1,0 @@
-//*****************************************************************************
-// FILE:        fastsetdual.cpp
-//
-//    Copyright (C)  2014 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   @todo Describe this file
-//<
-//
-// LIMITATIONS:
-//>   Does not work for cell-arrays of complex matrices.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2014-JAN-13  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifdef _OPENMP
-#include <omp.h>
-#endif
-
-#include <set>
-#include <deque>
-#include <vector>
-#include <sstream>
-
-//***
-// Fix "wide char" definition for older versions of MATLAB. This must be placed
-// after other includes and before the mex.h include.
-//***
-#if (defined(MATLAB_MAJOR) && defined(MATLAB_MINOR))
-   #if MATLAB_MAJOR <= 7 && MATLAB_MINOR <= 10 && defined(_CHAR16T)
-      #define CHAR16_T
-   #endif
-#endif
-
-#include "mex.h"
-
-//*****************************************************************************
-// FUNCTION: mexFunction
-//>   The MATLAB Executable Gateway Function.
-//
-//    @todo Describe this MEX function
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void mexFunction(
-        int nlhs, mxArray* plhs[],
-        int nrhs, const mxArray* prhs[])
-{  
-   if (nrhs < 1 || !mxIsCell(prhs[0]))
-   {
-      mexErrMsgIdAndTxt("Damkjer:fastsetdual:varargin",
-                        "Missing or invalid input argument.");
-   }
-
-   if (!(mxIsUint32(mxGetCell(prhs[0], 0)) ||
-         mxIsUint64(mxGetCell(prhs[0], 0))))
-   {
-      mexErrMsgIdAndTxt("Damkjer:fastsetdual:varargin",
-                        "Invalid input argument.");
-   }
-
-   if (nlhs > 1)
-   {
-      mexErrMsgIdAndTxt("Damkjer:fastsetdual:varargout",
-                        "Fast set dual requires a single output.");
-   }
-   
-   mwSize cells = mxGetNumberOfElements (prhs[0]);
-
-   std::vector<const mwSize*> nbrs(cells,0);
-
-   std::set<mwIndex> setUnion;
-   
-   // Note for future: Ms - neighbors, Ns - 1
-   for (mwSize cell = 0; cell < cells; ++cell)
-   {      
-      nbrs[cell]=(mwIndex*)(mxGetData(mxGetCell(prhs[0], cell)));
-
-      mwSize Ms = mxGetM(mxGetCell(prhs[0], cell));
-      
-      for (mwSize n = mxGetN(mxGetCell(prhs[0], cell)); n --> 0;)
-      {
-         for (mwSize m = Ms; m --> 0;)
-         {
-            setUnion.insert(nbrs[cell][m + Ms * n]);
-         }
-      }
-   }
-   
-   mwIndex* return_data;
-    
-   //***
-   // Allocating memory for the results to be passed back to MATLAB must take
-   // place in a "critical section" since it involves exercising the MEX API.
-   //***
-   mwSize neighbors = setUnion.size();
-
-   plhs[0] = mxCreateNumericMatrix(0, 0, mxINDEX_CLASS, mxREAL);
-   mxSetM(plhs[0], neighbors);
-   mxSetN(plhs[0], 1);
-   mxSetData(plhs[0], mxMalloc(sizeof(mwIndex)*neighbors*1));
-       
-   return_data = (mwIndex*)mxGetData(plhs[0]);
-
-   std::size_t nbr = 0;
-   
-   for (std::set<mwIndex>::iterator itr = setUnion.begin();
-        itr != setUnion.end();
-        ++itr)
-   {
-      return_data[nbr] = *itr;
-      ++nbr;
-   }
-   
-//    //***
-//    // Marking the data for return to MATLAB must take place in a "critical 
-//    // section" since it involves exercising the MEX API. This also changes
-//    // ownership and memory management responsibilities to MATLAB. We will not
-//    // free this data.
-//    //***   
-// 
-//    mxSetCell(plhs[0], 0, returns);
-}
Index: Damkjer/Util/Math/makeMath.m
===================================================================
--- Damkjer/Util/Math/makeMath.m	(revision 13)
+++ Damkjer/Util/Math/makeMath.m	(revision 0)
@@ -22,74 +22,58 @@
 function makeMath(varargin)
 
-command = 'mex -largeArrayDims -D_USE_MATH_DEFINES';
-
-matlab_ver = regexp(version, '[. ]', 'split');
-command = [command...
-           ' -DMATLAB_MAJOR=' matlab_ver{1}...
-           ' -DMATLAB_MINOR=' matlab_ver{2}...
-           ' -DMATLAB_REVIS=' matlab_ver{3}...
-           ' -DMATLAB_BUILD=' matlab_ver{4}...
-           ' -DMATLAB_REL=' matlab_ver{5}(2:end-1)];
+command = 'mex -largeArrayDims';
 
 flags = {'verbose', 'debug', 'warnings', 'parallel'};
-options = '';
+options=[];
 
 while ~isempty(varargin)
-   flag = varargin{1};
-   % If the property has been supplied in a shortened form, lengthen it
-   iFlag = find(strncmpi(flag, flags, length(flag)));
-   
-   if isempty(iFlag)
-      options = strcat(options, ' ', flag);
-      
-      % Pass through any arguments we don't recognize, alternatively escalate
-      % to an error.
-%       error('Damkjer:makeVpsTree:InvalidFlag', ['Invalid Flag: ' flag]);
-   elseif length(iFlag) > 1
-      error('Damkjer:makeMath:AmbiguousFlag', ...
-            ['Supplied shortened flag is ambiguous: ' flag]);
-   else
-      flag = flags{iFlag};
-      
-      switch flag
-         case 'verbose'
-            command = strcat(command, ' -v');
-         case 'debug'
-            command = strcat(command, ' -g');
-         case 'parallel'
-            if (ispc)
-               command = strcat(command, ' COMPFLAGS="$COMPFLAGS /openmp"');
-            else
-               command = strcat(command, ' CFLAGS="\$CFLAGS -fopenmp"',...
-                                         ' CXXFLAGS="\$CXXFLAGS -fopenmp"',...
-                                         ' LDFLAGS="\$LDFLAGS -fopenmp"');
-            end
-         case 'warnings'
-            if (ispc)
-               command = strcat(command, ' -v COMPFLAGS="$COMPFLAGS -W3"');
-            else
-               command = strcat(command, ' -v',...
-                                         ' CFLAGS="\$CFLAGS -Wall -Wextra"',...
-                                         ' CXXFLAGS="\$CXXFLAGS -Wall -Wextra"');
-            end
-         otherwise
-            error('Damkjer:makeVpsTree:NotImplementedFlag', ...
-                  ['Flag recognized, but not supported (oops): ' flag]);
-      end % switch property
-   end
-   
-   varargin(1) = [];
+    flag = varargin{1};
+    % If the property has been supplied in a shortened form, lengthen it
+    iFlag = find(strncmpi(flag, flags, length(flag)));
+    
+    if isempty(iFlag)
+       options=[options ' ' flag];
+       error('Damkjer:makeVpsTree:InvalidFlag', ['Invalid Flag: ' flag]);
+    elseif length(iFlag) > 1
+        error('Damkjer:makeColorize:AmbiguousFlag', ...
+              ['Supplied shortened flag is ambiguous: ' flag]);
+    else
+        flag = flags{iFlag};
+
+        switch flag
+            case 'verbose'
+                command = [command ' -v'];
+            case 'debug'
+                command = [command ' -g'];
+            case 'parallel'
+                if (ispc)
+                    command = [command ' COMPFLAGS="$COMPFLAGS /openmp"'];
+                else
+                    command = [command ' CFLAGS="\$CFLAGS -fopenmp"' ...
+                                       ' CXXFLAGS="\$CXXFLAGS -fopenmp"' ...
+                                       ' LDFLAGS="\$LDFLAGS -fopenmp"'];
+                end
+            case 'warnings'
+                if (ispc)
+                    command = [command ' -v COMPFLAGS="$COMPFLAGS -W3"'];
+                else
+                    command = [command ' -v' ...
+                                       ' CFLAGS="\$CFLAGS -Wall -Wextra"' ...
+                                       ' CXXFLAGS="\$CXXFLAGS -Wall -Wextra"'];
+                end
+            otherwise
+                error('Damkjer:makeVpsTree:NotImplementedFlag', ...
+                    ['Flag recognized, but not supported (oops): ' flag]);
+        end % switch property
+    end
+
+    varargin(1) = [];
 end % while
 
 [path,~,~]=fileparts(mfilename('fullpath'));
-command = [command options ' -I' fullfile(path,'..','..','..')...
-           ' -I' fullfile(path,'..','..','includes','eigen')...
-           ' -outdir ' path ' ' path '/'];
+command = [command options ' -I' path '/../../.. -outdir ' path ' ' path '/'];
 
 eval([command 'fastcov.cpp']);
 eval([command 'fastcenter.cpp']);
-eval([command 'par_eig.cpp']);
-eval([command 'fastsetdual.cpp']);
-eval([command 'fastsetunion.cpp']);
 
 end
Index: mkjer/Util/Math/par_eig.cpp
===================================================================
--- Damkjer/Util/Math/par_eig.cpp	(revision 15)
+++ 	(revision )
@@ -1,175 +1,0 @@
-//*****************************************************************************
-// FILE:        par_eig.cpp
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   @todo Describe this file
-//<
-//
-// LIMITATIONS:
-//>   Does not work for cell-arrays of complex matrices.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2013-JUL-03  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifdef _OPENMP
-#include <omp.h>
-#endif
-
-#include <vector>
-#include <sstream>
-
-//***
-// Fix "wide char" definition for older versions of MATLAB. This must be placed
-// after other includes and before the mex.h include.
-//***
-#if (defined(MATLAB_MAJOR) && defined(MATLAB_MINOR))
-   #if MATLAB_MAJOR <= 7 && MATLAB_MINOR <= 10 && defined(_CHAR16T)
-      #define CHAR16_T
-   #endif
-#endif
-
-#include <Eigen/Dense>
-
-#include "mex.h"
-
-//*****************************************************************************
-// FUNCTION: mexFunction
-//>   The MATLAB Executable Gateway Function.
-//
-//    @todo Describe this MEX function
-//
-//    @param nlhs the number of left-hand side parameters.
-//    @param plhs the array of left-hand side parameters.
-//    @param nrhs the number of right-hand side parameters.
-//    @param prhs the array of right-hand side parameters.
-//<
-//*****************************************************************************
-void mexFunction(
-        int nlhs, mxArray* plhs[],
-        int nrhs, const mxArray* prhs[])
-{
-   if (nrhs != 1 || !mxIsCell(prhs[0]))
-   {
-      mexErrMsgIdAndTxt("Damkjer:fastcov:varargin",
-                        "Missing or invalid input argument.");
-   }
-    
-   if (nlhs > 2)
-   {
-      mexErrMsgIdAndTxt("Damkjer:fastcov:varargout",
-                        "Too many output arguments.");
-   }
-   
-   mwSize cells = mxGetNumberOfElements (prhs[0]);
-
-   plhs[0] = mxCreateCellMatrix(cells, 1);
-
-   // Better way?
-   if (nlhs > 1)
-   {
-      plhs[1] = mxCreateCellMatrix(cells, 1);
-   }
-   
-   std::vector<double*> data(cells,0);
-   std::vector<mwSize> Ms(cells,0);
-   std::vector<mwSize> Ns(cells,0);
-
-   std::vector<mxArray*> vecs(cells,0);
-   std::vector<double*> vecs_data(cells,0);
-
-   std::vector<mxArray*> vals(cells,0);
-   std::vector<double*> vals_data(cells,0);
-   
-   // Note for future: Ms - points, Ns - dimensions
-   for (int cell = 0; cell < cells; ++cell)
-   {
-       data[cell]=mxGetPr(mxGetCell(prhs[0], cell));
-       Ms[cell]=mxGetM(mxGetCell(prhs[0], cell));
-       Ns[cell]=mxGetN(mxGetCell(prhs[0], cell));
-   }
-
-   // Always return values as vector
-   for (int cell = 0; cell < cells; ++cell)
-   {
-      // We will be setting each value, so don't bother to initialize to zero.
-      vals[cell] = mxCreateDoubleMatrix(0, 0, mxREAL);
-      mxSetM(vals[cell], Ms[cell]);
-      mxSetN(vals[cell], 1);
-      mxSetData(vals[cell], mxMalloc(sizeof(double)*Ms[cell]));
-      vals_data[cell] = mxGetPr(vals[cell]);         
-   }
-
-#ifdef _OPENMP
-   omp_set_dynamic(1);
-   omp_set_num_threads(omp_get_num_procs());
-#endif
-
-   #pragma omp parallel for schedule(guided)
-   for (int cellp = 0; cellp < cells; ++cellp)
-   {
-      Eigen::VectorXd eivals = 
-              Eigen::Map<Eigen::MatrixXd>(data[cellp], Ms[cellp], Ns[cellp]).
-              selfadjointView<Eigen::Lower>().eigenvalues();
-      
-      for (mwSize m = Ms[cellp]; m --> 0;)
-      {
-         vals_data[cellp][m] = eivals(m);
-      }
-   }
-      
-   if (nlhs < 2)
-   {
-      // Only return values as vector
-      for (int cell = 0; cell < cells; ++cell)
-      {
-         mxSetCell(plhs[0], cell, vals[cell]);
-      }
-   }
-   else
-   {
-      // Return both values and vectors as matices
-      for (int cell = 0; cell < cells; ++cell)
-      {
-         // We will be setting each value, so don't bother to initialize to zero.
-         vecs[cell] = mxCreateDoubleMatrix(0, 0, mxREAL);
-         mxSetM(vecs[cell], Ms[cell]);
-         mxSetN(vecs[cell], Ns[cell]);
-         mxSetData(vecs[cell], mxMalloc(sizeof(double)*Ms[cell]*Ns[cell]));
-         vecs_data[cell] = mxGetPr(vecs[cell]);
-      }
-
-#ifdef _OPENMP
-   omp_set_dynamic(1);
-   omp_set_num_threads(omp_get_num_procs());
-#endif
-
-      #pragma omp parallel for schedule(guided)
-      for (int cellp = 0; cellp < cells; ++cellp)
-      {
-         Eigen::SelfAdjointEigenSolver<Eigen::MatrixXd>
-         eig(Eigen::Map<Eigen::MatrixXd>(data[cellp], Ms[cellp], Ns[cellp]));
-         
-         Eigen::MatrixXd eivecs=eig.eigenvectors();
-         
-         for (mwSize m = Ms[cellp]; m --> 0;)
-         {
-            for (mwSize n = Ns[cellp]; n --> 0;)
-            {
-               vecs_data[cellp][n + Ns[cellp] * m] = eivecs(n,m);
-            }
-         }
-      }
-      
-      for (int cell = 0; cell < cells; ++cell)
-      {
-         mxSetCell(plhs[0], cell, vecs[cell]);
-         mxSetCell(plhs[1], cell, vals[cell]);
-      }
-   }
-}
Index: mkjer/Util/Math/quadricfit.m
===================================================================
--- Damkjer/Util/Math/quadricfit.m	(revision 6)
+++ 	(revision )
@@ -1,37 +1,0 @@
-function [ Q, center ] = quadricfit( pnts )
-%ELLIPSOIDFIT Summary of this function goes here
-%   Detailed explanation goes here
-
-size(pnts)
-
-if (size(pnts,1)==3)
-   pnts=[pnts;ones(1,size(pnts,2))];
-end
-
-if (size(pnts,1)~=4)
-   error 'Points must be 3D'
-end
-
-A=[(pnts(1,:).^2)', ...         %x^2
-   (pnts(1,:).*pnts(2,:))', ... %xy
-   (pnts(1,:).*pnts(3,:))', ... %xz
-   (pnts(2,:).^2)', ...         %y^2
-   (pnts(2,:).*pnts(3,:))', ... %yz
-   (pnts(3,:).^2)', ...         %z^2
-   pnts(1,:)', ...              %x
-   pnts(2,:)', ...              %y
-   pnts(3,:)', ...              %z
-   pnts(4,:)'];                 %w
-
-QQ=null(A);
-
-Q=[QQ(1),  QQ(2)/2,QQ(3)/2,QQ(7)/2;
-   QQ(2)/2,QQ(4),  QQ(5)/2,QQ(8)/2;
-   QQ(3)/2,QQ(5)/2,QQ(6),  QQ(9)/2;
-   QQ(7)/2,QQ(8)/2,QQ(9)/2,QQ(10)];
-
-Q=Q/Q(4,4);
-
-center=Q(1:3,1:3)\Q(1:3,4);
-end
-
Index: mkjer/Util/Math/timeFormat.m
===================================================================
--- Damkjer/Util/Math/timeFormat.m	(revision 6)
+++ 	(revision )
@@ -1,60 +1,0 @@
-% timeFormat   Format seconds as hh:mm:ss.000
-%
-% File:
-%    timeFormat.m
-%
-% Description:
-%    This MATLAB function converts a number representing seconds to a string
-%    format as hh:mm:ss.000.
-%
-% Limitations:
-%    None.
-%
-% Synopsis:
-%    [msg] = timeFormat(seconds)
-%
-% Inputs:
-%    seconds  - A numeric representing time in seconds.
-%
-% Outputs:
-%    msg  - A string representation of seconds in hh:mm:ss.000 format.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    None.
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2013 Kristian L. Damkjer.
-%
-% Software History:
-%    2013-JUN-20   K. Damkjer
-%       Initial Coding.
-%
-
-function [msg] = timeFormat(seconds)
-
-h = floor(seconds/3600);
-m = floor((seconds - h * 3600)/60);
-s = mod(seconds, 60);
-
-if (h > 0)
-   msg = [num2str(h,'%02d') ':' num2str(m,'%02d') ':' num2str(s,'%06.3f')];
-elseif (m > 0)
-   msg = [num2str(m,'%02d') ':' num2str(s,'%06.3f')];
-else
-   msg = ['0:' num2str(s,'%06.3f')];
-end
-   
-end
-
Index: Damkjer/Util/SpatialIndexing/FRANN.m
===================================================================
--- Damkjer/Util/SpatialIndexing/FRANN.m	(revision 0)
+++ Damkjer/Util/SpatialIndexing/FRANN.m	(revision 0)
@@ -0,0 +1,482 @@
+function [NN] = FRANN(varargin)
+%%
+% FRANN    short description probably needs a better name now that I'm
+%            not always performing a convolution.
+%
+%   NN = FRANN(X) ...
+%
+%   NN = FRANN(P, X) ...
+%
+%   NN = FRANN(I, X) ...
+%
+%   IDX = FRANN(..., Property, Value)
+%   Calls FRANN with the indicated parameters set. Property names can be
+%   supplied as just the first letters of the property name if this is
+%   unambiguous, e.g. PSFCONV(..., 'sig', [1 1 0.15]) is equivalent to
+%   PSFCONV(..., 'Sigmas', [1 1 0.15]). Properties are case insensitive,
+%   and are as follows:
+%      Property:                         Value:
+%      ---------                         ------
+%      PointWeights                      ...
+%      Sigmas                            ...
+%      Mode                              {'count', 'intensity', 'noise'},
+%                                        default: 'noise'
+%            FRANN(..., 'Mode', M) computes 'density' according to the
+%            requested mode. 'count' simply provides a raw count of
+%            adjacent pixels in the local neighborhood defined by the PSF 
+%            SDV reach. 'intensity' provides an estimate of signal strength
+%            by convolving the detections with the PSF. 'noise' provides an
+%            estimate of noise likelihood using a Bayesian analysis of the
+%            detection population and PSF.
+%      TODO: Add SDVs or CI
+%      TODO: Add SNR or SignalProb
+%
+%   Example:
+%
+%   See also 
+
+%% Default parameters
+userParams.radius = 1;
+
+%% Parse inputs
+[P, X, isNotSubset, userParams] = parseinputs(userParams, varargin{:});
+
+% userParams.Radius=userParams.Radius*userParams.sdvs
+
+% %% First scale into SDV space
+% sigmaScale=diag(1./userParams.Sigmas);
+% X=sigmaScale*X;
+% P=sigmaScale*P;
+
+%% Establish the bucket origin and dimensions
+origin=min(X,[],2);
+extent=max(X,[],2);
+cover=extent-origin;
+lengths=ceil(cover/userParams.radius)+2; % plus 2*reach is better... if we use reach
+
+spacing=userParams.radius*ones(1,length(lengths));
+
+rsq=userParams.radius*userParams.radius;
+
+[dimensions,population]=size(X);
+estimates=size(P,2);
+
+% gaussConst=1/((2*pi())^(dimensions/2));
+% dConst=-0.5;
+
+%% Compute n-dimensional bin offsets for adjacency checks
+tic;
+reach=1;
+
+offsets=zeros(dimensions,power(2*reach+1,dimensions));
+
+for dimension=1:dimensions
+    reps=power(2*reach+1,dimensions-dimension);
+    cycles=power(2*reach+1,dimension-1);
+
+    offset=1;
+    for cycle=1:cycles
+        for value=-reach:reach
+            for rep=1:reps
+                offsets(dimension,offset)=value;
+                offset=offset+1;
+            end
+        end
+    end
+end
+
+offidxs=offsets(1,:);
+
+for dimension=2:dimensions
+    offidxs=offidxs+prod(lengths(1:dimension-1))*offsets(dimension,:);
+end
+
+clear offsets;
+
+disp(['Time to compute offsets: ' num2str(toc) 's']);
+
+%% Compute bin subscripts for requested points and population
+tic;
+
+xsubs=zeros(size(X));
+psubs=zeros(size(P));
+
+for dimension=1:dimensions
+    xsubs(dimension,:)=ceil((X(dimension,:)-origin(dimension))/...
+                                                spacing(dimension))+1;
+    psubs(dimension,:)=ceil((P(dimension,:)-origin(dimension))/...
+                                                spacing(dimension))+1;
+end
+
+disp(['Time to compute subscripts: ' num2str(toc) 's']);
+
+%% Convert subscripts to linear indices for fast indexing
+tic;
+
+xidxs=xsubs(1,:);
+pidxs=psubs(1,:);
+
+for dimension=2:dimensions
+    xidxs=xidxs+prod(lengths(1:dimension-1))*(xsubs(dimension,:)-1);
+    pidxs=pidxs+prod(lengths(1:dimension-1))*(psubs(dimension,:)-1);
+end
+
+bidxs=unique(xidxs); % bin indices
+vidxs=unique(pidxs); % visitation indices
+
+clear xsubs;
+clear psubs;
+
+disp(['Time to identify unique indices: ' num2str(toc) 's']);
+
+%% Make sure we visit all of the necessary bins when processing a subset
+tic;
+
+baks=[vidxs' ones(length(vidxs),1)] *...
+     [ones(1,length(offidxs(:,offidxs<0)));offidxs(:,offidxs<0)];
+
+% NOTE: We only need to visit populated bins
+vidxs=intersect(bidxs,unique([baks(:)' vidxs]));
+
+disp(['Time to identify back-adjacent cells: ' num2str(toc) 's']);
+
+%% Map hash indices to linear indices (sparsely)
+%  NOTE: we only need to map observations that contribute to estimates
+blu=sparse(vidxs,ones(1,length(vidxs)),1:length(vidxs),prod(lengths),1);
+
+%% Only keep positive offsets since we have verified that we can safely
+% propagate a wavefront in one direction per dimension.
+offidxs=offidxs(:,offidxs>0);
+
+%%
+%%% Bin points for faster searching (O(n+k) vs O(n*n))
+
+%% Determine the size of each populated bin and contained observations
+tic;
+
+bsz=zeros(1,length(vidxs),'int32');
+bpt=zeros(1,population,'int32');
+
+msg='Determining Observation Bin Vital Statistics...';
+tstart=tic;
+h = timebar(1, population, msg, tstart);
+
+for point=1:population
+    if (toc>1)
+        tic;
+        h = timebar(point, population, msg, tstart, h);
+    end
+    
+    bin=blu(xidxs(point));
+    
+    if (bin ~= 0)
+        bsz(bin)=bsz(bin)+1;
+        bpt(point)=bsz(bin);
+    end
+end
+
+if (all(ishghandle(h, 'figure')))
+    close(h);
+end
+
+disp(['Time to determine observation bin statistics: '...
+    num2str(toc(tstart)) 's']);
+
+%% Determine the size of each populated bin and contained observation
+if (isNotSubset)
+    tic;
+
+    vsz=zeros(1,length(vidxs),'int32');
+    vpt=zeros(1,estimates,'int32');
+    
+    msg='Determining Estimate Bin Vital Statistics...';
+    tstart=tic;
+    h = timebar(1, estimates, msg, tstart);
+    
+    for point=1:estimates
+        if (toc>1)
+            tic;
+            h = timebar(point, estimates, msg, tstart, h);
+        end
+        
+        bin=blu(pidxs(point));
+        
+        if (bin ~= 0)
+            vsz(bin)=vsz(bin)+1;
+            vpt(point)=vsz(bin);
+        end
+    end
+    
+    if (all(ishghandle(h, 'figure')))
+        close(h);
+    end
+    
+    disp(['Time to determine estimate bin statistics: '...
+        num2str(toc(tstart)) 's']);
+end
+
+%% Allocate space for the binned data
+tic;
+
+obins=cell(1,length(vidxs));
+
+for bin=1:numel(obins)
+    obins{bin}=zeros(1,bsz(bin),'int32');
+end
+
+clear bsz;
+
+if (isNotSubset)
+    ebins=cell(1,length(vidxs));
+    
+    for bin=1:numel(ebins)
+        ebins{bin}=zeros(1,vsz(bin),'int32');
+    end
+    
+    clear vsz;
+end
+
+disp(['Time to allocate bins: ' num2str(toc) 's']);
+
+%% Populate the bins
+msg='Populating observation bins...';
+tstart=tic;
+h = timebar(1, population, msg, tstart);
+
+for point=1:population;
+    if (toc>1)
+        tic;
+        h = timebar(point, population, msg, tstart, h);
+    end
+
+    bin=blu(xidxs(point));
+    
+    if (bin>0)
+        obins{bin}(bpt(point))=point;
+    end
+end
+
+if (all(ishghandle(h, 'figure')))
+    close(h);
+end
+
+clear bpt;
+
+if (isNotSubset)
+    msg='Populating estimation bins...';
+    tstarte=tic;
+    h = timebar(1, estimates, msg, tstarte);
+    
+    for point=1:estimates;
+        if (toc>1)
+            tic;
+            h = timebar(point, estimates, msg, tstarte, h);
+        end
+        
+        bin=blu(pidxs(point));
+        
+        if (bin>0)
+            ebins{bin}(vpt(point))=point;
+        end
+    end
+    
+    if (all(ishghandle(h, 'figure')))
+        close(h);
+    end
+    
+    clear vpt;
+end
+
+disp(['Time to populate bins: ' num2str(toc(tstart)) 's']);
+
+%% Compute densities
+
+if (isNotSubset)
+    NN=cell(1,estimates);
+%      NN=zeros(1,estimates);
+else
+    NN=cell(1,population);
+%      NN=zeros(1,population);
+end
+
+msg='Computing Neighbors...';
+tstart=tic;
+h = timebar(1, length(vidxs), msg, tstart);
+
+for bin=1:length(vidxs)
+    if (toc>1)
+        tic;
+        h = timebar(bin, length(vidxs), msg, tstart, h);
+    end
+
+    % Local indices for observations
+    loidxs=[obins{blu(vidxs(bin))}];
+    lopts=X(:,loidxs);
+
+    % Local indices for requested point estimates (copy-paste code since
+    % there's no way to create an alias in MATLAB that I'm aware of)
+    if (isNotSubset)
+        leidxs=[ebins{blu(vidxs(bin))}];
+        lepts=P(:,leidxs);
+ 
+        % Compute weight for local cell contributions
+        locd=bsxfun(@plus,dot(lepts,lepts,1)',dot(lopts,lopts,1))-...
+            2*(lepts'*lopts);
+        
+        mapping=repmat(loidxs,length(leidxs),1);
+        mapping(locd>rsq)=0;
+        
+        for i=1:size(mapping,1)
+            neighbors=mapping(i,:);
+            NN{leidxs(i)}=[NN{leidxs(i)} neighbors(neighbors>0)];
+        end
+        
+    else
+        % Compute weight for local cell contributions
+        locd=bsxfun(@plus,dot(lopts,lopts,1)',dot(lopts,lopts,1))-...
+            2*(lopts'*lopts);
+        
+        mapping=repmat(loidxs,length(loidxs),1);
+        mapping(locd>rsq)=0;
+        
+        for i=1:size(mapping,1)
+            neighbors=mapping(i,:);
+            NN{loidxs(i)}=[NN{loidxs(i)} neighbors(neighbors>0)];
+        end
+    end
+
+    % Compute weight for forward-adjacent cell contributions
+    offs=offidxs+vidxs(bin);
+    offs=offs(blu(offs)~=0);
+
+    if (~isempty(offs))
+        % Adjacent indices for observations
+        aoidxs=[obins{blu(offs)}];
+        aopts=X(:,aoidxs);
+        
+        % Adjacent indices for requested point estimates (copy-paste code
+        % since there's no way to create an alias in MATLAB that I'm aware
+        % of)
+        if (isNotSubset)
+            aeidxs=[ebins{blu(offs)}];
+            aepts=X(:,aeidxs);
+            
+            % Calculate influence of adjacent observations on local estimates
+            led=bsxfun(@plus,dot(lepts,lepts,1)',dot(aopts,aopts,1))-...
+                2*(lepts'*aopts);
+            
+            % Calculate influence of local observations on adjacent estimates
+            aed=bsxfun(@plus,dot(aepts,aepts,1)',dot(lopts,lopts,1))-...
+                2*(aepts'*lopts);
+        
+            % Remove contributors outside reach
+%             wl(led>rsq)=0;
+%             wa(aed>rsq)=0;
+        else
+            % Calculate influence of adjacent observations on local estimates
+            ed=bsxfun(@plus,dot(lopts,lopts,1)',dot(aopts,aopts,1))-2*(lopts'*aopts);
+            
+            % Remove contributors outside reach
+            mappingla=repmat(aoidxs,length(loidxs),1);
+            mappingal=repmat(loidxs,length(aoidxs),1);
+            mappingla(ed>rsq)=0;
+            mappingal(ed'>rsq)=0;
+            
+            for i=1:size(mappingla,1)
+                neighbors=mappingla(i,:);
+                NN{loidxs(i)}=[NN{loidxs(i)} neighbors(neighbors>0)];
+            end
+            for i=1:size(mappingal,1)
+                neighbors=mappingal(i,:);
+                NN{aoidxs(i)}=[NN{aoidxs(i)} neighbors(neighbors>0)];
+            end
+        end
+    end
+end
+
+% Down-select density to only desired points
+if (~isNotSubset && numel(X) ~= numel(P))
+    NN=NN(:,ismember(X',P','rows'));
+end
+
+if (all(ishghandle(h, 'figure')))
+    close(h);
+end
+
+disp(['Time to compute neighbors: ' num2str(toc(tstart)) 's']);
+
+end % psfConv
+
+%%
+%PARSEINPUTS    Support function for nearestneighbour
+function [P, X, isNotSubset, userParams] = parseinputs(userParams, varargin)
+if length(varargin) == 1 || ~isnumeric(varargin{2})
+    P           = varargin{1};
+    X           = varargin{1};
+    isNotSubset = false;
+    varargin(1) = [];
+else
+    P             = varargin{1};
+    X             = varargin{2};
+    varargin(1:2) = [];
+    isNotSubset = true;
+    
+    % Check the dimensions of X and P
+    if size(X, 1) ~= 1
+        % Check to see whether P is in fact a vector of indices
+        if size(P, 1) == 1
+            try
+                P = X(:, P);
+                isNotSubset = false;
+            catch me
+                error('psfConv:InvalidIndexVector', ...
+                    'Unable to index matrix using index vector');
+            end
+        end % if size(P, 1) == 1
+    end
+
+    isNotSubset= ~isNotSubset && isempty(setdiff(P',X'));
+    
+    if size(P, 1) ~= size(X, 1)
+        error('psfConv:DimensionMismatch', ...
+            'No. of rows of input arrays doesn''t match');
+    end
+end
+
+% Parse the Property/Value pairs
+if rem(length(varargin), 2) ~= 0
+    error('psfConv:propertyValueNotPair', ...
+        'Additional arguments must take the form of Property/Value pairs');
+end
+
+propertyNames = {'radius'};
+
+while ~isempty(varargin)
+    property = varargin{1};
+    value    = varargin{2};
+
+    % If the property has been supplied in a shortened form, lengthen it
+    iProperty = find(strncmpi(property, propertyNames, length(property)));
+
+    if isempty(iProperty)
+        error('psfConv:InvalidProperty', 'Invalid Property');
+    elseif length(iProperty) > 1
+        error('psfConv:AmbiguousProperty', ...
+            'Supplied shortened property name is ambiguous');
+    end
+    property = propertyNames{iProperty};
+
+    switch property
+        case 'radius'
+            if isscalar(value) && isnumeric(value) && isreal(value)
+                userParams.radius = value;
+            else
+                error('psfConv:InvalidPointWeights', ...
+                    'Radius must be a real valued scalar');
+            end
+    end % switch property
+
+    varargin(1:2) = [];
+end % while
+
+end %parseinputs
Index: mkjer/Util/SpatialIndexing/Metrics/ChebyshevDistance.h
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/ChebyshevDistance.h	(revision 12)
+++ 	(revision )
@@ -1,144 +1,0 @@
-//*****************************************************************************
-// FILE:        ChebyshevDistance.h
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//> The public interface defintion for the Chebyshev distance metric functor.
-//<
-//
-// LIMITATIONS:
-//> No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Modified free functions to functors to allow for "functions
-//               with state" like p-norm.
-//  2013-AUG-09  K. Damkjer
-//               Moved into its own header to improve maintainability.
-//<
-//*****************************************************************************
-
-#ifndef Damkjer_ChebyshevDistance_HEADER
-#define Damkjer_ChebyshevDistance_HEADER
-
-#if _MSC_VER
-#pragma warning(push, 0)
-#endif
-
-#include <cmath>    // USES std::abs
-#include <iterator> // USES container const_iterator interface
-
-#if _MSC_VER
-#pragma warning(pop)
-#endif
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// FUNCTOR: ChebyshevDistance
-//> The Chebyshev distance metric.
-//
-//  Distances between two points, x and y, in n-dimensional Chebyshev space are
-//  calculated as follows:
-//
-//  <!--// d(x,y) = max_i(|x[i] - y[i]|)  //-->
-//
-//  <!--// Pretty Doxygen (LaTeX) format: //-->
-//  \f[
-//     d\left(\bm{x},\bm{y}\right)=
-//        \max_{1 \le i \le n}\left(\left|x_{i}-y_{i}\right|\right)
-//  \f]
-//
-//  @note
-//  The ChebyshevDistance functor must operate on an STL container class, or a
-//  class that supports "duck" typing through a public typedef named
-//  "value_type".
-//
-//  @tparam PointT  the point type.
-//  @tparam ReturnT the return type.
-//<
-//*****************************************************************************
-template<typename PointT, typename ReturnT = typename PointT::value_type>
-class ChebyshevDistance
-{
-public:
-
-   typedef PointT  value_type;
-      //> The point type for this functor.
-      //<
-
-   typedef ReturnT return_type;
-      //> The return type for this functor.
-      //<
-
-   //***
-   // Use compiler-generated constructor, copy-constructor and destructor.
-   // ChebyshevDistance();
-   // ChebyshevDistance(const ChebyshevDistance&);
-   // ~ChebyshevDistance();
-   //***
-
-   //***
-   // Use compiler-generated assignment operator.
-   // ChebyshevDistance& operator=(const ChebyshevDistance&);
-   //***
-
-   ReturnT operator()(const PointT&, const PointT&) const;
-      //> Perform the distance calculation.
-      //<
-};
-
-//*****************************************************************************
-// ChebyshevDistance::operator()(const PointT&, const PointT&)
-//> Perform the distance calculation.
-//
-//  Distances between two points, x and y, in n-dimensional Chebyshev space are
-//  calculated as follows:
-//
-//  <!--// d(x,y) = max_i(|x[i] - y[i]|)  //-->
-//
-//  <!--// Pretty Doxygen (LaTeX) format: //-->
-//  \f[
-//     d\left(\bm{x},\bm{y}\right)=
-//        \max_{1 \le i \le n}\left(\left|x_{i}-y_{i}\right|\right)
-//  \f]
-//
-//  @tparam PointT  the point type.
-//  @tparam ReturnT the return type.
-//  @param x the first point.
-//  @param y the second point.
-//  @return the distance between the two argument points.
-//<
-//*****************************************************************************
-template<typename PointT, typename ReturnT>
-inline ReturnT
-ChebyshevDistance<PointT, ReturnT>::operator()(const PointT& x,
-                                               const PointT& y)
-const
-{
-   //***
-   // For predictable data fidelity, perform computations with the same
-   // fidelity as the point-type.
-   //***
-   typename PointT::value_type temp, my_max = 0;
-      
-   for (typename PointT::const_iterator xi = x.begin(), yi = y.begin();
-        xi != x.end() && yi != y.end();
-        ++xi, ++yi)
-   {
-      temp = std::abs(*xi - *yi);
-      my_max = (temp > my_max) ? temp : my_max;
-   }
-      
-   // Then static-cast to the desired return type.
-   return static_cast<ReturnT>(my_max);
-}
-
-}
-
-#endif
Index: mkjer/Util/SpatialIndexing/Metrics/EuclideanDistance.h
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/EuclideanDistance.h	(revision 12)
+++ 	(revision )
@@ -1,134 +1,0 @@
-//*****************************************************************************
-// FILE:        EuclideanDistance.h
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//> The public interface defintion for the Euclidean distance metric functor.
-//<
-//
-// LIMITATIONS:
-//> No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Modified free functions to functors to allow for "functions
-//               with state" like p-norm.
-//  2013-AUG-09  K. Damkjer
-//               Moved into its own header to improve maintainability.
-//<
-//*****************************************************************************
-
-#ifndef Damkjer_EuclideanDistance_HEADER
-#define Damkjer_EuclideanDistance_HEADER
-
-#include <cmath>    // USES std::sqrt
-#include <iterator> // USES container const_iterator interface
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// FUNCTOR: EuclideanDistance
-//> The Euclidean distance metric.
-//
-//  Distances between two points, x and y, in n-dimensional Euclidean space are
-//  calculated as follows:
-//
-//  <!--// d(x,y) = sqrt(sum_{i=0}^{n}((x[i] - y[i])^2)) //-->
-//
-//  <!--// Pretty Doxygen (LaTeX) format: //-->
-//  \f[
-//     d\left(\bm{x},\bm{y}\right)=
-//        \sqrt{\sum_{i=0}^{n}\left(x_{i}-y_{i}\right)^{2}}
-//  \f]
-//
-//  @note
-//  The EuclideanDistance functor must operate on an STL container class, or a
-//  class that supports "duck" typing through a public typedef named
-//  "value_type".
-//
-//  @tparam PointT  the point type.
-//  @tparam ReturnT the return type.
-//<
-//*****************************************************************************
-template<typename PointT, typename ReturnT = typename PointT::value_type>
-class EuclideanDistance
-{
-public:
-   typedef PointT  value_type;
-      //> The point type for this functor.
-      //<
-
-   typedef ReturnT return_type;
-      //> The return type for this functor.
-      //<
-
-   //***
-   // Use compiler-generated constructor, copy-constructor and destructor.
-   // EuclideanDistance();
-   // EuclideanDistance(const EuclideanDistance&);
-   // ~EuclideanDistance();
-   //***
-
-   //***
-   // Use compiler-generated assignment operator.
-   // EuclideanDistance& operator=(const EuclideanDistance&);
-   //***
-
-   ReturnT operator()(const PointT&, const PointT&) const;
-      //> Perform the distance calculation.
-      //<
-};
-
-//*****************************************************************************
-// EuclideanDistance::operator()(const PointT&, const PointT&)
-//> Perform the distance calculation.
-//
-//  Distances between two points, x and y, in n-dimensional Euclidean space are
-//  calculated as follows:
-//
-//  <!--// d(x,y) = sqrt(sum_{i=0}^{n}((x[i] - y[i])^2)) //-->
-//
-//  <!--// Pretty Doxygen (LaTeX) format: //-->
-//  \f[
-//     d\left(\bm{x},\bm{y}\right)=
-//        \sqrt{\sum_{i=0}^{n}\left(x_{i}-y_{i}\right)^{2}}
-//  \f]
-//
-//  @tparam PointT  the point type.
-//  @tparam ReturnT the return type.
-//  @param x the first point.
-//  @param y the second point.
-//  @return the distance between the two argument points.
-//<
-//*****************************************************************************
-template<typename PointT, typename ReturnT>
-inline ReturnT
-EuclideanDistance<PointT, ReturnT>::operator()(const PointT& x,
-                                               const PointT& y)
-const
-{
-   //***
-   // For predictable data fidelity, perform computations with the same
-   // fidelity as the point-type.
-   //***
-   typename PointT::value_type sum = 0;
-
-   for (typename PointT::const_iterator xi = x.begin(), yi = y.begin();
-        xi != x.end() && yi != y.end();
-        ++xi, ++yi)
-   {
-      sum += (*xi - *yi) * (*xi - *yi);
-   }
-
-   // Then static-cast to the desired return type.
-   return static_cast<ReturnT>(std::sqrt(sum));
-}
-
-}
-
-#endif
Index: mkjer/Util/SpatialIndexing/Metrics/ManhattanDistance.h
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/ManhattanDistance.h	(revision 12)
+++ 	(revision )
@@ -1,134 +1,0 @@
-//*****************************************************************************
-// FILE:        ManhattanDistance.h
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//> The public interface defintion for the Manhattan distance metric functor.
-//<
-//
-// LIMITATIONS:
-//> No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Modified free functions to functors to allow for "functions
-//               with state" like p-norm.
-//  2013-AUG-09  K. Damkjer
-//               Moved into its own header to improve maintainability.
-//<
-//*****************************************************************************
-
-#ifndef Damkjer_ManhattanDistance_HEADER
-#define Damkjer_ManhattanDistance_HEADER
-
-#include <cmath>    // USES std::abs
-#include <iterator> // USES container const_iterator interface
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// FUNCTOR: ManhattanDistance
-//> The Manhattan distance metric.
-//
-//  Distances between two points, x and y, in n-dimensional Manhattan space are
-//  calculated as follows:
-//
-//  <!--// d(x,y) = sum{i=0:n}(|x[i] - y[i]|) //-->
-//
-//  <!--// Pretty Doxygen (LaTeX) format: //-->
-//  \f[
-//     d\left(\bm{x},\bm{y}\right)=
-//        \sum_{i=0}^{n}\left(\left|x_{i}-y_{i}\right|\right)
-//  \f]
-//
-//  @note
-//  The ManhattanDistance functor must operate on an STL container class, or a
-//  class that supports "duck" typing through a public typedef named
-//  "value_type".
-//
-//  @tparam PointT  the point type.
-//  @tparam ReturnT the return type.
-//<
-//*****************************************************************************
-template<typename PointT, typename ReturnT = typename PointT::value_type>
-class ManhattanDistance
-{
-public:
-   typedef PointT  value_type;
-      //> The point type for this functor.
-      //<
-
-   typedef ReturnT return_type;
-      //> The return type for this functor.
-      //<
-
-   //***
-   // Use compiler-generated constructor, copy-constructor and destructor.
-   // ManhattanDistance();
-   // ManhattanDistance(const ManhattanDistance&);
-   // ~ManhattanDistance();
-   //***
-
-   //***
-   // Use compiler-generated assignment operator.
-   // ManhattanDistance& operator=(const ManhattanDistance&);
-   //***
-
-   ReturnT operator()(const PointT&, const PointT&) const;
-      //> Perform the distance calculation.
-      //<
-};
-
-//*****************************************************************************
-// ManhattanDistance::operator()(const PointT&, const PointT&)
-//> Perform the distance calculation.
-//
-//  Distances between two points, x and y, in n-dimensional Manhattan space are
-//  calculated as follows:
-//
-//  <!--// d(x,y) = sum{i=0:n}(|x[i] - y[i]|) //-->
-//
-//  <!--// Pretty Doxygen (LaTeX) format: //-->
-//  \f[
-//     d\left(\bm{x},\bm{y}\right)=
-//        \sum_{i=0}^{n}\left(\left|x_{i}-y_{i}\right|\right)
-//  \f]
-//
-//  @tparam PointT  the point type.
-//  @tparam ReturnT the return type.
-//  @param x the first point.
-//  @param y the second point.
-//  @return the distance between the two argument points.
-//<
-//*****************************************************************************
-template<typename PointT, typename ReturnT>
-inline ReturnT
-ManhattanDistance<PointT, ReturnT>::operator()(const PointT& x,
-                                               const PointT& y)
-const
-{
-   //***
-   // For predictable data fidelity, perform computations with the same
-   // fidelity as the point-type.
-   //***
-   typename PointT::value_type sum = 0;
-      
-   for (typename PointT::const_iterator xi = x.begin(), yi = y.begin();
-        xi != x.end() && yi != y.end();
-        ++xi, ++yi)
-   {
-      sum += std::abs(*xi - *yi);
-   }
-      
-   // Then static-cast to the desired return type.
-   return static_cast<ReturnT>(sum);
-}
-
-}
-
-#endif
Index: Damkjer/Util/SpatialIndexing/Metrics/Metrics.h
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/Metrics.h	(revision 12)
+++ Damkjer/Util/SpatialIndexing/Metrics/Metrics.h	(revision 0)
@@ -1,34 +1,37 @@
-//*****************************************************************************
+//*************************************************************************
 // FILE:        Metrics.h
 //
 //    Copyright (C)  2012 Kristian Damkjer.
 //
-// DESCRIPTION:
-//>  A convenience inclusion wrapper for defined metrics.
-//<
+// DESCRIPTION: 
 //
 // LIMITATIONS:
-//>  No known limitations.
-//<
 //
 // SOFTWARE HISTORY:
 //> 2012-SEP-11  K. Damkjer
 //               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Modified free functions to functors to allow for "functions
-//               with state" like p-norm.
-//  2013-AUG-09  K. Damkjer
-//               Moved individual metrics into their own headers to improve
-//               maintainability.
 //<
-//*****************************************************************************
+//*************************************************************************
 
-#ifndef Damkjer_Metrics_HEADER
-#define Damkjer_Metrics_HEADER
+#ifndef Metrics_HEADER
+#define Metrics_HEADER
 
-#include "Util/SpatialIndexing/Metrics/EuclideanDistance.h"
-#include "Util/SpatialIndexing/Metrics/ManhattanDistance.h"
-#include "Util/SpatialIndexing/Metrics/ChebyshevDistance.h"
-#include "Util/SpatialIndexing/Metrics/MinkowskiDistance.h"
+#include <cmath>
+
+template<typename CONTAINER>
+double euclidean(const CONTAINER& a,
+                 const CONTAINER& b)
+{
+    double sum=0;
+    
+    for (typename CONTAINER::const_iterator ai=a.begin(), bi=b.begin();
+         ai!=a.end()&&bi!=b.end();
+         ++ai,++bi)
+    {
+        sum+=(*ai-*bi)*(*ai-*bi);
+    }
+    
+    return sqrt(sum);
+}
 
 #endif
Index: mkjer/Util/SpatialIndexing/Metrics/MinkowskiDistance.h
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/MinkowskiDistance.h	(revision 12)
+++ 	(revision )
@@ -1,206 +1,0 @@
-//*****************************************************************************
-// FILE:        MinkowskiDistance.h
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//> The public interface defintion for the Minkowski distance metric functor.
-//<
-//
-// LIMITATIONS:
-//> No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Modified free functions to functors to allow for "functions
-//               with state" like p-norm.
-//  2013-AUG-09  K. Damkjer
-//               Moved into its own header to improve maintainability.
-//<
-//*****************************************************************************
-
-#ifndef Damkjer_MinkowskiDistance_HEADER
-#define Damkjer_MinkowskiDistance_HEADER
-
-#include <cmath>                      // USES std::abs and std::pow
-#include <iterator>                   // USES container const_iterator interface
-
-#include "Util/Exception/Exception.h" // USES Damkjer::DomainException interface
-
-namespace Damkjer {
-
-//*****************************************************************************
-// FUNCTOR: MinkowskiDistance
-//> The Minkowski distance metric.
-//
-//  Distances between two points, x and y, in n-dimensional Minkowski space are
-//  calculated as follows:
-//
-//  <!--// d(x,y) = (sum_{i=0)^{n}((x[i] - y[i])^p))^(1/p) //-->
-//
-//  <!--// Pretty Doxygen (LaTeX) format: //-->
-//  \f[
-//     d\left(\bm{x},\bm{y}\right)=
-//        \left(\sum_{i=0}^{n}\left(\left|x_{i}-
-//                                 y_{i}\right|\right)^{p}\right)^{\frac{1}{p}}
-//  \f]
-//
-//  @note
-//  The MinkowskiDistance functor must operate on an STL container class, or a
-//  class that supports "duck" typing through a public typedef named
-//  "value_type".
-//
-//  @tparam PointT  the point type.
-//  @tparam ReturnT the return type.
-//<
-//*****************************************************************************
-template<typename PointT, typename ReturnT = typename PointT::value_type>
-class MinkowskiDistance
-{
-public:
-
-   explicit MinkowskiDistance(typename PointT::value_type p = Euclidean);
-      //> Intialize the Minkowski distance metric with a power value.
-      //<
-
-   //***
-   // Use compiler-generated copy-constructor and destructor
-   // MinkowskiDistance(const MinkowskiDistance&);
-   // ~MinkowskiDistance(const MinkowskiDistance&);
-   //***
-
-   //***
-   // Use compiler-generated assignment operator.
-   // MinkowskiDistance& operator=(const MinkowskiDistance&);
-   //***
-
-   ReturnT operator()(const PointT& a, const PointT& b) const;
-      //> Perform the distance calculation.
-      //<
-
-   typedef PointT  value_type;
-      //> The point type for this functor.
-      //<
-
-   typedef ReturnT return_type;
-      //> The return type for this functor.
-      //<
-
-private:
-   //***
-   // ENUMERATION: Special
-   //>   List of pre-defined Minkowski metrics.
-   //<
-   //***   
-   enum Special
-   {
-      Manhattan = 1, //> Manhattan distance is defined when p == 1.
-                     //<
-      Euclidean = 2  //> Euclidean distance is defined when p == 2.
-                     //<
-   };
-
-   typename PointT::value_type thePower;
-      //> The power value.
-      //<
-};
-
-//*****************************************************************************
-// MinkowskiDistance::MinkowskiDistance(PointT::value_type)
-//> Intialize the Minkowski distance metric with a power value.
-//
-//  This constructor is the default constructor if no arguments are provided.
-//  The default power value creates a Euclidean metric (p = 2).
-//
-//  @tparam PointT  the point type.
-//  @tparam ReturnT the return type.
-//  @param p the power value. Default to Euclidean (2).
-//  @throw DomainError when p < 1.
-//<
-//*****************************************************************************
-template<typename PointT, typename ReturnT>
-MinkowskiDistance<PointT, ReturnT>::MinkowskiDistance(
-                                                 typename PointT::value_type p)
-   : thePower(p)
-{
-   EXCEPTION_TRY("Damkjer::MinkowskiDistance<PointT, ReturnT>::"
-                 "MinkowskiDistance");
-
-   if (thePower < 1)
-   {
-      //***
-      // In released code, there's not a whole lot that the user can do
-      // about this problem. This is a logic error and should be prevented
-      // through appropriate bounds checking on the input prior to
-      // calling the constructor.
-      //***
-      std::ostringstream msg;
-
-      msg << "Error encountered while defining a Minkowski distance "
-          << "metric.\n\n"
-          << "Unable to define a Minkowski distance metric with the "
-          << "requested p-value: " << thePower << ". The Minkowski distance "
-          << "must be defined with p >= 1 to describe a metric space.";
-
-      throw DomainError(msg.str(),  MODULE, __FILE__, __LINE__);
-   }
-
-   EXCEPTION_RETHROW;
-}
-
-//*****************************************************************************
-// MinkowskiDistance::operator()(const PointT&, const PointT&)
-//> Perform the distance calculation.
-//
-//  Distances between two points, x and y, in n-dimensional Minkowski space are
-//  calculated as follows:
-//
-//  <!--// Easy to read format: //-->
-//  <!--// d(x,y) = (sum_{i=0)^{n}((x[i] - y[i])^p))^(1/p) //-->
-//
-//  <!--// Pretty Doxygen (LaTeX) format: //-->
-//  \f[
-//     d\left(\bm{x},\bm{y}\right)=
-//        \left(\sum_{i=0}^{n}\left(\left|x_{i}-
-//                                 y_{i}\right|\right)^{p}\right)^{\frac{1}{p}}
-//  \f]
-//
-//  @tparam PointT  the point type.
-//  @tparam ReturnT the return type.
-//  @param x the first point.
-//  @param y the second point.
-//  @return the distance between the two argument points.
-//<
-//*****************************************************************************
-template<typename PointT, typename ReturnT>
-inline ReturnT
-MinkowskiDistance<PointT, ReturnT>::operator()(const PointT& x,
-                                               const PointT& y)
-const
-{
-   //***
-   // For predictable data fidelity, perform computations with the same
-   // fidelity as the point-type.
-   //***
-   typename PointT::value_type sum = 0;
-
-   for (typename PointT::const_iterator xi = x.begin(), yi = y.begin();
-        xi != x.end() && yi != y.end();
-        ++xi, ++yi)
-   {
-      sum += std::pow(std::abs(*xi - *yi), thePower);
-   }
-
-   // Then static-cast to the desired return type.
-   static const typename PointT::value_type ONE =
-                                           static_cast<PointT::value_type>(1.);
-
-   return static_cast<ReturnT>(std::pow(sum, ONE/thePower));
-}
-
-}
-
-#endif
Index: mkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.cpp	(revision 12)
+++ 	(revision )
@@ -1,406 +1,0 @@
-//*****************************************************************************
-// FILE:        TestMetrics.cpp
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: TestMetrics
-//
-//    See TestMetrics header for detailed description.
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-24  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include <iomanip>
-#include <sstream>
-#include <limits>
-#include <cmath>
-#include <vector>
-#include <typeinfo>
-
-#include "TestMetrics.h"
-#include "Util/Exception/Exception.h"
-#include "Util/SpatialIndexing/Metrics/Metrics.h"
-#include "Util/Streams/BlockIndent.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// FUNCTION: approxEqual
-//*****************************************************************************
-template<typename T>
-bool approx_equal(T a, T b, double absTol = std::numeric_limits<T>::epsilon())
-{
-   T inMax = (std::abs(a) > std::abs(b))
-             ? std::abs(a)
-             : std::abs(b);
-
-   inMax = (inMax > static_cast<T>(1.0))
-           ? inMax
-           : static_cast<T>(1.0);
-
-   return (std::abs(a - b) <= absTol * inMax);
-}
-
-//*****************************************************************************
-// FUNCTOR: testEuclidean
-//*****************************************************************************
-template <typename PointT, typename ReturnT>
-class testEuclidean : public TestCase::TestStep
-{
-public:
-   testEuclidean()
-      : TestCase::TestStep(typeid(theMetric).name())
-      , theMetric()
-   {
-   }
-      //>
-      //<
-
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::testEuclidean::operator(TestCase&)");
-
-      typedef typename PointT::value_type ValueT;
-
-      PointT a;
-      a.push_back(static_cast<ValueT>(0.3));
-      a.push_back(static_cast<ValueT>(0.5));
-
-      PointT b;
-      b.push_back(static_cast<ValueT>(0.7));
-      b.push_back(static_cast<ValueT>(0.8));
-
-      ReturnT fromMetric = theMetric(a, b);
-
-      //***
-      // Expected value is sqrt((0.7-0.3)*(0.7-0.3)+(0.8-0.5)*(0.8-0.5))
-      //                   sqrt(0.4*0.4+0.3*0.3)
-      //                   sqrt(0.16+0.09)
-      //                   sqrt(0.25)
-      //                   0.5
-      //***
-      double valTol = std::numeric_limits<ValueT>::epsilon();
-      double retTol = std::numeric_limits<ReturnT>::epsilon();
-
-      double tol = (valTol > retTol) ? valTol : retTol;
-
-      bool passed = approx_equal(fromMetric, static_cast<ReturnT>(0.5), tol);
-
-      test.report() << "Value from Euclidean Metric: "
-                    << std::setprecision(12) << fromMetric << "\n"
-                    << "Expected result            : "
-                    << std::setprecision(12) << static_cast<ReturnT>(0.5)
-                    << "\n";
-
-      return passed;
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-
-private:
-   EuclideanDistance<PointT,ReturnT> theMetric;
-      //>
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: testManhattan
-//*****************************************************************************
-template <typename PointT, typename ReturnT>
-class testManhattan : public TestCase::TestStep
-{
-public:
-   testManhattan()
-      : TestCase::TestStep(typeid(theMetric).name())
-      , theMetric()
-   {
-   }
-      //>
-      //<
-
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::testManhattan::operator(TestCase&)");
-
-      typedef typename PointT::value_type ValueT;
-
-      PointT a;
-      a.push_back(static_cast<ValueT>(0.3));
-      a.push_back(static_cast<ValueT>(0.5));
-
-      PointT b;
-      b.push_back(static_cast<ValueT>(0.7));
-      b.push_back(static_cast<ValueT>(0.8));
-
-      ReturnT fromMetric = theMetric(a, b);
-
-      //***
-      // Expected value is |0.7-0.3|+|0.8-0.5|
-      //                   0.4+0.3
-      //                   0.7
-      //***
-      double valTol = std::numeric_limits<ValueT>::epsilon();
-      double retTol = std::numeric_limits<ReturnT>::epsilon();
-
-      double tol = (valTol > retTol) ? valTol : retTol;
-
-      bool passed = approx_equal(fromMetric, static_cast<ReturnT>(0.7), tol);
-
-      test.report() << "Value from Euclidean Metric: "
-                    << std::setprecision(12) << fromMetric << "\n"
-                    << "Expected result            : "
-                    << std::setprecision(12) << static_cast<ReturnT>(0.7)
-                    << "\n";
-
-      return passed;
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-
-private:
-   ManhattanDistance<PointT,ReturnT> theMetric;
-      //>
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: testChebyshev
-//*****************************************************************************
-template <typename PointT, typename ReturnT>
-class testChebyshev : public TestCase::TestStep
-{
-public:
-   testChebyshev()
-      : TestCase::TestStep(typeid(theMetric).name())
-      , theMetric()
-   {
-   }
-      //>
-      //<
-
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::testChebyshev::operator(TestCase&)");
-
-      typedef typename PointT::value_type ValueT;
-
-      PointT a;
-      a.push_back(static_cast<ValueT>(0.3));
-      a.push_back(static_cast<ValueT>(0.5));
-
-      PointT b;
-      b.push_back(static_cast<ValueT>(0.7));
-      b.push_back(static_cast<ValueT>(0.8));
-
-      ReturnT fromMetric = theMetric(a, b);
-
-      //***
-      // Expected value is max(|0.7-0.3|,|0.8-0.5|)
-      //                   max(0.4,0.3)
-      //                   0.4
-      //***
-      double valTol = std::numeric_limits<ValueT>::epsilon();
-      double retTol = std::numeric_limits<ReturnT>::epsilon();
-
-      double tol = (valTol > retTol) ? valTol : retTol;
-
-      bool passed = approx_equal(fromMetric, static_cast<ReturnT>(0.4), tol);
-
-      test.report() << "Value from Euclidean Metric: "
-                    << std::setprecision(12) << fromMetric << "\n"
-                    << "Expected result            : "
-                    << std::setprecision(12) << static_cast<ReturnT>(0.4)
-                    << "\n";
-
-      return passed;
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-
-private:
-   ChebyshevDistance<PointT,ReturnT> theMetric;
-      //>
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: testMinkowski
-//*****************************************************************************
-template <typename PointT, typename ReturnT>
-class testMinkowski : public TestCase::TestStep
-{
-public:
-   testMinkowski()
-      : TestCase::TestStep(typeid(theMetric).name())
-      , theMetric(2)
-   {
-   }
-      //>
-      //<
-
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::testMinkowski::operator(TestCase&)");
-
-      typedef typename PointT::value_type ValueT;
-
-      PointT a;
-      a.push_back(static_cast<ValueT>(0.3));
-      a.push_back(static_cast<ValueT>(0.5));
-
-      PointT b;
-      b.push_back(static_cast<ValueT>(0.7));
-      b.push_back(static_cast<ValueT>(0.8));
-
-      ReturnT fromMetric = theMetric(a, b);
-
-      //***
-      // Expected value is sqrt((0.7-0.3)*(0.7-0.3)+(0.8-0.5)*(0.8-0.5))
-      //                   sqrt(0.4*0.4+0.3*0.3)
-      //                   sqrt(0.16+0.09)
-      //                   sqrt(0.25)
-      //                   0.5
-      //***
-      double valTol = std::numeric_limits<ValueT>::epsilon();
-      double retTol = std::numeric_limits<ReturnT>::epsilon();
-
-      double tol = (valTol > retTol) ? valTol : retTol;
-
-      bool passed = approx_equal(fromMetric, static_cast<ReturnT>(0.5), tol);
-
-      test.report() << "Value from Euclidean Metric: "
-                    << std::setprecision(12) << fromMetric << "\n"
-                    << "Expected result            : "
-                    << std::setprecision(12) << static_cast<ReturnT>(0.5)
-                    << "\n";
-
-      return passed;
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-
-private:
-   MinkowskiDistance<PointT,ReturnT> theMetric;
-      //>
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: minkowskiThrow
-//*****************************************************************************
-template <typename PointT, typename ReturnT>
-class minkowskiThrow : public TestCase::TestStep
-{
-public:
-   minkowskiThrow()
-      : TestCase::TestStep(
-                 std::string("throw from ") +
-//                 std::string(typeid(MinkowskiDistance<PointT,ReturnT>).name()))
-                 std::string(typeid(this).name()))
-   {
-   }
-      //> This functor constructs with a simple default constructor since the
-      //  test body is not performing a direct comparison against an expected
-      //  value.
-      //<
-   
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::minkowskiThrow::operator(TestCase&)");
-
-      try
-      {
-         MinkowskiDistance<PointT,ReturnT> metric(0.5); // <-- Throw here.
-         test.report() << "Did not catch an exception!\n";
-
-         // If we get here, we didn't throw: failed test.
-         return false;
-      }
-      catch (const DomainError& e)
-      {
-         test.report() << "Caught expected exception:\n";
-
-         test.report() << BlockIndent() << e;
-         e.stackTrace(test.report());
-         test.report() << endBlock;
-
-         // If we get here, we threw the correct exception: successful test.
-         return true;
-      }
-      catch (...)
-      {
-         test.report() << "Caught unexpected exception.\n";
-
-         // If we get here, we threw something unexpected: failed test.
-         return false;
-      }
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-};
-
-//*****************************************************************************
-// CONSTRUCTOR: TestMetrics::TestMetrics(int, char**)
-//*****************************************************************************
-TestMetrics::TestMetrics(int argc, char** argv)
-   : TestCase(argc, argv,
-              "Metrics: Metrics Functor Suite",
-              "Metrics_01",
-              "This test case tests defined distance Metrics.")
-{
-   EXCEPTION_TRY("Damkjer::TestMetrics::TestMetrics(int, char**)");
-
-   typedef std::vector<float>  FloatPtT;
-   typedef std::vector<double> DoublePtT;
-
-   registerStep(new testEuclidean<FloatPtT,float>());
-   registerStep(new testEuclidean<FloatPtT,double>());
-   registerStep(new testEuclidean<DoublePtT,float>());
-   registerStep(new testEuclidean<DoublePtT,double>());
-   registerStep(new testManhattan<FloatPtT,float>());
-   registerStep(new testManhattan<FloatPtT,double>());
-   registerStep(new testManhattan<DoublePtT,float>());
-   registerStep(new testManhattan<DoublePtT,double>());
-   registerStep(new testChebyshev<FloatPtT,float>());
-   registerStep(new testChebyshev<FloatPtT,double>());
-   registerStep(new testChebyshev<DoublePtT,float>());
-   registerStep(new testChebyshev<DoublePtT,double>());
-   registerStep(new testMinkowski<FloatPtT,float>());
-   registerStep(new testMinkowski<FloatPtT,double>());
-   registerStep(new testMinkowski<DoublePtT,float>());
-   registerStep(new testMinkowski<DoublePtT,double>());
-   registerStep(new minkowskiThrow<FloatPtT,float>());
-   registerStep(new minkowskiThrow<FloatPtT,double>());
-   registerStep(new minkowskiThrow<DoublePtT,float>());
-   registerStep(new minkowskiThrow<DoublePtT,double>());
-
-   EXCEPTION_RETHROW;
-}
-
-}
Index: mkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.h
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.h	(revision 12)
+++ 	(revision )
@@ -1,38 +1,0 @@
-//*****************************************************************************
-// FILE:        TestMetrics.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: 
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-AUG-05  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifndef TestMetrics_HEADER
-#define TestMetrics_HEADER
-
-#include "Util/UtilAPI.h"
-#include "Util/UnitTest/TestCase.h"
-
-namespace Damkjer
-{
-
-class TestMetrics : public TestCase
-{
-public:
-   TestMetrics(int, char**);
-      //>
-      //<
-private:
-   TestMetrics(const TestMetrics&);
-   TestMetrics& operator=(const TestMetrics&);
-};
-
-}
-
-#endif
Index: mkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.vcxproj
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.vcxproj	(revision 12)
+++ 	(revision )
@@ -1,439 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="DebugOMP|Win32">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="DebugOMP|x64">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|Win32">
-      <Configuration>OpenMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|x64">
-      <Configuration>OpenMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="TestMetrics.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="TestMetrics.cpp" />
-    <ClCompile Include="test_Metrics.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\Util.vcxproj">
-      <Project>{20fe2624-c64f-d61a-bd8f-1725a8e68a42}</Project>
-    </ProjectReference>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <Keyword>Win32Proj</Keyword>
-    <ProjectName>test_Metrics</ProjectName>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent />
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent />
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalOptions>/wd4514 /wd4571 /wd4668 /wd4710 /wd4711 /wd4820 /wd4986 %(AdditionalOptions)</AdditionalOptions>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-    <CustomBuildStep />
-  </ItemDefinitionGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
Index: mkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.vcxproj.filters
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.vcxproj.filters	(revision 9)
+++ 	(revision )
@@ -1,26 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4010ed24-e68d-4e6e-97b0-8b8bb335aa86}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{0c039d31-de79-478b-9dc5-c3378145e52a}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="TestMetrics.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="test_Metrics.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="TestMetrics.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-</Project>
Index: mkjer/Util/SpatialIndexing/Metrics/test/test_Metrics.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/test/test_Metrics.cpp	(revision 12)
+++ 	(revision )
@@ -1,33 +1,0 @@
-//*****************************************************************************
-// FILE:        test_Metrics.cpp
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: 
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-26  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include "Util/Exception/Exception.h"
-#include "TestMetrics.h"
-
-using namespace Damkjer;
-
-//*****************************************************************************
-// main
-//*****************************************************************************
-int main(int argc, char** argv)
-{
-   EXCEPTION_TRY("main(int, char**)");
-
-   TestMetrics driver(argc, argv);
-
-   return driver.execute();
-
-   EXCEPTION_CATCHALL;
-}
Index: Damkjer/Util/SpatialIndexing/VpTree/VpTree.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree.cpp	(revision 0)
+++ Damkjer/Util/SpatialIndexing/VpTree/VpTree.cpp	(revision 0)
@@ -0,0 +1,941 @@
+//*************************************************************************
+// FILE:        VpTree.cpp
+//
+//    Copyright (C)  2012 Kristian Damkjer.
+//
+// DESCRIPTION: This class is an implementation of the vantage point tree
+//              data structure described by Peter Yianilos in "Data
+//              Structures and Algorithms for Nearest Neighbor Search in
+//              General Metric Spaces".
+//
+// LIMITATIONS: See VpTree.h for full list of limitations.
+//
+// SOFTWARE HISTORY:
+//> 2012-SEP-11  K. Damkjer
+//               Initial Coding.
+//<
+//*************************************************************************
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+#include "VpTree.h"
+
+#include <algorithm>
+#include <iostream>
+
+//*************************************************************************
+// CLASS: VpTree::Node
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+class VpTree<T, DISTANCE>::Node
+{
+public:
+   Node();
+      //> The default constructor creates a null node.
+      //<
+    
+   Node(VpTree*);
+      //> Construct with a database reference.
+      //<
+    
+   virtual ~Node();
+      //> The default destructor. Virtual to ensure proper Node
+      //  destruction.
+      //<
+    
+   virtual void knn(const T&,
+                    const std::size_t&,
+                    std::priority_queue<ResultsCandidate>&,
+                    double&) const = 0;
+      //> The visitor that accumulates k nearest neighbor results.
+      //<
+
+   virtual void rnn(const T&,
+                    const double,
+                    std::priority_queue<ResultsCandidate>&) const = 0;
+      //> The visitor that accumulates fixed radius nearest neighbor
+      //  results.
+      //<
+
+protected:
+   VpTree<T, DISTANCE>* theTree;
+      //>
+      //<
+};
+
+//*************************************************************************
+// CLASS: VpTree::Internal
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+class VpTree<T, DISTANCE>::Internal : public VpTree<T, DISTANCE>::Node
+{
+public:
+   Internal();
+      //> The default constructor creates a null internal node.
+      //<
+    
+   Internal(VpTree*);
+      //> Construct with a database reference.
+      //<
+    
+   virtual ~Internal();
+      //> The default destructor. Virtual to ensure proper Node
+      //  destruction.
+      //<
+    
+   std::size_t theIndex;
+      //> The index of the item in the internal database.
+      //<
+
+   double theInnerLowerBound;
+      //> The lower bound distance to elements on inner branch.
+      //<
+
+   double theInnerUpperBound;
+      //> The uuper bound distance to elements on inner branch.
+      //<
+
+   double theOuterLowerBound;
+      //> The lower bound distance to elements on outer branch.
+      //<
+
+   double theOuterUpperBound;
+      //> The upper bound distance to elements on outer branch.
+      //<
+
+   Node* theInnerBranch;
+      //> The inner branch partition containing elements closer than
+      //  theMedianPartition to this element.
+      //<
+
+   Node* theOuterBranch;
+      //> The outer branch partition containing elements at or beyond
+      //  theMedianPartition from this element.
+      //<
+
+   virtual void knn(const T&,
+                    const std::size_t&,
+                    std::priority_queue<ResultsCandidate>&,
+                    double&) const;
+      //> The visitor that accumulates k nearest neighbor results.
+      //<
+
+   virtual void rnn(const T&,
+                    const double,
+                    std::priority_queue<ResultsCandidate>&) const;
+      //> The visitor that accumulates fixed radius nearest neighbor
+      //  results.
+      //<
+};
+
+//*************************************************************************
+// CLASS: VpTree::Leaf
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+class VpTree<T, DISTANCE>::Leaf : public VpTree<T, DISTANCE>::Node
+{
+public:
+   Leaf();
+      //> The default constructor creates a null leaf.
+      //<
+    
+   Leaf(VpTree*, const std::size_t&, const std::size_t&);
+      //> Construct a leaf representing the items in the provided index
+      //  range.
+      //<
+    
+   virtual ~Leaf(){}
+      //> The default destructor. Virtual to ensure proper Node
+      //  destruction.
+      //<
+    
+   virtual void knn(const T&,
+                    const std::size_t&,
+                    std::priority_queue<ResultsCandidate>&,
+                    double&) const;
+      //> The visitor that accumulates k nearest neighbor results.
+      //<
+
+   virtual void rnn(const T&,
+                    const double,
+                    std::priority_queue<ResultsCandidate>&) const;
+      //> The visitor that accumulates fixed radius nearest neighbor
+      //  results.
+      //<
+
+private:
+   std::size_t theHead;
+      //> The start of the index range prepresented by this Leaf.
+      //<
+
+   std::size_t theTail;
+      //> The end of the index range prepresented by this Leaf.
+      //<
+};
+
+//*************************************************************************
+// CLASS: VpTree::Item
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+class VpTree<T, DISTANCE>::Item
+{
+public:
+   Item();
+      //> The default constructor creates a null node.
+      //<
+    
+   ~Item(){}
+      //> The default destructor. Intentionally non-virtual since Node is
+      //  a private inner class on VpTree.
+      //<
+    
+   bool operator< (const Item&) const;
+      //>
+      //<
+
+   std::size_t theIndex;
+      //> The index of the item in the input data set.
+      //<
+
+   T theElement;
+      //> The database object
+      //<
+   
+   double theDistance;
+      //> The most recent ancestral pivot history distance for this item.
+      //<
+};
+
+//*************************************************************************
+// CLASS: VpTree::ResultsCandidate
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+class VpTree<T, DISTANCE>::ResultsCandidate
+{
+public:
+   ResultsCandidate(const std::size_t&, const double);
+      //> Create a metric comparitor.
+      //<
+    
+   ~ResultsCandidate(){}
+      //> The default destructor. Intentionally non-virtual since
+      //  ResultsCandidate is a private inner class on VpTree.
+      //<
+
+   bool operator< (const ResultsCandidate&) const;
+      //> Compare result candidate distances to determine which is closer
+      //  to the query.
+      //<
+
+   std::size_t theIndex;
+      //> The index of the candidate in the internal database.
+      //<
+    
+   double theDistance;
+      //> The candidate's distance to the query point.
+      //<
+};
+
+//*************************************************************************
+// VpTree::VpTree
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline VpTree<T, DISTANCE>::VpTree()
+   : theRoot(0)
+   , theItems()
+   , theLeafCapacity(1)
+{
+}
+
+//*************************************************************************
+// VpTree::VpTree
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+template<typename CONTAINER>
+inline VpTree<T, DISTANCE>::VpTree(const CONTAINER& elems,
+                                       const std::size_t& leafCapacity)
+   : theRoot(0)
+   , theItems(elems.size())
+   , theLeafCapacity((leafCapacity<1)?1:leafCapacity)
+{
+   #ifdef _OPENMP
+   omp_set_dynamic(1);
+   omp_set_num_threads(omp_get_num_procs());
+   #endif
+
+   #pragma omp parallel for
+   for (int i = 0; i < theItems.size(); ++i)
+   {
+       theItems[i].theIndex=i;
+       theItems[i].theElement=elems[i];
+   }
+
+   theRoot = makeTree(0, theItems.size());
+}
+                
+//*************************************************************************
+// VpTree::~VpTree
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline VpTree<T, DISTANCE>::~VpTree()
+{
+   delete theRoot;
+   theRoot = 0;
+}
+
+//*************************************************************************
+// VpTree::Node::Node
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline VpTree<T, DISTANCE>::Node::Node()
+   : theTree(0)
+{
+}
+
+//*************************************************************************
+// VpTree::Node::Node
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline VpTree<T, DISTANCE>::Node::Node(VpTree* tree)
+   : theTree(tree)
+{
+}
+
+//*************************************************************************
+// VpTree::Node::~Node
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline VpTree<T, DISTANCE>::Node::~Node()
+{
+   theTree = 0;
+}
+
+//*************************************************************************
+// VpTree::Internal::Internal
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline VpTree<T, DISTANCE>::Internal::Internal()
+   : Node()
+   , theIndex(0)
+   , theInnerLowerBound(0)
+   , theInnerUpperBound(0)
+   , theOuterLowerBound(0)
+   , theOuterUpperBound(0)
+   , theInnerBranch(0)
+   , theOuterBranch(0)
+{
+}
+
+//*************************************************************************
+// VpTree::Internal::Internal
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline VpTree<T, DISTANCE>::Internal::Internal(VpTree<T, DISTANCE>* tree)
+   : Node(tree)
+   , theIndex(0)
+   , theInnerLowerBound(0)
+   , theInnerUpperBound(0)
+   , theOuterLowerBound(0)
+   , theOuterUpperBound(0)
+   , theInnerBranch(0)
+   , theOuterBranch(0)
+{
+}
+
+//*************************************************************************
+// VpTree::Internal::~Internal
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline VpTree<T, DISTANCE>::Internal::~Internal()
+{
+   delete theInnerBranch;
+   delete theOuterBranch;
+   theInnerBranch = 0;
+   theOuterBranch = 0;
+}
+
+//*************************************************************************
+// VpTree::Leaf::Leaf
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline VpTree<T, DISTANCE>::Leaf::Leaf()
+   : Node()
+   , theHead(0)
+   , theTail(0)
+{
+}
+
+//*************************************************************************
+// VpTree::Leaf::Leaf
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline VpTree<T, DISTANCE>::Leaf::Leaf(VpTree* tree,
+                                         const std::size_t& head,
+                                         const std::size_t& tail)
+   : Node(tree)
+   , theHead(head)
+   , theTail(tail)
+{
+}
+
+//*************************************************************************
+// VpTree::Item::Item
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline VpTree<T, DISTANCE>::Item::Item()
+   : theIndex(0)
+   , theElement(0)
+   , theDistance(0)
+{
+}
+
+//*************************************************************************
+// VpTree::Item::operator<
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline bool VpTree<T, DISTANCE>::Item::operator<(const Item& other) const
+{
+   return theDistance < other.theDistance;
+}
+
+//*************************************************************************
+// VpTree::ResultsCandidate::ResultsCandidate
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline VpTree<T, DISTANCE>::ResultsCandidate::ResultsCandidate(
+                                                  const std::size_t& index,
+                                                  const double distance)
+   : theIndex(index)
+   , theDistance(distance)
+{
+}
+
+//*************************************************************************
+// VpTree::ResultsCandidate::operator<
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+inline bool VpTree<T, DISTANCE>::ResultsCandidate::operator<(
+                                       const ResultsCandidate& other) const
+{
+   return theDistance < other.theDistance;
+}
+
+//*************************************************************************
+// VpTree::randomSample
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+std::set<std::size_t> VpTree<T, DISTANCE>::randomSample(
+                                             const std::size_t& start,
+                                             const std::size_t& stop) const
+{
+//   std::size_t numSamps=(std::size_t)(ceil(sqrt((double)(stop - start))));
+   std::size_t numSamps=(stop-start > 5) ? 5 : (stop - start);
+
+   // If the range is smaller than the number of samples, just return the
+   // elements in the range.
+   if ((stop - start) <= numSamps)
+   {
+      std::vector<std::size_t> indices(stop-start, 0);
+
+      for (std::size_t i=start; i < stop; ++i)
+      {
+         indices[i-start]=i;
+      }
+        
+      return std::set<std::size_t>(indices.begin(), indices.end());
+   }
+    
+   std::set<std::size_t> samples;
+    
+   // If the range is close to the number of samples, select with better
+   // worst-case behvior
+   if ((stop - start) < numSamps*2)
+   {
+      std::size_t itemsNeeded=numSamps;
+        
+      for (std::size_t i = start;
+           samples.size() < numSamps && i < stop;
+           ++i)
+      {
+         if ((rand()/(RAND_MAX + 1.0)) < itemsNeeded/(stop-i))
+         {
+            samples.insert(i);
+            --itemsNeeded;
+         }
+      }
+   }
+   else
+   {
+      // Otherwise, if range dominates samples, select expecting to find
+      // unique samples
+      while (samples.size() < numSamps)
+      {
+         // Choose an arbitrary point
+         std::size_t val=(std::size_t)
+                         (rand()/(RAND_MAX + 1.0)*(stop-start)+start);
+            
+         samples.insert(val);
+      }
+   }
+   
+   return samples;
+}
+                                
+//*************************************************************************
+// VpTree::selectVp
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+std::size_t VpTree<T, DISTANCE>::selectVp(const std::size_t& start,
+                                            const std::size_t& stop) const
+{
+#if 0
+    std::set<std::size_t> p=randomSample(start, stop);
+    
+   std::size_t bestP=*(p.begin());
+   double bestSpread=0;
+    
+   for (std::set<std::size_t>::const_iterator pItr=p.begin();
+        pItr != p.end();
+        ++pItr)
+   {
+      const T& pItem = theItems[*pItr].theElement;
+      
+      std::set<std::size_t> d=randomSample(start, stop);
+      
+      std::vector<std::pair<T,std::size_t> > dItems(d.size());
+      unsigned int i = 0;
+      
+      for (std::set<std::size_t>::const_iterator dItr=d.begin();
+           dItr != d.end();
+           ++dItr)
+      {
+          dItems[i]=theItems[*dItr];
+          ++i;
+      }
+
+      std::nth_element(
+              dItems.begin(),
+              dItems.begin() + dItems.size()/2,
+              dItems.end(),
+              MetricComparison(pItem));
+      
+      double mu = DISTANCE(pItem, dItems[dItems.size()/2].theElement);
+      
+      unsigned int k=1;
+      double x, oldM, newM;
+      x=oldM=newM=DISTANCE(pItem, dItems[0].theElement)-mu;
+      double oldS, newS;
+      oldS=newS=0;
+      
+      for (unsigned int i = 1; i < dItems.size(); ++i)
+      {
+         x=DISTANCE(pItem, dItems[i].theElement)-mu;
+         ++k;
+         newM=oldM+(x-oldM)/k;
+         newS=oldS+(x-oldM)*(x-newM);
+         oldM=newM;
+         oldS=newS;
+      }
+      
+      double spread=(k>1)?newS/(k-1):0.0;
+      
+      if (spread > bestSpread)
+      {
+          bestSpread=spread;
+          
+          bestP=*pItr;
+      }
+   }
+   
+   return bestP;
+#endif
+   // Choose an arbitrary point
+   return (std::size_t)(rand()/(RAND_MAX + 1.0)*(stop-start)+start);
+}
+
+//*************************************************************************
+// VpTree::makeTree
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+typename VpTree<T, DISTANCE>::Node*
+VpTree<T, DISTANCE>::makeTree(const std::size_t& start,
+                                const std::size_t& stop)
+{
+   if (stop <= start) return 0;
+
+   std::size_t setSize = stop - start;
+   
+   if (setSize <= theLeafCapacity)
+   {
+      return new Leaf(this, start, stop);
+   }
+   
+   Internal* node=new Internal(this);
+   node->theIndex=start;
+
+   const std::size_t vp = selectVp(start, stop);
+   std::swap(theItems[start], theItems[vp]);
+   
+   // Identify bound elements
+   std::size_t outerLowerBound = (start + stop + 1)/2;
+   std::size_t innerLowerBound = start + 1;
+   
+   // Update Histories
+   double d_max=0;
+   double d_min=std::numeric_limits<double>::max();
+   for (std::size_t elem = stop; elem --> innerLowerBound; )
+   {
+      theItems[elem].theDistance = DISTANCE(theItems[start].theElement,
+                                            theItems[elem].theElement);
+      d_max = (theItems[elem].theDistance > d_max)
+              ? theItems[elem].theDistance : d_max;
+      d_min = (theItems[elem].theDistance < d_min)
+              ? theItems[elem].theDistance : d_min;
+   }
+   
+   // Put the median element in place
+   std::nth_element(
+           theItems.begin() + innerLowerBound,
+           theItems.begin() + outerLowerBound,
+           theItems.begin() + stop);
+
+   double d_mid=0;
+   for (std::size_t elem = outerLowerBound; elem --> innerLowerBound; )
+   {
+      d_mid = (theItems[elem].theDistance > d_mid)
+              ? theItems[elem].theDistance : d_mid;
+   }
+   
+   node->theInnerLowerBound=d_min;
+   node->theInnerUpperBound=d_mid;
+   node->theOuterLowerBound=theItems[outerLowerBound].theDistance;
+   node->theOuterUpperBound=d_max;
+   
+   #ifdef _OPENMP
+   static int threads = 0;
+   
+   if (threads < (omp_get_num_procs()-1))
+   {
+      omp_set_dynamic(1);
+      omp_set_num_threads(omp_get_num_procs());
+      omp_set_nested(1);
+      
+      #pragma omp atomic
+      ++threads;
+      
+      #pragma omp parallel
+      {         
+         #pragma omp sections nowait
+         {
+            node->theInnerBranch = makeTree(innerLowerBound,
+                                            outerLowerBound);
+              
+            #pragma omp section
+            node->theOuterBranch = makeTree(outerLowerBound,
+                                            stop);
+         }
+      }
+      
+      #pragma omp atomic
+      --threads;
+   }
+   else
+   #endif
+   {
+      node->theInnerBranch = makeTree(innerLowerBound,
+                                      outerLowerBound);
+      node->theOuterBranch = makeTree(outerLowerBound,
+                                      stop);
+   }
+   
+   return node;
+}
+
+//*************************************************************************
+// VpTree::knn
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+std::pair<std::deque<std::size_t>, std::deque<double> >
+VpTree<T, DISTANCE>::knn(const T& query,
+                           const std::size_t& k,
+                           const double limit) const
+{
+   std::priority_queue<ResultsCandidate> candidates;
+   double tau = limit;
+
+   theRoot->knn(query, k, candidates, tau);
+
+   std::deque<std::size_t> indices;
+   std::deque<double> distances;
+   
+   while(!candidates.empty())
+   {
+      indices.push_back(theItems[candidates.top().theIndex].theIndex);
+      distances.push_back(candidates.top().theDistance);
+      candidates.pop();
+   }
+
+   std::reverse(indices.begin(), indices.end());
+   std::reverse(distances.begin(), distances.end());
+
+   return std::make_pair(indices, distances);
+}
+
+//*************************************************************************
+// VpTree::Internal::knn
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+void
+VpTree<T, DISTANCE>::Internal::knn(
+        const T& query,
+        const std::size_t& k,
+        std::priority_queue<ResultsCandidate>& candidates,
+        double& kth_closest) const
+{
+   if (!(this->theTree)) return;
+   
+   double distance = DISTANCE(this->theTree->theItems[theIndex].theElement,
+                              query);
+
+   if (distance < kth_closest)
+   {
+      if (candidates.size() == k)
+      {
+          candidates.pop();
+      }
+      
+      candidates.push(ResultsCandidate(theIndex, distance));
+      
+      if (candidates.size() == k)
+      {
+          kth_closest = candidates.top().theDistance;
+      }
+   }
+
+   if (!(theInnerBranch || theOuterBranch))
+   {
+       return;
+   }
+
+   double middle = 0.5 * (theInnerUpperBound + theOuterLowerBound);
+
+   if (distance < middle)
+   {
+      if (theInnerBranch &&
+          (distance - theInnerUpperBound <= kth_closest) &&
+          (theInnerLowerBound - distance <= kth_closest))
+
+
+      if (theInnerBranch &&
+          (distance <= theInnerUpperBound + kth_closest) &&
+          (distance >= theInnerLowerBound - kth_closest))
+      {
+         theInnerBranch->knn(query, k, candidates, kth_closest);
+      }
+       
+      if (theOuterBranch &&
+          (distance >= theOuterLowerBound - kth_closest) &&
+          (distance <= theOuterUpperBound + kth_closest))
+      {
+         theOuterBranch->knn(query, k, candidates, kth_closest);
+      }
+   }
+   else
+   {
+      if (theOuterBranch &&
+          (distance >= theOuterLowerBound - kth_closest) &&
+          (distance <= theOuterUpperBound + kth_closest))
+      {
+         theOuterBranch->knn(query, k, candidates, kth_closest);
+      }
+       
+      if (theInnerBranch &&
+          (distance <= theInnerUpperBound + kth_closest) &&
+          (distance >= theInnerLowerBound - kth_closest))
+      {
+         theInnerBranch->knn(query, k, candidates, kth_closest);
+      }
+   }
+}
+
+//*************************************************************************
+// VpTree::Leaf::knn
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+void
+VpTree<T, DISTANCE>::Leaf::knn(
+        const T& query,
+        const std::size_t& k,
+        std::priority_queue<ResultsCandidate>& candidates,
+        double& kth_closest) const
+{
+   if (!(this->theTree)) return;
+   
+   // Scan the leaf
+   for (std::size_t item = theHead; item < theTail; ++item)
+   {
+      // This is the check state
+      double distance = DISTANCE(this->theTree->theItems[item].theElement,
+                                 query);
+      
+      if (distance < kth_closest)
+      {
+         if (candidates.size() == k)
+         {
+            candidates.pop();
+         }
+         
+         candidates.push(ResultsCandidate(item, distance));
+         
+         if (candidates.size() == k)
+         {
+            kth_closest = candidates.top().theDistance;
+         }
+      }
+   }
+}
+
+//*************************************************************************
+// VpTree::rnn
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+std::pair<std::deque<std::size_t>, std::deque<double> >
+VpTree<T, DISTANCE>::rnn(const T& query,
+                           const double range) const
+{
+   std::priority_queue<ResultsCandidate> candidates;
+
+   theRoot->rnn(query, range, candidates);
+
+   std::deque<std::size_t> indices;
+   std::deque<double> distances;
+
+   while(!candidates.empty())
+   {
+      indices.push_back(theItems[candidates.top().theIndex].theIndex);
+      distances.push_back(candidates.top().theDistance);
+      candidates.pop();
+   }
+
+   std::reverse(indices.begin(), indices.end());
+   std::reverse(distances.begin(), distances.end());
+
+   return std::make_pair(indices, distances);
+}
+
+//*************************************************************************
+// VpTree::Internal::rnn
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+void
+VpTree<T, DISTANCE>::Internal::rnn(
+        const T& query,
+        const double range,
+        std::priority_queue<ResultsCandidate>& candidates) const
+{
+   if (!(this->theTree)) return;
+
+   double distance = DISTANCE(this->theTree->theItems[theIndex].theElement,
+                              query);
+   
+   if (distance <= range)
+   {
+      candidates.push(ResultsCandidate(theIndex, distance));
+   }
+
+   if (!(theInnerBranch || theOuterBranch))
+   {
+       return;
+   }
+
+   double middle = 0.5 * (theInnerUpperBound + theOuterLowerBound);
+
+   if (distance < middle)
+   {
+      if (theInnerBranch &&
+          (distance <= theInnerUpperBound + range) &&
+          (distance >= theInnerLowerBound - range))
+      {
+         theInnerBranch->rnn(query, range, candidates);
+      }
+       
+      if (theOuterBranch &&
+          (distance >= theOuterLowerBound - range) &&
+          (distance <= theOuterUpperBound + range))
+      {
+         theOuterBranch->rnn(query, range, candidates);
+      }
+   }
+   else
+   {
+      if (theOuterBranch &&
+          (distance >= theOuterLowerBound - range) &&
+          (distance <= theOuterUpperBound + range))
+      {
+         theOuterBranch->rnn(query, range, candidates);
+      }
+       
+      if (theInnerBranch &&
+          (distance <= theInnerUpperBound + range) &&
+          (distance >= theInnerLowerBound - range))
+      {
+         theInnerBranch->rnn(query, range, candidates);
+      }
+   }
+}
+
+//*************************************************************************
+// Leaf::rnn
+//*************************************************************************
+template<typename T,
+         double (*DISTANCE)(const T&, const T&)>
+void
+VpTree<T, DISTANCE>::Leaf::rnn(
+        const T& query,
+        const double range,
+        std::priority_queue<ResultsCandidate>& candidates) const
+{
+   if (!(this->theTree)) return;
+
+   // Scan the leaf
+   for (std::size_t item = theHead; item < theTail; ++item)
+   {
+      double distance = DISTANCE(this->theTree->theItems[item].theElement,
+                                 query);
+      
+      if (distance <= range)
+      {
+         candidates.push(ResultsCandidate(item, distance));
+      }
+   }
+}
Index: Damkjer/Util/SpatialIndexing/VpTree/VpTree.h
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree.h	(revision 13)
+++ Damkjer/Util/SpatialIndexing/VpTree/VpTree.h	(revision 0)
@@ -1,150 +1,104 @@
-//****************************************************************************
+//*************************************************************************
 // FILE:        VpTree.h
 //
 //    Copyright (C)  2012 Kristian Damkjer.
 //
-// DESCRIPTION:
-//>   The interface definition for vantage-point trees.
-//<
+// DESCRIPTION: This class is an implementation of the vantage point tree
+//              data structure described by Peter Yianilos in "Data
+//              Structures and Algorithms for Nearest Neighbor Search in
+//              General Metric Spaces".
 //
-// LIMITATIONS:
-//>   This class template file follows the template inclusion pattern. This
-//    header file should be the only file included by clients wishing to
-//    instantiate a VpTree specialization.
-//<
+//              This structure includes the enhancement to collapse subtrees
+//              near leaves into a single node. This change reduces overall
+//              storage and some recursion overhead, but may make queries
+//              less efficient if the leaf size is chosen to be too large.
+//
+// LIMITATIONS: The tree is currently coded as nearly the simplest version
+//              of the proposed structure. This yields close to the fastest
+//              construct time with potential limitations on query speed.
+//
+//              Extra effort is spent on finding a "good" pivot for large
+//              trees with more effort devoted as the tree coverage grows
+//              (currently determined by examining sqrt(size) elements for
+//              pivot). The thought is that selection of a better pivot
+//              carries more weight in queries as tree coverage increases.
+//
+//              The first proposed enhancement would be to track tighter
+//              bounds on the branch sub-spaces. We currently only track
+//              the median partition which provides only a loose upper
+//              bound on the inner partition and a tight lower bound on the
+//              outer partition. For a slight storage overhead, we can
+//              instead track the tight lower and upper bounds for each
+//              branch. Investing in this enhancement would allow for
+//              earlier pruning of branches at the cost of increased
+//              storage and construct time.
+//
+//              The second proposed enhancement would be to track distances
+//              to ancestral pivots. This change potentially incurs a
+//              signficant storage overhead, but allows for further
+//              explicit pruning or inclusion optimizations for range
+//              queries.
+//
+//              The final proposed enhancement would be to increase fan-out
+//              of the tree by establishing multiple partition boundaries,
+//              or by modifying the structure into an MVP tree.
 //
 // SOFTWARE HISTORY:
-//
 //> 2012-SEP-11  K. Damkjer
 //               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Set typedefs to make code more readable and to allow for
-//               varying container and metric types. This is useful when the
-//               default double-precision is overkill. It is now easy to set
-//               types to float.
 //<
-//****************************************************************************
-#ifndef Damkjer_VpTree_HEADER
-#define Damkjer_VpTree_HEADER
+//*************************************************************************
 
-#if _OPENMP
-#include <omp.h>  // USES OpenMP pragmas
+#ifndef VpTree_HEADER
+#define VpTree_HEADER
+
+#ifndef EXPORT
+   #if defined(MAKE_DEPENDING) || defined(TEMPLATE_INCLUSION)
+      #define EXPORT
+   #else
+      #define EXPORT export
+   #endif
 #endif
 
-#include <cstddef> // USES std::size_t for index type.
-#include <vector>  // USES std::vector interface for default point type.
-#include <deque>   // USES std::deque interface for search results.
-#include <set>     // USES std::set interface for random sampling.
-#include <queue>   // USES std::priority_queue interface for search results.
-#include <limits>  // USES std::numeric_limits to establish default reach.
+#include "Util/SpatialIndexing/Metrics/Metrics.h"
 
-// USES Euclidean metric as default search space.
-#include "Util/SpatialIndexing/Metrics/EuclideanDistance.h" 
+#include <vector>
+#include <deque>
+#include <set>
+#include <queue>
+#include <limits>
 
-namespace Damkjer
-{
-
-//*****************************************************************************
+//*************************************************************************
 // CLASS: VpTree
-//>   A vantage point tree data structure and related search algorithms.
-//
-//    This class is an implementation of the vantage point tree data structure
-//    described by Peter Yianilos in "Data Structures and Algorithms for
-//    Nearest Neighbor Search in General Metric Spaces". @cite Yianilos:1993
-//
-//    This structure includes the enhancement to collapse subtrees near leaves
-//    into a single node. This change reduces overall storage and some
-//    recursion overhead, but may make queries less efficient if the leaf size
-//    is chosen to be too large.
-//
-//    @note
-//    The tree is currently coded as VPsb tree to attempt to realize the best
-//    balance in construct and search performance.
-//    @note
-//    Code was developed and analyzed to determine the benefit of enhancing
-//    the vantage point selection process. Extra effort was spent on finding a
-//    "good" pivot for large trees with more effort devoted as the tree
-//    coverage grows (determined by examining sqrt(size) elements for pivot).
-//    The thought was that selection of a better pivot carries more weight in
-//    queries as tree coverage increases. However, in practice, the vantage
-//    point selection seemed to have marginal, if any, effect on query time.
-//    @note
-//    The tree includes the enhancement to track tight bounds on the branch
-//    sub-spaces. For a slight storage overhead, we track the tight lower and
-//    upper bounds for each branch which allows for earlier pruning of
-//    branches at the cost of slightly increased storage and construct time.
-//    @note
-//    The tree also includes the enhancement to track distances to ancestral
-//    pivots. This change potentially incurs a signficant storage overhead,
-//    but allows for further explicit pruning or inclusion optimizations for
-//    range queries.
-//    @note
-//    A final proposed enhancement would be to increase fan-out of the tree by
-//    establishing multiple partition boundaries, or by modifying the
-//    structure into an MVP tree. Of course, if that path is selected, we're
-//    really talking about a different data structure.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT = EuclideanDistance<std::vector<double> > >
+//*************************************************************************
+EXPORT template<typename T = std::vector<double>,
+         double (*DISTANCE)(const T&, const T&) = euclidean<T> >
 class VpTree
 {
 public:
-   typedef typename MetricT::value_type PointT;
-      //> The point record type, derived from the metric value type.
+   VpTree();
+      //> The default constructor creates a null tree.
       //<
 
-   typedef typename PointT::difference_type DiffT;
-      //> The difference type, derived from the point record difference type.
+   template<typename CONTAINER>
+   VpTree(const CONTAINER&, const std::size_t& leafCapacity=8);
+      //> Create a VpTree from a (probably unsorted) container of items.
       //<
-
-   typedef typename MetricT::return_type DistT;
-      //> The distance type, derived from the metric return type.
+    
+   virtual ~VpTree();
+      //> Free resources allocated by this tree.
       //<
-
-   typedef std::size_t IndexT;
-      //> The index type, consistent with STL size type.
-      //<
-
-   typedef std::pair<std::deque<IndexT>,
-                     std::deque<DistT> > SearchResultsT;
-      //> The search results type, a pair of deques of indices and distances.
-      //<
-
-   explicit VpTree(const MetricT& metric=MetricT(),
-                   const IndexT& leafCapacity=8);
-      //> Instantiate an empty tree.
-      //<
-
-   template<typename DatabaseT>
-   explicit VpTree(const DatabaseT&,
-                   const MetricT& metric=MetricT(),
-                   const IndexT& leafCapacity=8);
-      //> Instantiate a tree from a database of items.
-      //<
-
-   virtual ~VpTree();
-      //> Destruct the tree and deallocate resources.
-      //<
-
-   void excludeWithin(const DistT&);
-      //> Exclude points from search results that fall within the specified
-      //  distance.
-      //<
-
-   void includeAllMatches();
-      //> Include all matches in search results. Clears any previously set
-      //  thresholds.
-      //<
-
-   SearchResultsT knn(const PointT&, const IndexT&,
-                      const DistT& limit=std::numeric_limits<DistT>::max())
-                      const;
+    
+   std::pair<std::deque<std::size_t>, std::deque<double> > knn(
+           const T&,
+           const std::size_t&,
+           const double limit=std::numeric_limits<double>::max()) const;
       //> Perform a k nearest neighbor search on the tree returning the
       //  indices of and distances to the k nearest neighbors.
       //<
-   
-   SearchResultsT rnn(const PointT&, const DistT&) const;
+    
+   std::pair<std::deque<std::size_t>, std::deque<double> > rnn(
+           const T&,
+           const double) const;
       //> Perform a fixed radius nearest neighbor search on the tree
       //  returning the indices of and distances to the neighbors in the
@@ -153,233 +107,72 @@
     
 private:
-
-   // Make the node types inner classes.
-   class Node;
-      //> An abstract node interface for a vantage point tree.
+   VpTree(const VpTree&);
+      //> Disable copy construction for VpTree.
       //<
-
-   class Branch;
-      //> A vantage-point tree internal (non-terminal) node.
-      //<
-
-   class Leaf;
-      //> A vantage-point tree terminal node.
-      //<
-
-   // Perform item management with inner classes as well.
+    
    class Item;
-      //> A simple container to capture a database element along with its index
-      //  and ancestral pivot history.
+      //> The VpsTree::Item class provides a simple container to capture a
+      //  database element along with its index and ancestral pivot
+      //  history.
       //<
 
    class ResultsCandidate;
-      //> A light-weight representation of a search result candidate item.
+      //> The VpTree::ResultsCandidate class provides a private
+      //  representation of search result candidates to be employed in an
+      //  intermediate priority queue of candidate results.
+      //<
+    
+   class Node;
+      //> The VpTree::Node class provides the private definition of
+      //  general VpTree nodes.
+      //<
+    
+   class Internal;
+      //> The VpTree::Internal class provides the private definition of
+      //  internal VpTree nodes.
+      //<
+    
+   class Leaf;
+      //> The VpTree::Node class provides the private definition of
+      //  VpTree leaf nodes.
       //<
 
-   typedef std::priority_queue<ResultsCandidate> ResultsSetT;
-      //> Search results are built by traversing the vantage point tree and
-      //  maintaining candidate results on a priority queue sorted by distance
-      //  to the query.
-      //<
+   friend class VpTree<T, DISTANCE>::Node;
+   friend class VpTree<T, DISTANCE>::Internal;
+   friend class VpTree<T, DISTANCE>::Leaf;
 
-   VpTree(const VpTree&);
-      //> Explicitly disable the compiler-generated copy constructor. No
-      //  definition provided.
-      //<
-
-   Node* makeTree(const IndexT&, const IndexT&);
+   Node* makeTree(const std::size_t&, const std::size_t&);
       //> Set this tree's root to be the root of the tree created from the
       //  argument set of metric-space elements.
       //<
     
-   std::set<IndexT> randomSample(const IndexT&, const IndexT&) const;
+   std::size_t selectVp(const std::size_t&, const std::size_t&) const;
+      //> Select a vantage point in the range between the provided indices.
+      //<
+    
+   std::set<std::size_t> randomSample(const std::size_t&,
+                                      const std::size_t&) const;
       //> Select a random sample in the range between the provided indices.
       //<
 
-   IndexT selectVp(const IndexT&, const IndexT&) const;
-      //> Select a vantage point in the range between the provided indices.
-      //<
-    
    Node* theRoot;
-      //> The root is the starting point for all queries against the database
-      //  represented by the VpTree.
+      //> The VpTree root is the starting point for all queries against the
+      //  database represented by the VpTree.
       //<
     
    std::deque<Item> theItems;
-      //> The items are the set of metric-space elements managed by the vantage
-      //  point tree paired with their original indices in the unordered 
+      //> The items are the set of metric-space elements managed by the
+      //  VpTree paired with their original indices in the unordered
       //  database.
       //<
    
-   IndexT theLeafCapacity;
-      //> Improve search efficiency by stopping recursion before completely
-      //  forming a binary search tree. The leaf capacity sets the threshold
-      //  for the number of elements that may be collapsed into a single node.
-      //  This threshold should be set by empirically testing the point at
-      //  which a linear search becomes more efficient than a binary search.
-      //<
-   
-   MetricT theMetric;
-      //> The distance metric used to construct and search this tree.
-      //<
-
-   DistT theApproximateThreshold;
-      //> The distance threshold used to consider points equal to the query.
-      //<
-
-   bool theApproximatesAreExcluded;
-      //> Exclude points that are approximately equal to the query point.
-      //<
-
-   friend class VpTree<MetricT>::Node;
-      //> There is a defect in the C++03 standard that forces friendship of
-      //  nested classes to be explicitly declared. This relationship will be
-      //  made implicit in C++11.
-      //<
-
-   friend class VpTree<MetricT>::Branch;
-      //> There is a defect in the C++03 standard that forces friendship of
-      //  nested classes to be explicitly declared. This relationship will be
-      //  made implicit in C++11.
-      //<
-
-   friend class VpTree<MetricT>::Leaf;
-      //> There is a defect in the C++03 standard that forces friendship of
-      //  nested classes to be explicitly declared. This relationship will be
-      //  made implicit in C++11.
+   std::size_t theLeafCapacity;
+      //>
       //<
 };
 
-//*****************************************************************************
-// VpTree::VpTree(const MetricT&, const IndexT&)
-//>   Instantiate an empty tree.
-//
-//    @tparam MetricT      The metric search space.
-//    @param  metric       The metric space to use for this tree's spatial
-//                         index.
-//    @param  leafCapacity The number of nodes to collapse into a single leaf.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-VpTree<MetricT>::VpTree(const MetricT& metric,
-                        const IndexT& leafCapacity)
-   : theRoot(0)
-   , theItems()
-   , theLeafCapacity((leafCapacity<1)?1:leafCapacity)
-   , theMetric(metric)
-   , theApproximateThreshold(0)
-   , theApproximatesAreExcluded(false)
-{
-}
-
-//*****************************************************************************
-// VpTree::VpTree(const DatabaseT&, const MetricT&, const IndexT&)
-//>   Instantiate a tree from a database of items.
-//
-//    @tparam MetricT      The metric search space.
-//    @param  elems        The container of elements to be indexed.
-//    @param  metric       The metric space to use for this tree's spatial
-//                         index.
-//    @param  leafCapacity The number of nodes to collapse into a single leaf.
-//<
-//*****************************************************************************
-template<typename MetricT>
-template<typename DatabaseT>
-inline
-VpTree<MetricT>::VpTree(const DatabaseT& elems,
-                        const MetricT& metric,
-                        const IndexT& leafCapacity)
-   : theRoot(0)
-   , theItems(elems.size())
-   , theLeafCapacity((leafCapacity<1)?1:leafCapacity)
-   , theMetric(metric)
-   , theApproximateThreshold(0)
-   , theApproximatesAreExcluded(false)
-{
-   #if _OPENMP
-   if (omp_get_num_threads() == 1)
-   {
-      omp_set_dynamic(1);
-      omp_set_num_threads(omp_get_num_procs());
-   }
-   #endif
-
-   #pragma omp parallel for
-   for (int i = 0; i < static_cast<int>(theItems.size()); ++i)
-   {
-      unsigned int idx = static_cast<unsigned int>(i);
-      theItems[idx].theIndex=idx;
-      theItems[idx].theElement=elems[idx];
-   }
-
-   theRoot = makeTree(0, theItems.size());
-}
-                
-//*****************************************************************************
-// VpTree::~VpTree()
-//>   Destruct the tree and deallocate resources.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-VpTree<MetricT>::~VpTree()
-{
-   delete theRoot;
-   theRoot = 0;
-}
-
-//*****************************************************************************
-// VpTree::excludeWithin(const DistT&)
-//>   Exclude Exclude points from search results that fall within the specified
-//    distance.
-//
-//    @tparam MetricT    The metric search space.
-//    @param  threshold  The distance threshold.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-void
-VpTree<MetricT>::excludeWithin(const DistT& threshold)
-{
-   theApproximateThreshold = threshold;
-   theApproximatesAreExcluded = true;
-}
-
-//*****************************************************************************
-// VpTree::includeAllMatches()
-//>   Include all matches in search results. Clears any previously set
-//    thresholds.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-void
-VpTree<MetricT>::includeAllMatches()
-{
-   theApproximateThreshold = 0;
-   theApproximatesAreExcluded = false;
-}
-
-}
-
-//*****************************************************************************
-// External References
-//*****************************************************************************
-#include "VpTree_Node.h"
-#include "VpTree_Branch.h"
-#include "VpTree_Leaf.h"
-#include "VpTree_Item.h"
-#include "VpTree_ResultsCandidate.h"
-
-//*****************************************************************************
-// Template Inclusion
-//*****************************************************************************
-#include "VpTree.hpp" // HASA VpTree Template Implementation.
+#if defined(MAKE_DEPENDING) || defined(TEMPLATE_INCLUSION)
+#include "VpTree.cpp"
+#endif
 
 #endif
Index: mkjer/Util/SpatialIndexing/VpTree/VpTree.hpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree.hpp	(revision 15)
+++ 	(revision )
@@ -1,415 +1,0 @@
-//*****************************************************************************
-// FILE:        VpTree.hpp
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The template implementation for vantage-point trees.
-//<
-//
-// LIMITATIONS:
-//>   This class template file is a section of the Damkjer::VpTree interface
-//    definition and should not be directly included.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Set typedefs to make code more readable and to allow for
-//               varying container and metric types. This is useful when the
-//               default double-precision is overkill. It is now easy to set
-//               types to float.
-//<
-//*****************************************************************************
-
-#if _OPENMP
-#include <omp.h>
-#endif
-
-#include <algorithm>
-#include <iostream>
-
-#include "VpTree.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// VpTree::knn(const PointT&, const IndexT&, const DistT&)
-//>   Perform a k nearest neighbor search on the tree returning the indices of
-//    and distances to the k nearest neighbors.
-//
-//    @tparam MetricT The metric search space.
-//    @param  query   The query point to focus the search about.
-//    @param  k       The number of neighbors to identify.
-//    @param  limit   The radial reach used to bound the search.
-//    @return         The search results ordered by distance to the query.
-//<
-//*****************************************************************************
-template<typename MetricT>
-typename VpTree<MetricT>::SearchResultsT
-VpTree<MetricT>::knn(const PointT& query,
-                     const IndexT& k,
-                     const DistT& limit)
-const
-{
-   ResultsSetT candidates;
-   DistT tau = limit;
-
-   theRoot->knn(query, k, candidates, tau);
-
-   std::deque<IndexT> indices;
-   std::deque<DistT> distances;
-
-   while(!candidates.empty())
-   {
-      indices.push_back(theItems[candidates.top().theIndex].theIndex);
-      distances.push_back(candidates.top().theDistance);
-      candidates.pop();
-   }
-
-   std::reverse(indices.begin(), indices.end());
-   std::reverse(distances.begin(), distances.end());
-
-   return std::make_pair(indices, distances);
-}
-
-//*****************************************************************************
-// VpTree::rnn(const PointT&, const DistT&)
-//>   Perform a fixed radius nearest neighbor search on the tree returning the
-//    indices of and distances to the neighbors in the fixed radius.
-//
-//    @tparam MetricT The metric search space.
-//    @param  query   The query point to focus the search about.
-//    @param  range   The radial distance used to bound the search.
-//    @return         The search results ordered by distance to the query.
-//<
-//*****************************************************************************
-template<typename MetricT>
-typename VpTree<MetricT>::SearchResultsT
-VpTree<MetricT>::rnn(const PointT& query,
-                     const DistT& range)
-const
-{
-   ResultsSetT candidates;
-
-   theRoot->rnn(query, range, candidates);
-
-   std::deque<IndexT> indices;
-   std::deque<DistT> distances;
-
-   while(!candidates.empty())
-   {
-      indices.push_back(theItems[candidates.top().theIndex].theIndex);
-      distances.push_back(candidates.top().theDistance);
-      candidates.pop();
-   }
-
-   std::reverse(indices.begin(), indices.end());
-   std::reverse(distances.begin(), distances.end());
-
-   return std::make_pair(indices, distances);
-}
-
-//*****************************************************************************
-// VpTree::makeTree(const IndexT&, const IndexT&)
-//>   Set this tree's root to be the root of the tree created from the argument
-//    set of metric-space elements.
-//
-//    @tparam MetricT The metric search space.
-//    @param  start   The beginning of the element range to transform into a
-//                    binary tree.
-//    @param  stop    The end of the element range to transform into a binary
-//                    tree.
-//    @return         The root of the constructed tree.
-//<
-//*****************************************************************************
-template<typename MetricT>
-typename VpTree<MetricT>::Node*
-VpTree<MetricT>::makeTree(const IndexT& start,
-                          const IndexT& stop)
-{
-   if (stop <= start) return 0;
-
-   IndexT setSize = stop - start;
-   
-   if (setSize <= theLeafCapacity)
-   {
-      return new Leaf(this, start, stop);
-   }
- 
-   Branch* node=new Branch(this);
-   node->theIndex=start;
-
-   const IndexT vp = selectVp(start, stop);
-   std::swap(theItems[start], theItems[vp]);
-   
-   // Identify bound elements
-   IndexT outerLowerBound = (start + stop + 1)/2;
-   IndexT innerLowerBound = start + 1;
-   
-   // Update histories
-   DistT d_max=0;
-   DistT d_min=std::numeric_limits<DistT>::max();
-
-   for (IndexT elem = stop; elem --> innerLowerBound; )
-   {
-      theItems[elem].theDistance = theMetric(theItems[start].theElement,
-                                             theItems[elem].theElement);
-      d_max = (theItems[elem].theDistance > d_max)
-              ? theItems[elem].theDistance : d_max;
-      d_min = (theItems[elem].theDistance < d_min)
-              ? theItems[elem].theDistance : d_min;
-   }
-   
-   // Put the median element in place
-   std::nth_element(theItems.begin() + static_cast<DiffT>(innerLowerBound),
-                    theItems.begin() + static_cast<DiffT>(outerLowerBound),
-                    theItems.begin() + static_cast<DiffT>(stop));
-
-   DistT d_mid=0;
-
-   for (IndexT elem = outerLowerBound; elem --> innerLowerBound; )
-   {
-      d_mid = (theItems[elem].theDistance > d_mid)
-              ? theItems[elem].theDistance : d_mid;
-   }
-   
-   node->theInnerLowerBound=d_min;
-   node->theInnerUpperBound=d_mid;
-   node->theOuterLowerBound=theItems[outerLowerBound].theDistance;
-   node->theOuterUpperBound=d_max;
-   
-   #if _OPENMP
-   static int threads = 0;
-   
-   if (threads < (omp_get_num_procs()-1))
-   {
-      if (omp_get_num_threads() == 1)
-      {
-         omp_set_dynamic(1);
-         omp_set_num_threads(omp_get_num_procs());
-      }
-
-      if (!omp_get_nested())
-      {
-         omp_set_nested(1);
-      }
-      
-      #pragma omp atomic
-      ++threads;
-      
-      #pragma omp parallel num_threads(2)
-      {         
-         #pragma omp sections nowait
-         {
-            node->theInnerBranch = makeTree(innerLowerBound,
-                                            outerLowerBound);
-              
-            #pragma omp section
-            node->theOuterBranch = makeTree(outerLowerBound, stop);
-         }
-      }
-      
-      #pragma omp atomic
-      --threads;
-   }
-   else
-   #endif
-   {
-      node->theInnerBranch = makeTree(innerLowerBound, outerLowerBound);
-      node->theOuterBranch = makeTree(outerLowerBound, stop);
-   }
-   
-   return node;
-}
-
-//*****************************************************************************
-// VpTree::randomSample(const IndexT&, const IndexT&)
-//>   Select a random sample in the range between the provided indices.
-//
-//    @tparam MetricT The metric search space.
-//    @param  start   The beginning of the element range to transform into a
-//                    binary tree.
-//    @param  stop    The end of the element range to transform into a binary
-//                    tree.
-//    @return         A set of randomly sampled elements from the provided
-//                    range.
-//<
-//*****************************************************************************
-template<typename MetricT>
-std::set<typename VpTree<MetricT>::IndexT>
-VpTree<MetricT>::randomSample(const IndexT& start,
-                              const IndexT& stop)
-const
-{
-   //***
-   // Sampling the sqrt of inputs, while thorough, is completely unnecessary.
-   // Leaving the note here for future reference.
-   //***
-   // IndexT numSamps=(IndexT)(ceil(sqrt((double)(stop - start))));
-
-   // A very small sample set of the population is sufficient
-   IndexT numSamps=(stop-start > 5) ? 5 : (stop - start);
-
-   //***
-   // If the range is smaller than the number of samples, just return the
-   // elements in the range.
-   //***
-   if ((stop - start) <= numSamps)
-   {
-      std::vector<IndexT> indices(stop-start, 0);
-
-      for (std::size_t i=start; i < stop; ++i)
-      {
-         indices[i-start]=i;
-      }
-        
-      return std::set<IndexT>(indices.begin(), indices.end());
-   }
-    
-   std::set<IndexT> samples;
-    
-   //***
-   // If the range is close to the number of samples, select with better
-   // worst-case behvior
-   //***
-   if ((stop - start) < numSamps*2)
-   {
-      IndexT itemsNeeded=numSamps;
-        
-      for (IndexT i = start; samples.size() < numSamps && i < stop; ++i)
-      {
-         if ((rand()/(RAND_MAX + 1.0)) < itemsNeeded/(stop-i))
-         {
-            samples.insert(i);
-            --itemsNeeded;
-         }
-      }
-   }
-   else
-   {
-      //***
-      // Otherwise, if range dominates samples, select expecting to find
-      // unique samples
-      //***
-      while (samples.size() < numSamps)
-      {
-         // Choose an arbitrary point
-         IndexT val=static_cast<IndexT>(rand() / (RAND_MAX + 1.0) *
-                                        (stop - start) + start);
-
-         samples.insert(val);
-      }
-   }
-   
-   return samples;
-}
-                                
-//*****************************************************************************
-// VpTree::selectVp(const IndexT&, const IndexT&)
-//>   Select a vantage point in the range between the provided indices.
-//
-//    @tparam MetricT The metric search space.
-//    @param  start   The beginning of the element range to transform into a
-//                    binary tree.
-//    @param  stop    The end of the element range to transform into a binary
-//                    tree.
-//    @return         Select a vantage point from the range of elements.
-//
-//    @todo Implement a median of 5's to impose stability into the selection.
-//<
-//*****************************************************************************
-template<typename MetricT>
-typename VpTree<MetricT>::IndexT
-VpTree<MetricT>::selectVp(const IndexT& start,
-                          const IndexT& stop)
-const
-{
-   //***
-   // Choosing a vantage point that maximizes the balance of the sub-trees is
-   // theoretically advantageous. This involves selecting a vantage point in a 
-   // "corner" of the population. However, in practice, the trade for increased
-   // selection time dwarfs the benefit realized through search times. The
-   // incredibly simple approach of selecting a random member of the population
-   // is much simpler and yields almost identical search times in the data sets
-   // tested.
-   //
-   // The "intellegent" selection mode is included in the source code for
-   // reference, but dropped by the pre-processor.
-   //***
-
-#if USE_OBSOLETED_CODE
-   // Choose a point from a small sample set that maximizes spread 
-   std::set<IndexT> p=randomSample(start, stop);
-    
-   IndexT bestP=*(p.begin());
-   DistT bestSpread=0;
-    
-   for (std::set<IndexT>::const_iterator pItr=p.begin();
-        pItr != p.end();
-        ++pItr)
-   {
-      const VpTree<PointT, MetricT>::Item& pItem = theItems[*pItr];
-
-      std::set<IndexT> d=randomSample(start, stop);
-      
-      std::vector<VpTree<PointT, MetricT>::Item> dItems(d.size());
-      
-      IndexT i = 0;
-      
-      for (std::set<IndexT>::const_iterator dItr=d.begin();
-           dItr != d.end();
-           ++dItr)
-      {
-          dItems[i]=theItems[*dItr];
-          ++i;
-      }
-
-      std::nth_element(dItems.begin(),
-                       dItems.begin() + dItems.size()/2,
-                       dItems.end());
-      
-      DistT mu = theMetric(pItem.theElement,
-                           dItems[dItems.size()/2].theElement);
-
-      IndexT k=1;
-      DistT x, oldM, newM;
-
-      x=oldM=newM=theMetric(pItem.theElement,
-                            dItems[0].theElement)-mu;
-      
-      DistT oldS, newS;
-      oldS=newS=0;
-      
-      for (IndexT i = 1; i < dItems.size(); ++i)
-      {
-         x=theMetric(pItem.theElement,
-                     dItems[i].theElement)-mu;
-
-         ++k;
-         newM=oldM+(x-oldM)/k;
-         newS=oldS+(x-oldM)*(x-newM);
-         oldM=newM;
-         oldS=newS;
-      }
-      
-      DistT spread=static_cast<DistT>((k>1)?newS/(k-1):0.0);
-      
-      if (spread > bestSpread)
-      {
-          bestSpread=spread;
-
-          bestP=*pItr;
-      }
-   }
-   
-   return bestP;
-#else
-   // Simplest working case: just choose an arbitrary point
-   return static_cast<IndexT>(rand()/(RAND_MAX + 1.0)*(stop-start)+start);
-#endif
-}
-
-}
Index: Damkjer/Util/SpatialIndexing/VpTree/VpTree.m
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree.m	(revision 0)
+++ Damkjer/Util/SpatialIndexing/VpTree/VpTree.m	(revision 0)
@@ -0,0 +1,105 @@
+% File:  VpTree.m
+%
+% Description: This MATLAB class represents a simple vantage-point tree.
+%
+% Limitations: See VpTree.h for complete description of limitations.
+%
+% Software History:
+%    2012-AUG-29   K. Damkjer
+%       Initial Coding.
+%
+
+classdef (Sealed = true) VpTree < handle
+    
+    properties (Hidden=true, Access = private)
+        theTree
+    end
+    
+    methods
+        function this = VpTree(varargin)
+            % This function builds the index structure for the database.
+            
+            if (nargin ~= 1)
+                error('VpTree:InvalidArgumentList',...
+                  'VpTree must be constructed with a set of observations');
+            end
+
+            this.theTree=newVpTree(varargin{1});
+        end
+
+        function delete(this)
+            % This function frees memory on delete (clear) of the VpTree.            
+            deleteVpTree(this.theTree);
+        end
+
+        function [idx,dist]=knn(this, queries, k, varargin)
+            % Perform a k-nearest neighbor search on the database with the 
+            % set of queries.
+            
+            userParams = struct('limit', realmax);
+            
+            % Parse the Property/Value pairs
+            if rem(length(varargin), 2) ~= 0
+                error('Damkjer:PropertyValueNotPair', ...
+                    ['Additional arguments must take the form of'...
+                     'Property/Value pairs']);
+            end
+            
+            propertyNames = {'limit'};
+            
+            while ~isempty(varargin)
+                property = varargin{1};
+                value    = varargin{2};
+                
+                % If the property has been supplied in a shortened form,
+                % lengthen it
+                iProperty = find(strncmpi(property, propertyNames, length(property)));
+                
+                if isempty(iProperty)
+                    error('Damkjer:InvalidProperty', 'Invalid Property');
+                elseif length(iProperty) > 1
+                    error('Damkjer:AmbiguousProperty', ...
+                          'Supplied shortened property name is ambiguous');
+                end
+                
+                property = propertyNames{iProperty};
+                
+                switch property
+                    case 'limit'
+                        if (isscalar(value) && ...
+                                isnumeric(value) && ...
+                                isreal(value) && ...
+                                value > 0)
+                            userParams.limit = value;
+                        else
+                            error('Damkjer:InvalidLimit', ...
+                                ['Limit must be a real valued '...
+                                 'positive scalar']);
+                        end
+                end
+                
+                varargin(1:2) = [];
+            end
+
+            if (nargout == 1)
+                idx=kannVpTree(this.theTree, queries, k,...
+                                 userParams.limit);
+            else
+                [idx,dist]=kannVpTree(this.theTree, queries, k,...
+                    userParams.limit);
+            end
+        end
+
+        function [idx,dist]=rnn(this, data, radius)
+            % Perform a fixed-radius nearest neighbor search on the
+            % database with the set of queries.
+            
+            if (nargout == 1)
+                idx=frannVpTree(this.theTree, data, radius);
+            else
+                [idx,dist]=frannVpTree(this.theTree, data, radius);
+            end
+        end
+    end    
+end
+
Index: mkjer/Util/SpatialIndexing/VpTree/VpTree_Branch.h
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree_Branch.h	(revision 12)
+++ 	(revision )
@@ -1,178 +1,0 @@
-//*****************************************************************************
-// FILE:        VpTree_Branch.h
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The interface definition for vantage-point tree branches.
-//<
-//
-// LIMITATIONS:
-//>   This class template file is a section of the Damkjer::VpTree interface
-//    definition and should not be directly included.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Set typedefs to make code more readable and to allow for
-//               varying container and metric types. This is useful when the
-//               default double-precision is overkill. It is now easy to set
-//               types to float.
-//<
-//*****************************************************************************
-#ifndef Damkjer_VpTree_Branch_HEADER
-#define Damkjer_VpTree_Branch_HEADER
-
-#if _OPENMP
-#include <omp.h>
-#endif
-
-#include <algorithm>
-#include <iostream>
-
-#include "VpTree_Node.h" // ISA Damkjer::VpTree::Node
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// CLASS: VpTree::Branch
-//>   A vantage-point tree internal (non-terminal) node.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-class VpTree<MetricT>::Branch : public VpTree<MetricT>::Node
-{
-public:
-   Branch();
-      //> Instantiate a null node.
-      //<
-    
-   Branch(VpTree*);
-      //> Instantiate a node with a database reference.
-      //<
-    
-   virtual ~Branch();
-      //> Destruct the node and deallocate resources.
-      //<
-    
-   virtual void knn(const PointT&,
-                    const IndexT&,
-                    ResultsSetT&,
-                    DistT&) const;
-      //> Accumulate the k nearest neighbor results.
-      //<
-
-   virtual void rnn(const PointT&,
-                    const DistT&,
-                    ResultsSetT&) const;
-      //> Accumulate the fixed-radius nearest neighbor results.
-      //<
-
-private:
-
-   IndexT theIndex;
-      //> The index of the item in the internal database.
-      //<
-
-   DistT theInnerLowerBound;
-      //> The lower bound distance to elements on inner branch.
-      //<
-
-   DistT theInnerUpperBound;
-      //> The uuper bound distance to elements on inner branch.
-      //<
-
-   DistT theOuterLowerBound;
-      //> The lower bound distance to elements on outer branch.
-      //<
-
-   DistT theOuterUpperBound;
-      //> The upper bound distance to elements on outer branch.
-      //<
-
-   Node* theInnerBranch;
-      //> The inner branch partition containing elements closer than
-      //  the median partition to this element.
-      //<
-
-   Node* theOuterBranch;
-      //> The outer branch partition containing elements at or beyond
-      //  the median partition from this element.
-      //<
-
-   friend class VpTree<MetricT>;
-      //> Provide access to branch internals to the containing tree class.
-      //<
-};
-
-//*****************************************************************************
-// VpTree::Branch::Branch
-//>   Instantiate a null node.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-VpTree<MetricT>::Branch::Branch()
-   : Node()
-   , theIndex(0)
-   , theInnerLowerBound(0)
-   , theInnerUpperBound(0)
-   , theOuterLowerBound(0)
-   , theOuterUpperBound(0)
-   , theInnerBranch(0)
-   , theOuterBranch(0)
-{
-}
-
-//*****************************************************************************
-// VpTree::Branch::Branch
-//>   Instantiate a node with a database reference.
-//
-//    @tparam MetricT The metric search space.
-//    @param  tree    The vantage point tree containing the item database.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-VpTree<MetricT>::Branch::Branch(VpTree<MetricT>* tree)
-   : Node(tree)
-   , theIndex(0)
-   , theInnerLowerBound(0)
-   , theInnerUpperBound(0)
-   , theOuterLowerBound(0)
-   , theOuterUpperBound(0)
-   , theInnerBranch(0)
-   , theOuterBranch(0)
-{
-}
-
-//*****************************************************************************
-// VpTree::Branch::~Branch
-//>   Destruct the node and deallocate resources. Virtual to ensure proper node
-//    destruction.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-VpTree<MetricT>::Branch::~Branch()
-{
-   delete theInnerBranch;
-   delete theOuterBranch;
-   theInnerBranch = 0;
-   theOuterBranch = 0;
-}
-
-}
-
-#include "VpTree_Branch.hpp"
-
-#endif
Index: mkjer/Util/SpatialIndexing/VpTree/VpTree_Branch.hpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree_Branch.hpp	(revision 13)
+++ 	(revision )
@@ -1,199 +1,0 @@
-//*****************************************************************************
-// FILE:        VpTree_Branch.hpp
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The template implementation for vantage-point tree branches.
-//<
-//
-// LIMITATIONS:
-//>   This class template file is a section of the Damkjer::VpTree interface
-//    definition and should not be directly included.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Set typedefs to make code more readable and to allow for
-//               varying container and metric types. This is useful when the
-//               default double-precision is overkill. It is now easy to set
-//               types to float.
-//<
-//*****************************************************************************
-
-#if _OPENMP
-#include <omp.h>
-#endif
-
-#include <algorithm>
-#include <iostream>
-
-#include "VpTree_Branch.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// VpTree::Branch::knn
-//>   Accumulate the k nearest neighbor results.
-//
-//    @tparam        MetricT     The metric search space.
-//    @param[in]     query       The query point to focus the search about.
-//    @param[in]     k           The number of neighbors to identify.
-//    @param[in,out] candidates  The set of candidate results.
-//    @param[in,out] kth_closest The distance to the kth-closest item.
-//<
-//*****************************************************************************
-template<typename MetricT>
-void
-VpTree<MetricT>::Branch::knn(const PointT& query,
-                             const IndexT& k,
-                             ResultsSetT& candidates,
-                             DistT& kth_closest)
-const
-{
-   if (!(this->theTree)) return;
-
-   DistT distance = this->theTree->theMetric(
-                                  this->theTree->theItems[theIndex].theElement,
-                                  query);
-
-   if (!(this->theTree->theApproximatesAreExcluded &&
-         distance < this->theTree->theApproximateThreshold) &&
-       distance < kth_closest)
-   {
-      if (candidates.size() == k)
-      {
-         candidates.pop();
-      }
-      
-      candidates.push(ResultsCandidate(theIndex, distance));
-      
-      if (candidates.size() == k)
-      {
-         kth_closest = candidates.top().theDistance;
-      }
-   }
-
-   if (!(theInnerBranch || theOuterBranch))
-   {
-      return;
-   }
-
-   DistT middle = static_cast<DistT>
-                  (0.5 * (theInnerUpperBound + theOuterLowerBound));
-
-   if (distance < middle)
-   {
-      if (theInnerBranch &&
-          (distance - theInnerUpperBound <= kth_closest) &&
-          (theInnerLowerBound - distance <= kth_closest))
-
-
-      if (theInnerBranch &&
-          (distance <= theInnerUpperBound + kth_closest) &&
-          (distance >= theInnerLowerBound - kth_closest))
-      {
-         theInnerBranch->knn(query, k, candidates, kth_closest);
-      }
-       
-      if (theOuterBranch &&
-          (distance >= theOuterLowerBound - kth_closest) &&
-          (distance <= theOuterUpperBound + kth_closest))
-      {
-         theOuterBranch->knn(query, k, candidates, kth_closest);
-      }
-   }
-   else
-   {
-      if (theOuterBranch &&
-          (distance >= theOuterLowerBound - kth_closest) &&
-          (distance <= theOuterUpperBound + kth_closest))
-      {
-         theOuterBranch->knn(query, k, candidates, kth_closest);
-      }
-       
-      if (theInnerBranch &&
-          (distance <= theInnerUpperBound + kth_closest) &&
-          (distance >= theInnerLowerBound - kth_closest))
-      {
-         theInnerBranch->knn(query, k, candidates, kth_closest);
-      }
-   }
-}
-
-//*****************************************************************************
-// VpTree::Branch::rnn
-//>   Accumulate the fixed-radius nearest neighbor results.
-//
-//    @tparam        MetricT    The metric search space.
-//    @param[in]     query      The query point to focus the search about.
-//    @param[in]     range      The radial distance used to bound the search.
-//    @param[in,out] candidates The set of candidate results.
-//<
-//*****************************************************************************
-template<typename MetricT>
-void
-VpTree<MetricT>::Branch::rnn(const PointT& query,
-                             const DistT& range,
-                             ResultsSetT& candidates)
-const
-{
-   if (!(this->theTree)) return;
-   
-   DistT distance = this->theTree->theMetric(
-                                  this->theTree->theItems[theIndex].theElement,
-                                  query);
-
-   if (!(this->theTree->theApproximatesAreExcluded &&
-         distance < this->theTree->theApproximateThreshold) &&
-       distance <= range)
-   {
-      candidates.push(ResultsCandidate(theIndex, distance));
-   }
-
-   if (!(theInnerBranch || theOuterBranch))
-   {
-      return;
-   }
-
-   DistT middle = static_cast<DistT>
-                  (0.5 * (theInnerUpperBound + theOuterLowerBound));
-
-   if (distance < middle)
-   {
-      if (theInnerBranch &&
-          (distance <= theInnerUpperBound + range) &&
-          (distance >= theInnerLowerBound - range))
-      {
-         theInnerBranch->rnn(query, range, candidates);
-      }
-       
-      if (theOuterBranch &&
-          (distance >= theOuterLowerBound - range) &&
-          (distance <= theOuterUpperBound + range))
-      {
-         theOuterBranch->rnn(query, range, candidates);
-      }
-   }
-   else
-   {
-      if (theOuterBranch &&
-          (distance >= theOuterLowerBound - range) &&
-          (distance <= theOuterUpperBound + range))
-      {
-         theOuterBranch->rnn(query, range, candidates);
-      }
-       
-      if (theInnerBranch &&
-          (distance <= theInnerUpperBound + range) &&
-          (distance >= theInnerLowerBound - range))
-      {
-         theInnerBranch->rnn(query, range, candidates);
-      }
-   }
-}
-
-}
Index: mkjer/Util/SpatialIndexing/VpTree/VpTree_Item.h
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree_Item.h	(revision 12)
+++ 	(revision )
@@ -1,138 +1,0 @@
-//*****************************************************************************
-// FILE:        VpTree_Item.h
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The interface definition for vantage-point tree items.
-//<
-//
-// LIMITATIONS:
-//>   This class template file is a section of the Damkjer::VpTree interface
-//    definition and should not be directly included.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Set typedefs to make code more readable and to allow for
-//               varying container and metric types. This is useful when the
-//               default double-precision is overkill. It is now easy to set
-//               types to float.
-//<
-//*****************************************************************************
-#ifndef Damkjer_VpTree_Item_HEADER
-#define Damkjer_VpTree_Item_HEADER
-
-#if _OPENMP
-#include <omp.h>
-#endif
-
-#include <algorithm>
-#include <iostream>
-
-#include "VpTree.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// CLASS: VpTree::Item
-//>   A simple container to capture a database element along with its index and
-//    ancestral pivot history.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-class VpTree<MetricT>::Item
-{
-public:
-   Item();
-      //> The default constructor creates a blank item.
-      //<
-
-   //***
-   // Use the compiler-generated copy constructor.
-   // Item(const Item&);
-   //***
-
-   ~Item(){}
-      //> The default destructor. Intentionally non-virtual since Node is
-      //  a private inner class on VpTree.
-      //<
-
-   //***
-   // Use the compiler-generated assignment operator.
-   // Item& operator=(const Item&);
-   //***
-
-   bool operator<(const Item&) const;
-      //> Less-than comparison for vantage point tree items.
-      //<
-
-private:
-   IndexT theIndex;
-      //> The index of the item in the input data set.
-      //<
-
-   PointT theElement;
-      //> The database object
-      //<
-   
-   DistT theDistance;
-      //> The most recent ancestral pivot history distance for this item.
-      //<
-
-   friend class VpTree<MetricT>;
-      //> Provide access to item internals to the containing tree class.
-      //<
-};
-
-//*****************************************************************************
-// VpTree::Item::Item()
-//>   The default constructor creates a blank item.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-VpTree<MetricT>::Item::Item()
-   : theIndex(0)
-   , theElement(0)
-   , theDistance(0)
-{
-}
-
-//*****************************************************************************
-// VpTree::Item::operator<(const Item&)
-//>   Less-than comparison for vantage point tree items.
-//
-//    @note
-//    In general, the other members of the comparison operator family should be
-//    implemented. They are not in the case of vantage point tree items because
-//    the less-than comparitor is only used in sorting semantics. The remaining
-//    operators would thus be defined, but never used since items are private
-//    to the vantage point tree.
-//
-//    @tparam MetricT The metric search space.
-//    @param  other   The vantage point tree item for comparison against this
-//                    item.
-//    @return         true if and only if this item is closer to the query than
-//                    the other item.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-bool
-VpTree<MetricT>::Item::operator<(const Item& other)
-const
-{
-   return theDistance < other.theDistance;
-}
-
-}
-
-#endif
Index: mkjer/Util/SpatialIndexing/VpTree/VpTree_Leaf.h
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree_Leaf.h	(revision 12)
+++ 	(revision )
@@ -1,131 +1,0 @@
-//*****************************************************************************
-// FILE:        VpTree_Leaf.h
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The interface definition for vantage-point tree leaves.
-//<
-//
-// LIMITATIONS:
-//>   This class template file is a section of the Damkjer::VpTree interface
-//    definition and should not be directly included.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Set typedefs to make code more readable and to allow for
-//               varying container and metric types. This is useful when the
-//               default double-precision is overkill. It is now easy to set
-//               types to float.
-//<
-//*****************************************************************************
-#ifndef Damkjer_VpTree_LeafNode_HEADER
-#define Damkjer_VpTree_LeafNode_HEADER
-
-#if _OPENMP
-#include <omp.h>
-#endif
-
-#include <algorithm>
-#include <iostream>
-
-#include "VpTree_Node.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// CLASS: VpTree::Leaf
-//>   A vantage-point tree terminal node.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-class VpTree<MetricT>::Leaf : public VpTree<MetricT>::Node
-{
-public:
-   Leaf();
-      //> Instantiate a null node.
-      //<
-    
-   Leaf(VpTree*, const IndexT&, const IndexT&);
-      //> Instantiate a leaf with a database reference that represents the
-      //  items in the provided index range.
-      //<
-    
-   virtual ~Leaf(){}
-      //> Destruct the node and deallocate resources.
-      //
-      //    @tparam MetricT The metric search space.
-      //<
-    
-   virtual void knn(const PointT&,
-                    const IndexT&,
-                    ResultsSetT&,
-                    DistT&) const;
-      //> Accumulate the k nearest neighbor results.
-      //<
-
-   virtual void rnn(const PointT&,
-                    const DistT&,
-                    ResultsSetT&) const;
-      //> Accumulate the fixed-radius nearest neighbor results.
-      //<
-
-private:
-   IndexT theHead;
-      //> The start of the index range represented by this leaf node.
-      //<
-
-   IndexT theTail;
-      //> The end of the index range represented by this leaf node.
-      //<
-};
-
-//*****************************************************************************
-// VpTree::Leaf::Leaf
-//>   Instantiate a null node.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-VpTree<MetricT>::Leaf::Leaf()
-   : Node()
-   , theHead(0)
-   , theTail(0)
-{
-}
-
-//*****************************************************************************
-// VpTree::Leaf::Leaf
-//>   Instantiate a leaf with a database reference that represents the items in
-//    the provided index range.
-//
-//    @tparam MetricT The metric search space.
-//    @param  tree    The vantage point tree containing the item database.
-//    @param  head    The start of the item index range.
-//    @param  tail    The end of the item index range.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-VpTree<MetricT>::Leaf::Leaf(VpTree* tree,
-                            const IndexT& head,
-                            const IndexT& tail)
-   : Node(tree)
-   , theHead(head)
-   , theTail(tail)
-{
-}
-
-}
-
-#include "VpTree_Leaf.hpp"
-
-#endif
Index: mkjer/Util/SpatialIndexing/VpTree/VpTree_Leaf.hpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree_Leaf.hpp	(revision 15)
+++ 	(revision )
@@ -1,121 +1,0 @@
-//*****************************************************************************
-// FILE:        VpTree_Leaf.hpp
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The template implementation for vantage-point tree leaves.
-//<
-//
-// LIMITATIONS:
-//>   This class template file is a section of the Damkjer::VpTree interface
-//    definition and should not be directly included.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Set typedefs to make code more readable and to allow for
-//               varying container and metric types. This is useful when the
-//               default double-precision is overkill. It is now easy to set
-//               types to float.
-//<
-//*****************************************************************************
-
-#if _OPENMP
-#include <omp.h>
-#endif
-
-#include <algorithm>
-#include <iostream>
-
-#include "VpTree_Leaf.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// VpTree::Leaf::knn
-//>   Accumulate the k nearest neighbor results.
-//
-//    @tparam        MetricT     The metric search space.
-//    @param[in]     query       The query point to focus the search about.
-//    @param[in]     k           The number of neighbors to identify.
-//    @param[in,out] candidates  The set of candidate results.
-//    @param[in,out] kth_closest The distance to the kth-closest item.
-//<
-//*****************************************************************************
-template<typename MetricT>
-void
-VpTree<MetricT>::Leaf::knn(const PointT& query,
-                           const IndexT& k,
-                           ResultsSetT& candidates,
-                           DistT& kth_closest)
-const
-{
-   if (!(this->theTree)) return;
-   
-   // Scan the leaf
-   for (IndexT item = theHead; item < theTail; ++item)
-   {
-      // This is the check state
-      DistT distance = this->theTree->theMetric(
-                                      this->theTree->theItems[item].theElement,
-                                      query);
-      
-      if (!(this->theTree->theApproximatesAreExcluded &&
-            distance < this->theTree->theApproximateThreshold) &&
-          distance < kth_closest)
-      {
-         if (candidates.size() == k)
-         {
-            candidates.pop();
-         }
-         
-         candidates.push(ResultsCandidate(item, distance));
-         
-         if (candidates.size() == k)
-         {
-            kth_closest = candidates.top().theDistance;
-         }
-      }
-   }
-}
-
-//*****************************************************************************
-// VpTree::Leaf::rnn
-//>   Accumulate the fixed-radius nearest neighbor results.
-//
-//    @tparam        MetricT    The metric search space.
-//    @param[in]     query      The query point to focus the search about.
-//    @param[in]     range      The radial distance used to bound the search.
-//    @param[in,out] candidates The set of candidate results.
-//<
-//*****************************************************************************
-template<typename MetricT>
-void
-VpTree<MetricT>::Leaf::rnn(const PointT& query,
-                           const DistT& range,
-                           ResultsSetT& candidates)
-const
-{
-   if (!(this->theTree)) return;
-
-   // Scan the leaf
-   for (IndexT item = theHead; item < theTail; ++item)
-   {
-      DistT distance = this->theTree->theMetric(
-                                      this->theTree->theItems[item].theElement,
-                                      query);
-      
-      if (!(this->theTree->theApproximatesAreExcluded &&
-            distance < this->theTree->theApproximateThreshold) &&
-          distance <= range)
-      {
-         candidates.push(ResultsCandidate(item, distance));
-      }
-   }
-}
-
-}
Index: mkjer/Util/SpatialIndexing/VpTree/VpTree_Node.h
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree_Node.h	(revision 12)
+++ 	(revision )
@@ -1,126 +1,0 @@
-//*****************************************************************************
-// FILE:        VpTree_Node.h
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The interface definition for vantage-point tree nodes.
-//<
-//
-// LIMITATIONS:
-//>   This class template file is a section of the Damkjer::VpTree interface
-//    definition and should not be directly included.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Set typedefs to make code more readable and to allow for
-//               varying container and metric types. This is useful when the
-//               default double-precision is overkill. It is now easy to set
-//               types to float.
-//<
-//*****************************************************************************
-#ifndef Damkjer_VpTree_Node_HEADER
-#define Damkjer_VpTree_Node_HEADER
-
-#include "VpTree.h"  // ISA Damkjer::VpTree inner class;
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// CLASS: VpTree::Node
-//>   An abstract node interface for vantage point tree elements.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-class VpTree<MetricT>::Node
-{
-public:
-   Node();
-      //> Instantiate a null node.
-      //<
-
-   Node(VpTree* const);
-      //> Instantiate a node with a database reference.
-      //<
-    
-   virtual ~Node();
-      //> Destruct the node and deallocate resources.
-      //<
-    
-   virtual void knn(const PointT&,
-                    const IndexT&,
-                    ResultsSetT&,
-                    DistT&) const = 0;
-      //> Accumulate the k nearest neighbor results.
-      //<
-
-   virtual void rnn(const PointT&,
-                    const DistT&,
-                    ResultsSetT&) const = 0;
-      //> Accumulate the fixed-radius nearest neighbor results.
-      //<
-
-protected:
-   VpTree<MetricT>* theTree;
-      //> The tree that this node belongs to.
-      //
-      //  Establishes an explicit relationship between the containing class and
-      //  nested class.  Included to avoid reallocating contained element data
-      //  for each node. As a side effect, nodes organize the tree's data
-      //  contents through the construction process.
-      //<
-};
-
-//*****************************************************************************
-// VpTree::Node::Node
-//>   Instantiate a null node.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-VpTree<MetricT>::Node::Node()
-   : theTree(0)
-{
-}
-
-//*****************************************************************************
-// VpTree::Node::Node
-//>   Instantiate a node with a database reference.
-//
-//    @tparam MetricT The metric search space.
-//    @param  tree    The vantage point tree containing the item database.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-VpTree<MetricT>::Node::Node(VpTree* tree)
-   : theTree(tree)
-{
-}
-
-//*****************************************************************************
-// VpTree::Node::~Node
-//>   Destruct the node and deallocate resources. Virtual to ensure proper node
-//    destruction.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-VpTree<MetricT>::Node::~Node()
-{
-   theTree = 0;
-}
-
-}
-
-#endif
Index: mkjer/Util/SpatialIndexing/VpTree/VpTree_ResultsCandidate.h
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree_ResultsCandidate.h	(revision 12)
+++ 	(revision )
@@ -1,143 +1,0 @@
-//*****************************************************************************
-// FILE:        VpTree_ResultsCandidate.h
-//
-//    Copyright (C)  2012 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The interface definition for vantage-point tree search result candidates.
-//<
-//
-// LIMITATIONS:
-//>   This class template file is a section of the Damkjer::VpTree interface
-//    definition and should not be directly included.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-SEP-11  K. Damkjer
-//               Initial Coding.
-//  2013-JUL-23  K. Damkjer
-//               Set typedefs to make code more readable and to allow for
-//               varying container and metric types. This is useful when the
-//               default double-precision is overkill. It is now easy to set
-//               types to float.
-//<
-//*****************************************************************************
-#ifndef Damkjer_VpTree_ResultsCandidate_HEADER
-#define Damkjer_VpTree_ResultsCandidate_HEADER
-
-#if _OPENMP
-#include <omp.h>
-#endif
-
-#include <algorithm>
-#include <iostream>
-
-#include "VpTree.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// VpTree::ResultsCandidate
-//>   A light-weight representation of a search result candidate item.
-//
-//    @tparam MetricT The metric search space.
-//<
-//*****************************************************************************
-template<typename MetricT>
-class VpTree<MetricT>::ResultsCandidate
-{
-public:
-
-   //***
-   // Use the compiler-generated default constructor.
-   // ResultsCandidate();
-   //***
-
-   ResultsCandidate(const IndexT&, const DistT&);
-      //> Instantiate a light-weight results candidate.
-      //<
-    
-   //***
-   // Use the compiler-generated copy constructor.
-   // ResultsCandidate(const ResultsCandidate&);
-   //***
-
-   ~ResultsCandidate(){}
-      //> The default destructor. Intentionally non-virtual since
-      //  ResultsCandidate is a private inner class on VpTree.
-      //
-      //  @tparam MetricT The metric search space.
-      //<
-
-   //***
-   // Use the compiler-generated assignment operator.
-   // ResultsCandidate& operator=(const ResultsCandidate&);
-   //***
-
-   bool operator<(const ResultsCandidate&) const;
-      //> Compare result candidate distances to determine which is closer
-      //  to the query.
-      //<
-
-private:
-   IndexT theIndex;
-      //> The index of the candidate in the internal database.
-      //<
-    
-   DistT theDistance;
-      //> The candidate's distance to the query point.
-      //<
-
-   friend class VpTree<MetricT>;
-      //> Provide access to results candidate internals to the containing tree
-      //  class.
-      //<
-};
-
-//*****************************************************************************
-// VpTree::ResultsCandidate::ResultsCandidate
-//>   Instantiate a light-weight results candidate.
-//
-//    @tparam MetricT  The metric search space.
-//    @param  index    The candidate database index.
-//    @param  distance The candidate distance to the query.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-VpTree<MetricT>::ResultsCandidate::ResultsCandidate(const IndexT& index,
-                                                    const DistT& distance)
-   : theIndex(index)
-   , theDistance(distance)
-{
-}
-
-//*****************************************************************************
-// VpTree::ResultsCandidate::operator<
-//>   Less-than comparison for vantage point tree results candidates.
-//
-//    @note
-//    In general, the other members of the comparison operator family should be
-//    implemented. They are not in the case of vantage point tree results
-//    candidates because the less-than comparitor is only used in sorting
-//    semantics. The remaining operators would thus be defined, but never used
-//    since items are private to the vantage point tree.
-//
-//    @param other The result candidate for comparison against this item.
-//    @return      true if and only if this candidate is closer to the query
-//                 than the other candidate.
-//<
-//*****************************************************************************
-template<typename MetricT>
-inline
-bool
-VpTree<MetricT>::ResultsCandidate::operator<(const ResultsCandidate& other)
-const
-{
-   return theDistance < other.theDistance;
-}
-
-}
-
-#endif
Index: mkjer/Util/SpatialIndexing/VpTree/VpTree_m.cc
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree_m.cc	(revision 14)
+++ 	(revision )
@@ -1,1 +1,0 @@
-Util\SpatialIndexing\VpTree\VpTree.m
Index: Damkjer/Util/SpatialIndexing/VpTree/deleteVpTree.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/deleteVpTree.cpp	(revision 0)
+++ Damkjer/Util/SpatialIndexing/VpTree/deleteVpTree.cpp	(revision 0)
@@ -0,0 +1,41 @@
+//*************************************************************************
+// FILE:        deleteVpTree.cpp
+//
+//    Copyright (C)  2012 Kristian Damkjer.
+//
+// DESCRIPTION: This MEX source file safely deletes the object pointed to
+//              by the encoded raw pointer.
+//
+// LIMITATIONS: Unfortunately, the raw pointer trick is necessary to
+//              persist objects between MEX function calls. Ideally, we
+//              would simply return the created object. However, that would
+//              violate MATLAB's current internal memory management system.
+//
+// SOFTWARE HISTORY:
+//> 2012-SEP-11  K. Damkjer
+//               Initial Coding.
+//<
+//*************************************************************************
+
+#include "Util/MATLAB/ClassHandle.h"
+#include "VpTree.h"
+
+#ifdef _CHAR16T
+#define CHAR16_T
+#endif
+
+#include "mex.h"
+
+void mexFunction(
+        int nlhs, mxArray * plhs[],
+        int nrhs, const mxArray * prhs[])
+{
+   // check the arguments
+   if (nrhs!=1 || !mxIsNumeric(prhs[0]))
+   {
+       mexErrMsgIdAndTxt("Damkjer:deleteVpTree:varargin",
+                         "varargin{1} must be a valid VpTree pointer");
+   }
+   
+   destroyHandleTo<VpTree<> >(prhs[0]);
+}
Index: Damkjer/Util/SpatialIndexing/VpTree/frannVpTree.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/frannVpTree.cpp	(revision 0)
+++ Damkjer/Util/SpatialIndexing/VpTree/frannVpTree.cpp	(revision 0)
@@ -0,0 +1,173 @@
+//=========================================================================
+// FILE:        frannVpTree.cpp
+//
+//    Copyright (C)  2012 Kristian Damkjer.
+//
+// DESCRIPTION: This MEX source file provides an implementation of the
+//              fixed-radius all nearest neighbors search algorithm given
+//              a set of query points, a radius, and a VpTree representing
+//              the point data base.
+//
+// LIMITATIONS: This function has the potential to consume a large amount
+//              of memory. While I have confirmed that there are no memory
+//              leaks in the code to the best of my current ability, I have
+//              induced predictable crashes in MATLAB by finding all
+//              nearest neighbors for a 4M point data base. The crash did
+//              not come from this code, but rather from Handle Graphics
+//              when attempting to render a waitbar. As a result, it is
+//              recommended that points be streamed or blocked together
+//              into more manageable chunks.
+//
+// SOFTWARE HISTORY:
+//> 2012-SEP-11  K. Damkjer
+//               Initial Coding.
+//<
+//=========================================================================
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+#include "Util/MATLAB/ClassHandle.h"
+#include "VpTree.h"
+
+#ifdef _CHAR16T
+#define CHAR16_T
+#endif
+
+#include "mex.h"
+
+void mexFunction(
+        int nlhs, mxArray* plhs[],
+        int nrhs, const mxArray* prhs[])
+{
+   // check the arguments
+   if (nrhs<2 || nrhs > 3 || !mxIsNumeric(prhs[0]))
+   {
+       mexErrMsgIdAndTxt("Damkjer:deleteVpTree:varargin",
+                         "varargin{1} must be a valid VpTree pointer");
+   }
+
+   if (nlhs>2)
+   {
+       mexErrMsgIdAndTxt("Damkjer:deleteVpTree:varargout",
+                         "Invalid number of output arguments.");
+   }
+
+   // retrieve the tree pointer
+   const VpTree<>& tree = matAsObj<VpTree<> >(prhs[0]);
+   
+   const mxArray* points=prhs[1];
+    
+   // Check to make sure that points are real numerics
+   if (mxIsSparse(points) ||
+       mxGetNumberOfDimensions(points) != 2 ||
+       mxIsComplex(points) ||
+       !mxIsNumeric(points))
+   {
+       mexErrMsgIdAndTxt("Damkjer:makeVpTree:prhs",
+                         "Point input to kannVpTree must be a full, 2-D matrix representing ND queries.");
+   }
+    
+   const mwSize dims = mxGetM(points);
+   const mwSize elems = mxGetN(points);
+    
+   double* data = mxGetPr(points);
+   std::deque<std::vector<double> > pointData(elems, std::vector<double>(dims));
+    
+   for (mwIndex elem = elems; elem --> 0;)
+   {
+      for (mwIndex dim = dims; dim --> 0;)
+      {
+         pointData[elem][dim]=data[elem*dims+dim];
+      }
+   }
+
+   double radius;
+   
+   if (nrhs == 2)
+   {
+       radius = 1;
+   }
+   else
+   {
+       const mxArray* rData=prhs[2];
+
+       if (mxIsSparse(rData) ||
+               mxGetNumberOfElements(rData) != 1 ||
+               mxIsComplex(rData) ||
+               !mxIsNumeric(rData))
+       {
+           mexErrMsgIdAndTxt("Damkjer:makeVpTree:prhs",
+                   "Input to makeVpTree must be a full, 2-D matrix representing ND observations.");
+       }
+       
+       radius = mxGetScalar(rData);
+   }
+
+   plhs[0] = mxCreateCellMatrix(elems, 1);
+
+   if (nlhs==2)
+   {
+       plhs[1] = mxCreateCellMatrix(elems, 1);
+   }
+   
+   #ifdef _OPENMP
+   omp_set_dynamic(1);
+   omp_set_num_threads(omp_get_num_procs());
+   #endif
+   #pragma omp parallel for
+   for (int p = 0; p < pointData.size(); ++p)
+   {
+      std::vector<double> q=pointData[p];
+
+      std::pair<std::deque<mwIndex>,
+                std::deque<double> > results = tree.rnn(q, radius);
+
+      mwSize neighbors = results.first.size();
+
+	  mxArray* neighbor_idxs = 0;
+	  mwIndex* idxs = 0;
+	  mxArray* neighbor_dists = 0;
+	  double* dists = 0;
+
+      #pragma omp critical
+      {
+         neighbor_idxs = mxCreateNumericMatrix(neighbors, 1, mxINDEX_CLASS, mxREAL);
+
+         idxs = (mwIndex*)mxGetData(neighbor_idxs);
+      }
+       
+      for (mwIndex idx = neighbors; idx --> 0;)
+      {
+         idxs[idx]=results.first[idx]+1;
+      }
+
+      #pragma omp critical
+      {
+         mxSetCell(plhs[0], p, neighbor_idxs);
+      }
+       
+      if (nlhs==2)
+      {
+         #pragma omp critical
+         {
+            neighbor_dists = mxCreateDoubleMatrix(neighbors, 1, mxREAL);
+
+            dists = mxGetPr(neighbor_dists);
+         }
+
+         for (mwIndex idx = neighbors; idx --> 0;)
+         {
+            dists[idx]=results.second[idx];
+         }
+           
+         #pragma omp critical
+         {
+            mxSetCell(plhs[1], p, neighbor_dists);
+         }
+      }
+   }
+   
+   return;
+}
Index: Damkjer/Util/SpatialIndexing/VpTree/kannVpTree.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/kannVpTree.cpp	(revision 0)
+++ Damkjer/Util/SpatialIndexing/VpTree/kannVpTree.cpp	(revision 0)
@@ -0,0 +1,184 @@
+//=========================================================================
+// FILE:        kannVpTree.cpp
+//
+//    Copyright (C)  2012 Kristian Damkjer.
+//
+// DESCRIPTION: This MEX source file provides an implementation of the
+//              k all nearest neighbors search algorithm given a set of
+//              query points, a number of neighbors, and a VpTree
+//              representing the point data base.
+//
+// LIMITATIONS: This function has the potential to consume a large amount
+//              of memory. While I have confirmed that there are no memory
+//              leaks in the code to the best of my current ability, I have
+//              induced predictable crashes in MATLAB in the related
+//              MEX function, frannVpTree, by finding all nearest neighbors
+//              for a 4M point data base. The crash did not come from this
+//              code, but rather from Handle Graphics when attempting to
+//              render a waitbar. As a result, it is recommended that
+//              points be streamed or blocked together into more manageable
+//              chunks.
+//
+// SOFTWARE HISTORY:
+//> 2012-SEP-11  K. Damkjer
+//               Initial Coding.
+//<
+//=========================================================================
+
+#include <limits>
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+#include "Util/MATLAB/ClassHandle.h"
+#include "VpTree.h"
+
+#ifdef _CHAR16T
+#define CHAR16_T
+#endif
+
+#include "mex.h"
+
+void mexFunction(
+        int nlhs, mxArray* plhs[],
+        int nrhs, const mxArray* prhs[])
+{
+   // check the arguments
+   if (nrhs != 4 || !mxIsNumeric(prhs[0]))
+   {
+      mexErrMsgIdAndTxt("Damkjer:kannVpTree:varargin",
+                        "Invalid number of arguments");
+   }
+
+   // retrieve the tree pointer
+   const VpTree<>& tree = matAsObj<VpTree<> >(prhs[0]);
+
+   const mxArray* points=prhs[1];
+    
+   // Check to make sure that points are real numerics
+   if (mxIsSparse(points) ||
+       mxGetNumberOfDimensions(points) != 2 ||
+       mxIsComplex(points) ||
+       !mxIsNumeric(points))
+   {
+      mexErrMsgIdAndTxt("Damkjer:kannVpTree:prhs",
+                        "Point input to kannVpTree must be a full, 2-D matrix representing ND queries.");
+   }
+    
+   const mwSize dims = mxGetM(points);
+   const mwSize elems = mxGetN(points);
+    
+   double* data = mxGetPr(points);
+   std::deque<std::vector<double> > pointData(elems, std::vector<double>(dims));
+    
+   for (mwIndex elem = elems; elem --> 0;)
+   {
+      for (mwIndex dim = dims; dim --> 0;)
+      {
+         pointData[elem][dim]=data[elem*dims+dim];
+      }
+   }
+
+   mwSize k = 1;
+   
+   const mxArray* kData=prhs[2];
+
+   if (mxIsSparse(kData) ||
+       mxGetNumberOfElements(kData) != 1 ||
+       mxIsComplex(kData) ||
+       !mxIsNumeric(kData))
+   {
+       mexErrMsgIdAndTxt("Damkjer:kannVpTree:prhs",
+                "First arguement to kannVpTree must be a real valued scalar.");
+   }
+       
+   k = (mwSize)(*((double*)mxGetData(kData)));
+
+   double radius = std::numeric_limits<double>::max();
+   
+   const mxArray* rData=prhs[3];
+
+   if (mxIsSparse(rData) ||
+       mxGetNumberOfElements(rData) != 1 ||
+       mxIsComplex(rData) ||
+       !mxIsNumeric(rData))
+   {
+       mexErrMsgIdAndTxt("Damkjer:kannVpTree:prhs",
+                "Second arguement to kannVpTree must be a real valued scalar.");
+   }
+
+   radius = (*(double*)mxGetData(rData));
+
+   plhs[0] = mxCreateCellMatrix(elems, 1);
+
+   if (nlhs==2)
+   {
+      plhs[1] = mxCreateCellMatrix(elems, 1);
+   }
+   
+#ifdef _OPENMP
+   omp_set_dynamic(1);
+   omp_set_num_threads(omp_get_num_procs());
+#endif
+
+   #pragma omp parallel for
+   for (int p = 0; p < pointData.size(); ++p)
+   {
+      std::vector<double> q=pointData[p];
+
+      std::pair<std::deque<mwIndex>, std::deque<double> > results;
+
+      results = tree.knn(q, k, radius);
+
+      mwSize neighbors = results.first.size();
+
+	  mxArray* neighbor_idxs = 0;
+	  mwIndex* idxs = 0;
+	  mxArray* neighbor_dists = 0;
+	  double* dists = 0;
+
+      #pragma omp critical //(VPSB_KNN_CREATE_IDXS)
+      {
+         neighbor_idxs = mxCreateNumericMatrix(0, 0, mxINDEX_CLASS, mxREAL);
+         mxSetM(neighbor_idxs, neighbors);
+         mxSetN(neighbor_idxs, 1);
+         mxSetData(neighbor_idxs, mxMalloc(sizeof(mwIndex)*neighbors*1));
+
+         idxs = (mwIndex*)mxGetData(neighbor_idxs);
+	  }
+
+      for (mwIndex idx = neighbors; idx --> 0;)
+      {
+         idxs[idx]=results.first[idx]+1;
+      }
+
+      #pragma omp critical //(VPSB_KNN_SET_CELL_IDX)
+	  {
+         mxSetCell(plhs[0], p, neighbor_idxs);
+      }
+
+      if (nlhs==2)
+      {
+         #pragma omp critical //(VPSB_KNN_CREATE_DISTS)
+         {
+            neighbor_dists = mxCreateDoubleMatrix(0, 0, mxREAL);
+            mxSetM(neighbor_dists, neighbors);
+            mxSetN(neighbor_dists, 1);
+            mxSetData(neighbor_dists, mxMalloc(sizeof(double)*neighbors*1));
+
+            dists = mxGetPr(neighbor_dists);
+		 }
+
+         for (mwIndex idx = neighbors; idx --> 0;)
+         {
+            dists[idx]=results.second[idx];
+         }
+
+         #pragma omp critical //(VPSB_KNN_SET_CELL_DISTS)
+		 {
+            mxSetCell(plhs[1], p, neighbor_dists);
+         }
+      }
+   }
+}
Index: Damkjer/Util/SpatialIndexing/VpTree/makeVpTree.m
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/makeVpTree.m	(revision 0)
+++ Damkjer/Util/SpatialIndexing/VpTree/makeVpTree.m	(revision 0)
@@ -0,0 +1,80 @@
+%%
+% MAKEVPTREE(...)
+%
+% Build VpTree spatial indexing library MEX functions and classes.
+%
+% OPTIONS:
+%
+%   Variable options may be provided as shortcuts as long as they resolve
+%   to a unique option.
+%
+%   Make options are as follows:
+%
+%   'debug'   : Compile with debug flags and fully populated symbol table.
+%
+%   'parallel': Enable OpenMP pragmas for multi-threaded computing.
+%
+%   'verbose' : Provide verbose output while compiling.
+%
+%   'warnings': Provide compiler warning output for production-ready code.
+%               Implies 'verbose'.
+%
+function makeVpTree(varargin)
+
+command = 'mex -largeArrayDims -DTEMPLATE_INCLUSION';
+
+flags = {'verbose', 'debug', 'warnings', 'parallel'};
+options=[];
+
+while ~isempty(varargin)
+    flag = varargin{1};
+    % If the property has been supplied in a shortened form, lengthen it
+    iFlag = find(strncmpi(flag, flags, length(flag)));
+    
+    if isempty(iFlag)
+       options=[options ' ' flag];
+       error('Damkjer:makeVpsTree:InvalidFlag', ['Invalid Flag: ' flag]);
+    elseif length(iFlag) > 1
+        error('Damkjer:makeVpsTree:AmbiguousFlag', ...
+              ['Supplied shortened flag is ambiguous: ' flag]);
+    else
+        flag = flags{iFlag};
+
+        switch flag
+            case 'verbose'
+                command = [command ' -v'];
+            case 'debug'
+                command = [command ' -g'];
+            case 'parallel'
+                if (ispc)
+                    command = [command ' COMPFLAGS="$COMPFLAGS /openmp"'];
+                else
+                    command = [command ' CFLAGS="\$CFLAGS -fopenmp"' ...
+                                       ' CXXFLAGS="\$CXXFLAGS -fopenmp"' ...
+                                       ' LDFLAGS="\$LDFLAGS -fopenmp"'];
+                end
+            case 'warnings'
+                if (ispc)
+                    command = [command ' -v COMPFLAGS="$COMPFLAGS -W3"'];
+                else
+                    command = [command ' -v' ...
+                                       ' CFLAGS="\$CFLAGS -Wall -Wextra"' ...
+                                       ' CXXFLAGS="\$CXXFLAGS -Wall -Wextra"'];
+                end
+            otherwise
+                error('Damkjer:makeVpsTree:NotImplementedFlag', ...
+                    ['Flag recognized, but not supported (oops): ' flag]);
+        end % switch property
+    end
+
+    varargin(1) = [];
+end % while
+
+[path,~,~]=fileparts(mfilename('fullpath'));
+command = [command options ' -I' path '/../../.. -outdir ' path ' ' path '/'];
+eval([command 'newVpTree.cpp']);
+eval([command 'deleteVpTree.cpp']);
+eval([command 'frannVpTree.cpp']);
+eval([command 'kannVpTree.cpp']);
+
+end
Index: Damkjer/Util/SpatialIndexing/VpTree/newVpTree.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/newVpTree.cpp	(revision 0)
+++ Damkjer/Util/SpatialIndexing/VpTree/newVpTree.cpp	(revision 0)
@@ -0,0 +1,76 @@
+//*************************************************************************
+// FILE:        newVpTree.cpp
+//
+//    Copyright (C)  2012 Kristian Damkjer.
+//
+// DESCRIPTION: This MEX source file creates a new VpTree object and
+//              returns a handle to MATLAB encoded as a raw pointer value.
+//
+// LIMITATIONS: Unfortunately, the raw pointer trick is necessary to
+//              persist objects between MEX function calls. Ideally, we
+//              would simply return the created object. However, that would
+//              violate MATLAB's current internal memory management system.
+//
+// SOFTWARE HISTORY:
+//> 2012-SEP-11  K. Damkjer
+//               Initial Coding.
+//<
+//*************************************************************************
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+#include "Util/MATLAB/ClassHandle.h"
+#include "VpTree.h"
+
+#ifdef _CHAR16T
+#define CHAR16_T
+#endif
+
+#include "mex.h"
+
+void mexFunction(
+        int nlhs, mxArray* plhs[],
+        int nrhs, const mxArray* prhs[])
+{
+    if (nrhs < 1 || nrhs > 1)
+    {
+        mexErrMsgIdAndTxt("Damkjer:makeVpTree:nargin",
+                          "makeVpTree requires a single input.");
+    }
+
+    if (nlhs > 1)
+    {
+        mexErrMsgIdAndTxt("Damkjer:makeVpTree:nargout",
+                          "makeVpTree requires a single output.");
+    }
+    
+    const mxArray* points=prhs[0];
+    
+    // Check to make sure that points are real numerics
+    if (mxIsSparse(points) ||
+        mxGetNumberOfDimensions(points) != 2 ||
+        mxIsComplex(points) ||
+        !mxIsNumeric(points))
+    {
+        mexErrMsgIdAndTxt("Damkjer:makeVpTree:prhs",
+                          "Input to makeVpTree must be a full, 2-D matrix representing ND observations.");
+    }
+    
+    const mwSize dims = mxGetM(points);
+    const mwSize elems = mxGetN(points);
+
+    double* data = mxGetPr(points);
+    std::deque<std::vector<double> > pointData(elems, std::vector<double>(dims));
+    
+    for (mwSize elem = elems; elem --> 0;)
+    {
+        for (mwSize dim = dims; dim --> 0;)
+        {
+            pointData[elem][dim]=data[elem*dims+dim];
+        }
+    }
+
+    plhs[0] = ptrAsMat(new VpTree<>(pointData));
+}
Index: mkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.cpp	(revision 12)
+++ 	(revision )
@@ -1,1276 +1,0 @@
-//*****************************************************************************
-// FILE:        TestVpTree.cpp
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: TestVpTree
-//
-//    See TestVpTree header for detailed description.
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-24  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include <iomanip>
-#include <sstream>
-#include <limits>
-#include <cmath>
-#include <vector>
-#include <typeinfo>
-
-#include "TestVpTree.h"
-#include "Util/Exception/Exception.h"
-#include "Util/SpatialIndexing/Metrics/Metrics.h"
-#include "Util/SpatialIndexing/VpTree/VpTree.h"
-#include "Util/Streams/BlockIndent.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// FUNCTOR: testEuclideanKnn
-//*****************************************************************************
-template <typename PointT>
-class testEuclideanKnn : public TestCase::TestStep
-{
-public:
-   testEuclideanKnn()
-      : TestCase::TestStep((std::string(
-                            "k nearest-neighbor algorithm in Euclidean space "
-                            "for points of type: ") + 
-                           typeid(PointT).name()))
-   {
-   }
-      //>
-      //<
-
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::testEuclideanKnn::operator(TestCase&)");
-
-      typedef typename PointT::value_type   ValueT;
-      typedef EuclideanDistance<PointT>     MetricT;
-      typedef typename MetricT::return_type DistT;
-
-      //***
-      // Set up a 2D point layout on a regular grid as follows:
-      //
-      //- (0,0) (0,1) (0,2) ... (0,9)
-      //- (1,0) (1,1) (1,2) ... (1,9)
-      //-   .     .     .   .     .
-      //-   .     .     .    .    .
-      //-   .     .     .     .   .
-      //- (9,0) (9,1) (9,2) ... (9,9)
-      //
-      // Make sure points are created in top-left to bottom-right row-major
-      // order to force known indices:
-      //
-      //-  0  1  2 ...  9
-      //- 10 11 12 ... 19
-      //-  .  .  . .    .
-      //-  .  .  .  .   .
-      //-  .  .  .   .  .
-      //- 90 91 92 ... 99
-      //
-      //***
-
-      std::deque<PointT> data;
-      
-      for (unsigned int row = 0; row < 10; ++row)
-      {
-         for (unsigned int col = 0; col < 10; ++col)
-         {
-            PointT pt;
-            pt.push_back(static_cast<ValueT>(row));
-            pt.push_back(static_cast<ValueT>(col));
-            data.push_back(pt);
-         }
-      }
-
-      // Create the spatially indexed database
-      typedef VpTree<MetricT> VpTreeT;
-
-      VpTreeT database(data);
-      typedef typename VpTreeT::IndexT         IndexT;
-      typedef typename VpTreeT::SearchResultsT SearchResultsT;
-
-      // Perform a search for the 20 nearest neighbors to point 45.
-      SearchResultsT results = database.knn(data[45], 20);
-
-      //***
-      // In Euclidean space, the results should belong to the following set:
-      //
-      //-    24 25 26
-      //- 33 34 35 36 37
-      //- 43 44 45 46 47
-      //- 53 54 55 56 57
-      //-    64 65 66
-      //
-      // With distances:
-      //
-      //-         2.23607 2.00000 2.23607
-      //- 2.23607 1.41421 1.00000 1.41421 2.23607
-      //- 2.00000 1.00000 0.00000 1.00000 2.00000
-      //- 2.23607 1.41421 1.00000 1.41421 2.23607
-      //-         2.23607 2.00000 2.23607
-      //
-      // However, the set consists of 21 members, so one item will be missing.
-      // Only the furthest points are candidates to be missing:
-      //
-      //- 24, 26, 33, 37, 53, 57, 64, 66
-      //
-      //***
-
-      // Display the results
-      test.report() << "Find 20 nearest neighbors to point 45: (4,5)...\n";
-      std::deque<IndexT> idxs = results.first;
-      std::deque<DistT>          dists = results.second;
-
-      test.report() << "idxs = {";
-
-      if (!idxs.empty())
-      {
-         test.report() << idxs[0];
-         for (std::size_t idx = 1; idx < idxs.size(); ++idx)
-         {
-            test.report() << ", " << idxs[idx];
-         }
-      }
-
-      test.report() << "}\n";
-
-      test.report() << "dists = {";
-
-      if (!idxs.empty())
-      {
-         test.report() << dists[0];
-         for (std::size_t idx = 1; idx < idxs.size(); ++idx)
-         {
-            test.report() << ", " << dists[idx];
-         }
-      }
-
-      test.report() << "}\n";
-
-      // Check the results
-      bool passedAll = true;
-      bool check;
-
-      test.report() << "Check that index and distance set sizes match... ";
-      check = (idxs.size() == dists.size());
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      test.report() << "Check that we found 20 neighbors... ";
-      check = (idxs.size() == 20);
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      // Check nearest elements
-      {
-         IndexT f[] = {        25,
-                           34, 35, 36,
-                       43, 44, 45, 46, 47,
-                           54, 55, 56,   
-                               65};
-         std::vector<IndexT> furthest(f,
-                                        f + sizeof(f)/sizeof(IndexT));
-
-         unsigned char present = 0;
-         typename std::deque<IndexT>::iterator pos;
-
-         for (std::size_t nbr = furthest.size(); nbr --> 0;)
-         {
-            pos = find(idxs.begin(), idxs.end(), furthest[nbr]);
-
-            if (pos != idxs.end()) ++present;
-         }
-
-         // Check that 13 out of 13 near neighbors are found
-         test.report() << "Check that all 13 of 13 nearest neighbors are "
-                       << "found... ";
-         check = (present == 13);
-         passedAll &= check;
-         test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-      }
-
-      // Check furthest elements
-      {
-         IndexT f[] = {    24,     26,
-                       33,             37,
-                      
-                       53,             57,
-                           64,     66};
-
-         std::vector<IndexT> furthest(f,
-                                        f + sizeof(f)/sizeof(IndexT));
-
-         unsigned char present = 0;
-         typename std::deque<IndexT>::iterator pos;
-
-         for (std::size_t nbr = furthest.size(); nbr --> 0;)
-         {
-            pos = find(idxs.begin(), idxs.end(), furthest[nbr]);
-
-            if (pos != idxs.end()) ++present;
-         }
-
-         // Check that 7 out of 8 furthest neighbors are found
-         test.report() << "Check that only 7 of 8 furthest neighbors are "
-                       << "found... ";
-         check = (present == 7);
-         passedAll &= check;
-         test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-      }
-
-      return passedAll;
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: testEuclideanRnn
-//*****************************************************************************
-template <typename PointT>
-class testEuclideanRnn : public TestCase::TestStep
-{
-public:
-   testEuclideanRnn()
-      : TestCase::TestStep((std::string(
-                            "radially nearest-neighbor algorithm in Euclidean "
-                            "space for points of type: ") + 
-                           typeid(PointT).name()))
-   {
-   }
-      //>
-      //<
-
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::testEuclideanRnn::operator(TestCase&)");
-
-      typedef typename PointT::value_type ValueT;
-      typedef EuclideanDistance<PointT>   MetricT;
-      typedef typename MetricT::return_type        DistT;
-
-      //***
-      // Set up a 2D point layout on a regular grid as follows:
-      //
-      //- (0,0) (0,1) (0,2) ... (0,9)
-      //- (1,0) (1,1) (1,2) ... (1,9)
-      //-   .     .     .   .     .
-      //-   .     .     .    .    .
-      //-   .     .     .     .   .
-      //- (9,0) (9,1) (9,2) ... (9,9)
-      //
-      // Make sure points are created in top-left to bottom-right row-major
-      // order to force known indices:
-      //
-      //-  0  1  2 ...  9
-      //- 10 11 12 ... 19
-      //-  .  .  . .    .
-      //-  .  .  .  .   .
-      //-  .  .  .   .  .
-      //- 90 91 92 ... 99
-      //
-      //***
-
-      std::deque<PointT> data;
-      
-      for (unsigned int row = 0; row < 10; ++row)
-      {
-         for (unsigned int col = 0; col < 10; ++col)
-         {
-            PointT pt;
-            pt.push_back(static_cast<ValueT>(row));
-            pt.push_back(static_cast<ValueT>(col));
-            data.push_back(pt);
-         }
-      }
-
-      // Create the spatially indexed database
-      typedef VpTree<MetricT> VpTreeT;
-
-      VpTreeT database(data);
-      typedef typename VpTreeT::IndexT         IndexT;
-      typedef typename VpTreeT::SearchResultsT SearchResultsT;
-
-      // Perform a search for the nearest neighbors to point 45 within 3 units.
-      ValueT radius = 3;
-      SearchResultsT results = database.rnn(data[45], radius);
-
-      //***
-      // In Euclidean space, the results should belong to the following set:
-      //
-      //-          15
-      //-    23 24 25 26 27
-      //-    33 34 35 36 37
-      //- 42 43 44 45 46 47 48
-      //-    53 54 55 56 57
-      //-    63 64 65 66 67
-      //-          75
-      //
-      // With distances:
-      //
-      //-                         3.00000
-      //-         2.82843 2.23607 2.00000 2.23607 2.82843
-      //-         2.23607 1.41421 1.00000 1.41421 2.23607
-      //- 3.00000 2.00000 1.00000 0.00000 1.00000 2.00000 3.00000
-      //-         2.23607 1.41421 1.00000 1.41421 2.23607
-      //-         2.82843 2.23607 2.00000 2.23607 2.82843
-      //-                         3.00000
-      //
-      //***
-
-      // Display the results
-      test.report() << "Find nearest neighbors to point 45 (4,5) within 3 "
-                    << "units...\n";
-      std::deque<IndexT> idxs = results.first;
-      std::deque<DistT>          dists = results.second;
-
-      test.report() << "idxs = {";
-
-      if (!idxs.empty())
-      {
-         test.report() << idxs[0];
-         for (std::size_t idx = 1; idx < idxs.size(); ++idx)
-         {
-            test.report() << ", " << idxs[idx];
-         }
-      }
-
-      test.report() << "}\n";
-
-      test.report() << "dists = {";
-
-      if (!idxs.empty())
-      {
-         test.report() << dists[0];
-         for (std::size_t idx = 1; idx < idxs.size(); ++idx)
-         {
-            test.report() << ", " << dists[idx];
-         }
-      }
-
-      test.report() << "}\n";
-
-      // Check the results
-      bool passedAll = true;
-      bool check;
-
-      test.report() << "Check that index and distance set sizes match... ";
-      check = (idxs.size() == dists.size());
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      test.report() << "Check that we found 29 neighbors... ";
-      check = (idxs.size() == 29);
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      // Check nearest elements
-      {
-         IndexT f[] = {            15,
-                           23, 24, 25, 26, 27,
-                           33, 34, 35, 36, 37,
-                       42, 43, 44, 45, 46, 47, 48,
-                           53, 54, 55, 56, 57,
-                           63, 64, 65, 66, 67,
-                                   75};
-         std::vector<IndexT> furthest(f,
-                                        f + sizeof(f)/sizeof(IndexT));
-
-         unsigned char present = 0;
-         typename std::deque<IndexT>::iterator pos;
-
-         for (std::size_t nbr = furthest.size(); nbr --> 0;)
-         {
-            pos = find(idxs.begin(), idxs.end(), furthest[nbr]);
-
-            if (pos != idxs.end()) ++present;
-         }
-
-         // Check that 13 out of 13 near neighbors are found
-         test.report() << "Check that all 29 nearest neighbors are "
-                       << "found... ";
-         check = (present == 29);
-         passedAll &= check;
-         test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-      }
-
-      // Check distances
-      {
-         check = true;
-         // Check that no distance exceeds the search reach
-         test.report() << "Check that no distance exceeds the search "
-                       << "reach... ";
-
-         for (std::size_t dist = dists.size(); dist --> 0;)
-         {
-            check &= (dists[dist] <= radius);
-         }
-
-         passedAll &= check;
-         test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-      }
-
-      return passedAll;
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: testManhattanKnn
-//*****************************************************************************
-template <typename PointT>
-class testManhattanKnn : public TestCase::TestStep
-{
-public:
-   testManhattanKnn()
-      : TestCase::TestStep((std::string(
-                            "k nearest-neighbor algorithm in Manhattan space "
-                            "for points of type: ") + 
-                           typeid(PointT).name()))
-   {
-   }
-      //>
-      //<
-
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::testManhattanKnn::operator(TestCase&)");
-
-      typedef typename PointT::value_type ValueT;
-      typedef ManhattanDistance<PointT>   MetricT;
-      typedef typename MetricT::return_type        DistT;
-
-      //***
-      // Set up a 2D point layout on a regular grid as follows:
-      //
-      //- (0,0) (0,1) (0,2) ... (0,9)
-      //- (1,0) (1,1) (1,2) ... (1,9)
-      //-   .     .     .   .     .
-      //-   .     .     .    .    .
-      //-   .     .     .     .   .
-      //- (9,0) (9,1) (9,2) ... (9,9)
-      //
-      // Make sure points are created in top-left to bottom-right row-major
-      // order to force known indices:
-      //
-      //-  0  1  2 ...  9
-      //- 10 11 12 ... 19
-      //-  .  .  . .    .
-      //-  .  .  .  .   .
-      //-  .  .  .   .  .
-      //- 90 91 92 ... 99
-      //
-      //***
-
-      std::deque<PointT> data;
-      
-      for (unsigned int row = 0; row < 10; ++row)
-      {
-         for (unsigned int col = 0; col < 10; ++col)
-         {
-            PointT pt;
-            pt.push_back(static_cast<ValueT>(row));
-            pt.push_back(static_cast<ValueT>(col));
-            data.push_back(pt);
-         }
-      }
-
-      // Create the spatially indexed database
-      typedef VpTree<MetricT> VpTreeT;
-
-      VpTreeT database(data);
-      typedef typename VpTreeT::IndexT         IndexT;
-      typedef typename VpTreeT::SearchResultsT SearchResultsT;
-
-      // Perform a search for the 20 nearest neighbors to point 45.
-      SearchResultsT results = database.knn(data[45], 20);
-
-      //***
-      // In Manhattan space, the results should belong to the following set:
-      //
-      //-          15   
-      //-       24 25 26  
-      //-    33 34 35 36 37 
-      //- 42 43 44 45 46 47 48
-      //-    53 54 55 56 57 
-      //-       64 65 66  
-      //-          75   
-      //
-      // With distances:
-      //
-      //-           3
-      //-        3  2  3
-      //-     3  2  1  2  3
-      //-  3  2  1  0  1  2  3
-      //-     3  2  1  2  3
-      //-        3  2  3
-      //-           3
-      //
-      // However, the set consists of 25 members, so five items will be
-      // missing. Only the furthest points are candidates to be missing:
-      //
-      //- 15, 24, 26, 33, 37, 42, 48, 53, 57, 64, 66, 75
-      //
-      //***
-
-      // Display the results
-      test.report() << "Find 20 nearest neighbors to point 45: (4,5)...\n";
-      std::deque<IndexT> idxs = results.first;
-      std::deque<DistT>          dists = results.second;
-
-      test.report() << "idxs = {";
-
-      if (!idxs.empty())
-      {
-         test.report() << idxs[0];
-         for (std::size_t idx = 1; idx < idxs.size(); ++idx)
-         {
-            test.report() << ", " << idxs[idx];
-         }
-      }
-
-      test.report() << "}\n";
-
-      test.report() << "dists = {";
-
-      if (!idxs.empty())
-      {
-         test.report() << dists[0];
-         for (std::size_t idx = 1; idx < idxs.size(); ++idx)
-         {
-            test.report() << ", " << dists[idx];
-         }
-      }
-
-      test.report() << "}\n";
-
-      // Check the results
-      bool passedAll = true;
-      bool check;
-
-      test.report() << "Check that index and distance set sizes match... ";
-      check = (idxs.size() == dists.size());
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      test.report() << "Check that we found 20 neighbors... ";
-      check = (idxs.size() == 20);
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      // Check nearest elements
-      {
-         IndexT f[] = {        25,
-                           34, 35, 36,
-                       43, 44, 45, 46, 47,
-                           54, 55, 56,   
-                               65};
-         std::vector<IndexT> furthest(f,
-                                        f + sizeof(f)/sizeof(IndexT));
-
-         unsigned char present = 0;
-         typename std::deque<IndexT>::iterator pos;
-
-         for (std::size_t nbr = furthest.size(); nbr --> 0;)
-         {
-            pos = find(idxs.begin(), idxs.end(), furthest[nbr]);
-
-            if (pos != idxs.end()) ++present;
-         }
-
-         // Check that 13 out of 13 near neighbors are found
-         test.report() << "Check that all 13 of 13 nearest neighbors are "
-                       << "found... ";
-         check = (present == 13);
-         passedAll &= check;
-         test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-      }
-
-      // Check furthest elements
-      {
-         IndexT f[] = {            15,
-                               24,     26,
-                           33,             37,
-                       42,                     48,
-                           53,             57,
-                               64,     66,
-                                   75};
-
-         std::vector<IndexT> furthest(f,
-                                        f + sizeof(f)/sizeof(IndexT));
-
-         unsigned char present = 0;
-         typename std::deque<IndexT>::iterator pos;
-
-         for (std::size_t nbr = furthest.size(); nbr --> 0;)
-         {
-            pos = find(idxs.begin(), idxs.end(), furthest[nbr]);
-
-            if (pos != idxs.end()) ++present;
-         }
-
-         // Check that 7 out of 8 furthest neighbors are found
-         test.report() << "Check that only 7 of 8 furthest neighbors are "
-                       << "found... ";
-         check = (present == 7);
-         passedAll &= check;
-         test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-      }
-
-      return passedAll;
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: testManhattanRnn
-//*****************************************************************************
-template <typename PointT>
-class testManhattanRnn : public TestCase::TestStep
-{
-public:
-   testManhattanRnn()
-      : TestCase::TestStep((std::string(
-                            "radially nearest-neighbor algorithm in Manhattan "
-                            "space for points of type: ") + 
-                           typeid(PointT).name()))
-   {
-   }
-      //>
-      //<
-
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::testManhattanRnn::operator(TestCase&)");
-
-      typedef typename PointT::value_type ValueT;
-      typedef ManhattanDistance<PointT>   MetricT;
-      typedef typename MetricT::return_type        DistT;
-
-      //***
-      // Set up a 2D point layout on a regular grid as follows:
-      //
-      //- (0,0) (0,1) (0,2) ... (0,9)
-      //- (1,0) (1,1) (1,2) ... (1,9)
-      //-   .     .     .   .     .
-      //-   .     .     .    .    .
-      //-   .     .     .     .   .
-      //- (9,0) (9,1) (9,2) ... (9,9)
-      //
-      // Make sure points are created in top-left to bottom-right row-major
-      // order to force known indices:
-      //
-      //-  0  1  2 ...  9
-      //- 10 11 12 ... 19
-      //-  .  .  . .    .
-      //-  .  .  .  .   .
-      //-  .  .  .   .  .
-      //- 90 91 92 ... 99
-      //
-      //***
-
-      std::deque<PointT> data;
-      
-      for (unsigned int row = 0; row < 10; ++row)
-      {
-         for (unsigned int col = 0; col < 10; ++col)
-         {
-            PointT pt;
-            pt.push_back(static_cast<ValueT>(row));
-            pt.push_back(static_cast<ValueT>(col));
-            data.push_back(pt);
-         }
-      }
-
-      // Create the spatially indexed database
-      typedef VpTree<MetricT> VpTreeT;
-
-      VpTreeT database(data);
-      typedef typename VpTreeT::IndexT         IndexT;
-      typedef typename VpTreeT::SearchResultsT SearchResultsT;
-
-      // Perform a search for the nearest neighbors to point 45 within 3 units.
-      ValueT radius = 3;
-      SearchResultsT results = database.rnn(data[45], radius);
-
-      //***
-      // In Manhattan space, the results should belong to the following set:
-      //
-      //-          15
-      //-       24 25 26
-      //-    33 34 35 36 37
-      //- 42 43 44 45 46 47 48
-      //-    53 54 55 56 57
-      //-       64 65 66
-      //-          75
-      //
-      // With distances:
-      //
-      //-           3
-      //-        3  2  3
-      //-     3  2  1  2  3
-      //-  3  2  1  0  1  2  3
-      //-     3  2  1  2  3
-      //-        3  2  3
-      //-           3
-      //
-      //***
-
-      // Display the results
-      test.report() << "Find nearest neighbors to point 45 (4,5) within 3 "
-                    << "units...\n";
-      std::deque<IndexT> idxs = results.first;
-      std::deque<DistT>          dists = results.second;
-
-      test.report() << "idxs = {";
-
-      if (!idxs.empty())
-      {
-         test.report() << idxs[0];
-         for (std::size_t idx = 1; idx < idxs.size(); ++idx)
-         {
-            test.report() << ", " << idxs[idx];
-         }
-      }
-
-      test.report() << "}\n";
-
-      test.report() << "dists = {";
-
-      if (!idxs.empty())
-      {
-         test.report() << dists[0];
-         for (std::size_t idx = 1; idx < idxs.size(); ++idx)
-         {
-            test.report() << ", " << dists[idx];
-         }
-      }
-
-      test.report() << "}\n";
-
-      // Check the results
-      bool passedAll = true;
-      bool check;
-
-      test.report() << "Check that index and distance set sizes match... ";
-      check = (idxs.size() == dists.size());
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      test.report() << "Check that we found 25 neighbors... ";
-      check = (idxs.size() == 25);
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      // Check nearest elements
-      {
-         IndexT f[] = {            15,
-                               24, 25, 26,
-                           33, 34, 35, 36, 37,
-                       42, 43, 44, 45, 46, 47, 48,
-                           53, 54, 55, 56, 57,
-                               64, 65, 66,
-                                   75};
-         std::vector<IndexT> furthest(f,
-                                        f + sizeof(f)/sizeof(IndexT));
-
-         unsigned char present = 0;
-         typename std::deque<IndexT>::iterator pos;
-
-         for (std::size_t nbr = furthest.size(); nbr --> 0;)
-         {
-            pos = find(idxs.begin(), idxs.end(), furthest[nbr]);
-
-            if (pos != idxs.end()) ++present;
-         }
-
-         // Check that 13 out of 13 near neighbors are found
-         test.report() << "Check that all 25 nearest neighbors are "
-                       << "found... ";
-         check = (present == 25);
-         passedAll &= check;
-         test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-      }
-
-      // Check distances
-      {
-         check = true;
-         // Check that no distance exceeds the search reach
-         test.report() << "Check that no distance exceeds the search "
-                       << "reach... ";
-
-         for (std::size_t dist = dists.size(); dist --> 0;)
-         {
-            check &= (dists[dist] <= radius);
-         }
-
-         passedAll &= check;
-         test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-      }
-
-      return passedAll;
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: testChebyshevKnn
-//*****************************************************************************
-template <typename PointT>
-class testChebyshevKnn : public TestCase::TestStep
-{
-public:
-   testChebyshevKnn()
-      : TestCase::TestStep((std::string(
-                            "k nearest-neighbor algorithm in Chebyshev space "
-                            "for points of type: ") + 
-                           typeid(PointT).name()))
-   {
-   }
-      //>
-      //<
-
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::testManhattanKnn::operator(TestCase&)");
-
-      typedef typename PointT::value_type ValueT;
-      typedef ChebyshevDistance<PointT>   MetricT;
-      typedef typename MetricT::return_type        DistT;
-
-      //***
-      // Set up a 2D point layout on a regular grid as follows:
-      //
-      //- (0,0) (0,1) (0,2) ... (0,9)
-      //- (1,0) (1,1) (1,2) ... (1,9)
-      //-   .     .     .   .     .
-      //-   .     .     .    .    .
-      //-   .     .     .     .   .
-      //- (9,0) (9,1) (9,2) ... (9,9)
-      //
-      // Make sure points are created in top-left to bottom-right row-major
-      // order to force known indices:
-      //
-      //-  0  1  2 ...  9
-      //- 10 11 12 ... 19
-      //-  .  .  . .    .
-      //-  .  .  .  .   .
-      //-  .  .  .   .  .
-      //- 90 91 92 ... 99
-      //
-      //***
-
-      std::deque<PointT> data;
-      
-      for (unsigned int row = 0; row < 10; ++row)
-      {
-         for (unsigned int col = 0; col < 10; ++col)
-         {
-            PointT pt;
-            pt.push_back(static_cast<ValueT>(row));
-            pt.push_back(static_cast<ValueT>(col));
-            data.push_back(pt);
-         }
-      }
-
-      // Create the spatially indexed database
-      typedef VpTree<MetricT> VpTreeT;
-
-      VpTreeT database(data);
-      typedef typename VpTreeT::IndexT         IndexT;
-      typedef typename VpTreeT::SearchResultsT SearchResultsT;
-
-      // Perform a search for the 20 nearest neighbors to point 45.
-      SearchResultsT results = database.knn(data[45], 20);
-
-      //***
-      // In Chebyshev space, the results should belong to the following set:
-      //
-      //- 23 24 25 26 27
-      //- 33 34 35 36 37
-      //- 43 44 45 46 47
-      //- 53 54 55 56 57 
-      //- 63 64 65 66 67
-      //
-      // With distances:
-      //
-      //-  2  2  2  2  2
-      //-  2  1  1  1  2
-      //-  2  1  0  1  2
-      //-  2  1  1  1  2
-      //-  2  2  2  2  2
-      //
-      // However, the set consists of 25 members, so five items will be
-      // missing. Only the furthest points are candidates to be missing:
-      //
-      //- 23, 24, 25, 26, 27, 33, 37, 43, 47, 53, 57, 63, 64, 65, 66, 67
-      //
-      //***
-
-      // Display the results
-      test.report() << "Find 20 nearest neighbors to point 45: (4,5)...\n";
-      std::deque<IndexT> idxs = results.first;
-      std::deque<DistT>          dists = results.second;
-
-      test.report() << "idxs = {";
-
-      if (!idxs.empty())
-      {
-         test.report() << idxs[0];
-         for (std::size_t idx = 1; idx < idxs.size(); ++idx)
-         {
-            test.report() << ", " << idxs[idx];
-         }
-      }
-
-      test.report() << "}\n";
-
-      test.report() << "dists = {";
-
-      if (!idxs.empty())
-      {
-         test.report() << dists[0];
-         for (std::size_t idx = 1; idx < idxs.size(); ++idx)
-         {
-            test.report() << ", " << dists[idx];
-         }
-      }
-
-      test.report() << "}\n";
-
-      // Check the results
-      bool passedAll = true;
-      bool check;
-
-      test.report() << "Check that index and distance set sizes match... ";
-      check = (idxs.size() == dists.size());
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      test.report() << "Check that we found 20 neighbors... ";
-      check = (idxs.size() == 20);
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      // Check nearest elements
-      {
-         IndexT f[] = {34, 35, 36,
-                       44, 45, 46,
-                       54, 55, 56};
-         std::vector<IndexT> furthest(f,
-                                        f + sizeof(f)/sizeof(IndexT));
-
-         unsigned char present = 0;
-         typename std::deque<IndexT>::iterator pos;
-
-         for (std::size_t nbr = furthest.size(); nbr --> 0;)
-         {
-            pos = find(idxs.begin(), idxs.end(), furthest[nbr]);
-
-            if (pos != idxs.end()) ++present;
-         }
-
-         // Check that 9 out of 9 near neighbors are found
-         test.report() << "Check that all 9 of 9 nearest neighbors are "
-                       << "found... ";
-         check = (present == 9);
-         passedAll &= check;
-         test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-      }
-
-      // Check furthest elements
-      {
-         IndexT f[] = {23, 24, 25, 26, 27,
-                       33,             37,
-                       43,             47,
-                       53,             57,
-                       63, 64, 65, 66, 67};
-
-         std::vector<IndexT> furthest(f,
-                                        f + sizeof(f)/sizeof(IndexT));
-
-         unsigned char present = 0;
-         typename std::deque<IndexT>::iterator pos;
-
-         for (std::size_t nbr = furthest.size(); nbr --> 0;)
-         {
-            pos = find(idxs.begin(), idxs.end(), furthest[nbr]);
-
-            if (pos != idxs.end()) ++present;
-         }
-
-         // Check that 11 out of 16 furthest neighbors are found
-         test.report() << "Check that only 11 of 16 furthest neighbors are "
-                       << "found... ";
-         check = (present == 11);
-         passedAll &= check;
-         test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-      }
-
-      return passedAll;
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: testChebyshevRnn
-//*****************************************************************************
-template <typename PointT>
-class testChebyshevRnn : public TestCase::TestStep
-{
-public:
-   testChebyshevRnn()
-      : TestCase::TestStep((std::string(
-                            "radially nearest-neighbor algorithm in Chebyshev "
-                            "space for points of type: ") + 
-                           typeid(PointT).name()))
-   {
-   }
-      //>
-      //<
-
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::testChebyshevRnn::operator(TestCase&)");
-
-      typedef typename PointT::value_type ValueT;
-      typedef ChebyshevDistance<PointT>   MetricT;
-      typedef typename MetricT::return_type        DistT;
-
-      //***
-      // Set up a 2D point layout on a regular grid as follows:
-      //
-      //- (0,0) (0,1) (0,2) ... (0,9)
-      //- (1,0) (1,1) (1,2) ... (1,9)
-      //-   .     .     .   .     .
-      //-   .     .     .    .    .
-      //-   .     .     .     .   .
-      //- (9,0) (9,1) (9,2) ... (9,9)
-      //
-      // Make sure points are created in top-left to bottom-right row-major
-      // order to force known indices:
-      //
-      //-  0  1  2 ...  9
-      //- 10 11 12 ... 19
-      //-  .  .  . .    .
-      //-  .  .  .  .   .
-      //-  .  .  .   .  .
-      //- 90 91 92 ... 99
-      //
-      //***
-
-      std::deque<PointT> data;
-      
-      for (unsigned int row = 0; row < 10; ++row)
-      {
-         for (unsigned int col = 0; col < 10; ++col)
-         {
-            PointT pt;
-            pt.push_back(static_cast<ValueT>(row));
-            pt.push_back(static_cast<ValueT>(col));
-            data.push_back(pt);
-         }
-      }
-
-      // Create the spatially indexed database
-      typedef VpTree<MetricT> VpTreeT;
-
-      VpTreeT database(data);
-      typedef typename VpTreeT::IndexT         IndexT;
-      typedef typename VpTreeT::SearchResultsT SearchResultsT;
-
-      // Perform a search for the nearest neighbors to point 45 within 3 units.
-      ValueT radius = 3;
-      SearchResultsT results = database.rnn(data[45], radius);
-
-      //***
-      // In Chebyshev space, the results should belong to the following set:
-      //
-      //- 12 13 14 15 16 17 18
-      //- 22 23 24 25 26 27 28
-      //- 32 33 34 35 36 37 38
-      //- 42 43 44 45 46 47 48
-      //- 52 53 54 55 56 57 58
-      //- 62 63 64 65 66 67 68
-      //- 72 73 74 75 76 77 78
-      //
-      // With distances:
-      //
-      //-  3  3  3  3  3  3  3
-      //-  3  2  2  2  2  2  3
-      //-  3  2  1  1  1  2  3
-      //-  3  2  1  0  1  2  3
-      //-  3  2  1  1  1  2  3
-      //-  3  2  2  2  2  2  3
-      //-  3  3  3  3  3  3  3
-      //
-      //***
-
-      // Display the results
-      test.report() << "Find nearest neighbors to point 45 (4,5) within 3 "
-                    << "units...\n";
-      std::deque<IndexT> idxs = results.first;
-      std::deque<DistT>          dists = results.second;
-
-      test.report() << "idxs = {";
-
-      if (!idxs.empty())
-      {
-         test.report() << idxs[0];
-         for (std::size_t idx = 1; idx < idxs.size(); ++idx)
-         {
-            test.report() << ", " << idxs[idx];
-         }
-      }
-
-      test.report() << "}\n";
-
-      test.report() << "dists = {";
-
-      if (!idxs.empty())
-      {
-         test.report() << dists[0];
-         for (std::size_t idx = 1; idx < idxs.size(); ++idx)
-         {
-            test.report() << ", " << dists[idx];
-         }
-      }
-
-      test.report() << "}\n";
-
-      // Check the results
-      bool passedAll = true;
-      bool check;
-
-      test.report() << "Check that index and distance set sizes match... ";
-      check = (idxs.size() == dists.size());
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      test.report() << "Check that we found 49 neighbors... ";
-      check = (idxs.size() == 49);
-      passedAll &= check;
-      test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-
-      // Check nearest elements
-      {
-         IndexT f[] = {12, 13, 14, 15, 16, 17, 18,
-                       22, 23, 24, 25, 26, 27, 28,
-                       32, 33, 34, 35, 36, 37, 38,
-                       42, 43, 44, 45, 46, 47, 48,
-                       52, 53, 54, 55, 56, 57, 58,
-                       62, 63, 64, 65, 66, 67, 68,
-                       72, 73, 74, 75, 76, 77, 78};
-         std::vector<IndexT> furthest(f,
-                                        f + sizeof(f)/sizeof(IndexT));
-
-         unsigned char present = 0;
-         typename std::deque<IndexT>::iterator pos;
-
-         for (std::size_t nbr = furthest.size(); nbr --> 0;)
-         {
-            pos = find(idxs.begin(), idxs.end(), furthest[nbr]);
-
-            if (pos != idxs.end()) ++present;
-         }
-
-         // Check that 49 out of 49 near neighbors are found
-         test.report() << "Check that all 49 nearest neighbors are "
-                       << "found... ";
-         check = (present == 49);
-         passedAll &= check;
-         test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-      }
-
-      // Check distances
-      {
-         check = true;
-         // Check that no distance exceeds the search reach
-         test.report() << "Check that no distance exceeds the search "
-                       << "reach... ";
-
-         for (std::size_t dist = dists.size(); dist --> 0;)
-         {
-            check &= (dists[dist] <= radius);
-         }
-
-         passedAll &= check;
-         test.report() << ((check) ? "[OK]" : "[FAILED]") << "\n";
-      }
-
-      return passedAll;
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-};
-
-//*****************************************************************************
-// CONSTRUCTOR: TestVpTree::TestVpTree(int, char**)
-//*****************************************************************************
-TestVpTree::TestVpTree(int argc, char** argv)
-   : TestCase(argc, argv,
-              "VpTree: Vantage Point Tree Test Suite",
-              "VpTree_01",
-              "This test case tests the vantage point tree data structure.")
-{
-   EXCEPTION_TRY("Damkjer::TestVpTree::TestVpTree(int, char**)");
-
-   typedef std::vector<float>  FltPtT;
-   typedef std::vector<double> DblPtT;
-
-   registerStep(new testEuclideanKnn<FltPtT>());
-   registerStep(new testEuclideanKnn<DblPtT>());
-   registerStep(new testEuclideanRnn<FltPtT>());
-   registerStep(new testEuclideanRnn<DblPtT>());
-   registerStep(new testManhattanKnn<FltPtT>());
-   registerStep(new testManhattanKnn<DblPtT>());
-   registerStep(new testManhattanRnn<FltPtT>());
-   registerStep(new testManhattanRnn<DblPtT>());
-   registerStep(new testChebyshevKnn<FltPtT>());
-   registerStep(new testChebyshevKnn<DblPtT>());
-   registerStep(new testChebyshevRnn<FltPtT>());
-   registerStep(new testChebyshevRnn<DblPtT>());
-
-   // Need to add radial tests.
-
-   EXCEPTION_RETHROW;
-}
-
-}
Index: mkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.h
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.h	(revision 12)
+++ 	(revision )
@@ -1,38 +1,0 @@
-//*****************************************************************************
-// FILE:        TestVpTree.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: 
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-AUG-06  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifndef TestVpTree_HEADER
-#define TestVpTree_HEADER
-
-#include "Util/UtilAPI.h"
-#include "Util/UnitTest/TestCase.h"
-
-namespace Damkjer
-{
-
-class TestVpTree : public TestCase
-{
-public:
-   TestVpTree(int, char**);
-      //>
-      //<
-private:
-   TestVpTree(const TestVpTree&);
-   TestVpTree& operator=(const TestVpTree&);
-};
-
-}
-
-#endif
Index: mkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.vcxproj
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.vcxproj	(revision 12)
+++ 	(revision )
@@ -1,437 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="DebugOMP|Win32">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="DebugOMP|x64">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|Win32">
-      <Configuration>OpenMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|x64">
-      <Configuration>OpenMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="TestVpTree.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="TestVpTree.cpp" />
-    <ClCompile Include="test_VpTree.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\Util.vcxproj">
-      <Project>{20fe2624-c64f-d61a-bd8f-1725a8e68a42}</Project>
-    </ProjectReference>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <Keyword>Win32Proj</Keyword>
-    <ProjectName>test_VpTree</ProjectName>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent />
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent />
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <RuntimeTypeInfo>true</RuntimeTypeInfo>
-      <AdditionalOptions>/wd4514 /wd4571 /wd4668 /wd4710 /wd4711 /wd4820 /wd4986 %(AdditionalOptions)</AdditionalOptions>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-    </PostBuildEvent>
-    <CustomBuildStep />
-  </ItemDefinitionGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
Index: mkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.vcxproj.filters
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.vcxproj.filters	(revision 10)
+++ 	(revision )
@@ -1,26 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4010ed24-e68d-4e6e-97b0-8b8bb335aa86}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{0c039d31-de79-478b-9dc5-c3378145e52a}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="TestVpTree.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="test_VpTree.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="TestVpTree.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-</Project>
Index: mkjer/Util/SpatialIndexing/VpTree/test/test_VpTree.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/test/test_VpTree.cpp	(revision 12)
+++ 	(revision )
@@ -1,33 +1,0 @@
-//*****************************************************************************
-// FILE:        test_VpTree.cpp
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: 
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-AUG-06  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include "Util/Exception/Exception.h"
-#include "TestVpTree.h"
-
-using namespace Damkjer;
-
-//*****************************************************************************
-// main
-//*****************************************************************************
-int main(int argc, char** argv)
-{
-   EXCEPTION_TRY("main(int, char**)");
-
-   TestVpTree driver(argc, argv);
-
-   return driver.execute();
-
-   EXCEPTION_CATCHALL;
-}
Index: mkjer/Util/Streams/BlockIndent.cpp
===================================================================
--- Damkjer/Util/Streams/BlockIndent.cpp	(revision 12)
+++ 	(revision )
@@ -1,91 +1,0 @@
-//*****************************************************************************
-// FILE:        BlockIndent.cpp
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   This class performs the function of block-indenting a stream. It is a
-//    convenience manipulator based heavily on the code provided at:
-//
-//    http://stackoverflow.com/questions/5280858/indenting-paragraph-with-cout
-//<
-//
-// LIMITATIONS: 
-//>   No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-26  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include <ostream>
-
-#include "BlockIndent.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// BlockIndent static variable instantiation
-//*****************************************************************************
-const int       BlockIndent::soleIndentationIndex = std::ios_base::xalloc();
-   //> The singular index into the stream buffer extensible iword array for the
-   //  current indentation level.
-   //<   
-
-std::deque<int> BlockIndent::soleIndentationRegistry;
-   //> The singular indentation registry used to track block indentation
-   //  levels.
-   //<   
-
-//*****************************************************************************
-// BlockIndent::operator()(std::ostream&)
-//>   Manipulate the given output stream with a block indentation style. This
-//    method provides a functor interface for operating on std::ostream
-//    objects. This function cannot be templatized, otherwise compilers will
-//    inline the method, thus exposing the private static variables on the
-//    class to the shared library interface. Further, this method is only valid
-//    for std::ostream objects since it manipulates the object's
-//    std::ios_base::iword database in an output streaming context.
-//
-//    @param output The output stream to manipulate.
-//    @return       The manipulated output stream.
-//<
-//*****************************************************************************
-Util_API std::ostream& BlockIndent::operator()(std::ostream& output) const
-{
-   // Blocks should always start on a new line, but we don't always need a new
-   // line to start a block. What to do?
-   output.iword(soleIndentationIndex) += theNumSpaces;
-   soleIndentationRegistry.push_front(theNumSpaces);
-
-   return output;
-}
-
-//*****************************************************************************
-// endBlock(std::ostream&)
-//>   End the current block indentation in the specified output stream.
-//
-//    @param output The output stream to modify.
-//    @return       The modified output stream.
-//<
-//*****************************************************************************
-Util_API std::ostream& endBlock(std::ostream& output)
-{
-   // Blocks should always end with a new line, but we don't always need a new
-   // line to end a block. What to do?
-//   output << "\n";
-
-   if (!BlockIndent::soleIndentationRegistry.empty())
-   {
-      int decr = BlockIndent::soleIndentationRegistry.front();
-      BlockIndent::soleIndentationRegistry.pop_front();
-      output.iword(BlockIndent::soleIndentationIndex) -= decr;
-   }
-   
-   return output;
-}
-
-}
Index: mkjer/Util/Streams/BlockIndent.h
===================================================================
--- Damkjer/Util/Streams/BlockIndent.h	(revision 12)
+++ 	(revision )
@@ -1,100 +1,0 @@
-//*****************************************************************************
-// FILE:        BlockIndent.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: 
-//>   The interface definition for the block indentation output stream
-//    manipulator.
-//<
-//
-// LIMITATIONS: 
-//>   No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2013-JUL-26  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifndef Damkjer_BlockIndent_HEADER
-#define Damkjer_BlockIndent_HEADER
-
-#if _MSC_VER
-#pragma warning(push, 0)
-#endif
-
-#include <iosfwd>
-#include <deque>
-
-#if _MSC_VER
-#pragma warning(pop)
-#endif
-
-#include "Util/UtilAPI.h"
-#include "Util/Streams/ManipulatorBase.h"
-
-namespace Damkjer
-{
-
-Util_API std::ostream& endBlock(std::ostream&);
-   //> End the current block indentation in the specified output stream.
-   //<
-
-//*****************************************************************************
-// FUNCTOR: BlockIndent
-//>   An output stream manipulator for performing block indentation.
-//
-//    This class performs the function of block-indenting a stream. It is a
-//    convenience manipulator based heavily on the code provided at:
-//
-//    http://stackoverflow.com/questions/5280858/indenting-paragraph-with-cout
-//<
-//*****************************************************************************
-class BlockIndent : public ManipulatorBase<BlockIndent>
-{
-public:
-   Util_API explicit BlockIndent(long indent = 3)
-      : ManipulatorBase<BlockIndent>()
-      , theNumSpaces(indent)
-   {
-   }
-      //> Instantiate a block indentation manipulator with a number of spaces
-      //  to indent.
-      //
-      //  @param indent The number of spaces to indent. Defaults to 3.
-      //<
-
-   Util_API std::ostream& operator()(std::ostream&) const;
-      //> Manipulate the given output stream with a block indentation style.
-      //<
-
-   Util_API static int index() { return soleIndentationIndex; }
-      //> The index for the indentation size in the stream buffer extensible
-      //  iword array.
-      //
-      //  @return The indentation index.
-      //<
-
-private:
-   long theNumSpaces;
-      //> The number of spaces to indent this block.
-      //<
-
-   static const int soleIndentationIndex;
-      //> The singular index into the stream buffer extensible iword array for
-      //  the current indentation level.
-      //<   
-
-   static std::deque<int> soleIndentationRegistry;
-      //> The singular indentation registry used to track block indentation
-      //  levels.
-      //<   
-
-   friend Util_API std::ostream& endBlock(std::ostream&);
-};
-
-}
-
-#endif
Index: mkjer/Util/Streams/FormatFilter.cpp
===================================================================
--- Damkjer/Util/Streams/FormatFilter.cpp	(revision 12)
+++ 	(revision )
@@ -1,291 +1,0 @@
-//*****************************************************************************
-// FILE:        FormatFilter.cpp
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION:
-//> The class implementation for the output format filter.
-//<
-//
-// LIMITATIONS:
-//> No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-AUG-04  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include <iostream>
-
-#include "Util/Exception/Exception.h"
-
-#include "BlockIndent.h"
-#include "FormatFilter.h"
-
-namespace Damkjer
-{
-//*****************************************************************************
-// FormatFilter::soleLineWidthIndex
-//> The index for the line width in the stream buffer extensible iword array.
-//<
-//*****************************************************************************
-const int
-FormatFilter::soleLineWidthIndex = std::ios_base::xalloc();
-
-//*****************************************************************************
-// FormatFilter::FormatFilter(std::ostream&, std::size_t)
-//>   Instantiate a format filter.
-//
-//    @param output    The stream to wrap for formatting.
-//    @param lineWidth The word-wrap line length.
-//<
-//*****************************************************************************
-Util_API
-FormatFilter::FormatFilter(std::ostream& output, std::size_t lineWidth)
-   : theCount(0)
-   , theDestination(output)
-   , theDestinationBuf(output.rdbuf())
-   , theLineWidth(lineWidth)
-{
-   EXCEPTION_TRY("Damkjer::FormatFilter::FormatFilter(std::ostream&, "
-                 "std::size_t)");
-
-   theDestination.iword(widthIndex()) = static_cast<long>(lineWidth);
-   theDestination.rdbuf(this);
-
-   EXCEPTION_RETHROW;
-}
-
-//*****************************************************************************
-// FormatFilter::~FormatFilter
-//>   Destruct the format filter and deallocate resources.
-//<
-//*****************************************************************************
-Util_API
-FormatFilter::~FormatFilter()
-{
-   if (!theBuffer.empty())
-   {
-      // flush the buffer, if needed.
-      overflow('\0');
-   }
-
-   theDestination.rdbuf(theDestinationBuf);
-}
-
-//*****************************************************************************
-// FormatFilter::overflow
-//>   Format the stream with line-wrapping and block indentation.
-//
-//    The overflow method is called automatically when streambuf internal
-//    buffers become full and flush their contents. This method basically
-//    implements a line-buffering stream buffer.
-//
-//    The algorithm is:
-//
-//    - Explicit end of line ("\r" or "\n"): we flush our buffer to the
-//      underlying stream's buffer, and set our record of the line length to 0.
-//    - An "alert" character: sent to the underlying stream without recording
-//      its length, since it doesn't normally affect the a appearance of the
-//      output.
-//    - Tab: treated as moving to the next tab stop, which is assumed as
-//      happening every tab_width characters.
-//    - Everything else: really basic buffering with word wrapping. We try to
-//      add the character to the buffer, and if it exceeds our line width, we
-//      search for the last space/tab in the buffer and break the line there.
-//      If there is no space/tab, we break the line at the limit.
-//
-//    @param c The character to be placed into the controlled output stream.
-//    @return  The put character.
-//<
-//*****************************************************************************
-std::streambuf::int_type
-FormatFilter::overflow(int_type c)
-{
-   EXCEPTION_TRY("Damkjer::FormatFilter::overflow(int_type)");
-
-   if (traits_type::eq_int_type(traits_type::eof(), c))
-   {
-      return traits_type::not_eof(c);
-   }
-
-   std::streamsize bufferSize = static_cast<std::streamsize>(theBuffer.size());
-   std::streamsize blockIndent = theDestination.iword(BlockIndent::index());
-   std::size_t indentAsSize = static_cast<std::size_t>(blockIndent);
-   std::size_t blockWidth  = (theLineWidth > indentAsSize)
-                             ? theLineWidth - indentAsSize
-                             : 1;
-
-   const char* prefix = std::string(indentAsSize, ' ').c_str();
-
-   char_type character = static_cast<char_type>(c);
-
-   switch (c)
-   {
-   case '\0':
-      theCount = 0;
-      theDestinationBuf->sputn(prefix, blockIndent);
-      theDestinationBuf->sputn(theBuffer.c_str(), bufferSize);
-      theBuffer.clear();
-      return c;
-
-   case '\n':
-   case '\r':
-      //***
-      // Explicit end of line: we flush our buffer to the underlying stream's
-      // buffer, and set our record of the line length to 0.
-      //***
-
-      theBuffer += character;
-      theCount = 0;
-      theDestinationBuf->sputn(prefix, blockIndent);
-      theDestinationBuf->sputn(theBuffer.c_str(), bufferSize + 1);
-      theBuffer.clear();
-      return c;
-
-   case '\a':
-      //***
-      // An "alert" character: sent to the underlying stream without recording
-      // its length, since it doesn't normally affect the a appearance of the
-      // output.
-      //***
-
-      return theDestinationBuf->sputc(character);
-
-   case '\t':
-      //***
-      // Tab: treated as moving to the next tab stop, which is assumed as
-      // happening every TAB_WIDTH characters.
-      //***
-
-      theBuffer += character;
-      theCount += soleTabWidth - theCount % soleTabWidth;
-
-      return c;
-
-   default:
-      //***
-      // Everything else: really basic buffering with word wrapping. We try to
-      // add the character to the buffer, and if it exceeds our line width, we
-      // search for the last space/tab in the buffer and break the line there.
-      // If there is no space/tab, we break the line at the limit.
-      //***
-      if (theCount >= blockWidth)
-      {
-         std::size_t pos = theBuffer.find_last_of("\\/ \t");
-         std::streamsize posAsStrmSz = static_cast<std::streamsize>(pos);
-
-         if (pos != FilterString::npos)
-         {
-            theDestinationBuf->sputn(prefix, blockIndent);
-
-            switch (theBuffer[pos])
-            {
-            case '\\':
-            case '/':
-               theDestinationBuf->sputn(theBuffer.c_str(), posAsStrmSz+1);
-               break;
-            default:
-               theDestinationBuf->sputn(theBuffer.c_str(), posAsStrmSz);
-            }
-
-            theCount = theBuffer.size()-pos-1;
-            theBuffer = FilterString(theBuffer, pos+1);
-         }
-         else
-         {
-            theDestinationBuf->sputn(prefix, blockIndent);
-            theDestinationBuf->sputn(theBuffer.c_str(), bufferSize);
-            theBuffer.clear();
-            theCount = 0;
-         }
-
-         theDestinationBuf->sputc('\n');
-      }
-
-      theBuffer += character;
-      ++theCount;
-
-      return c;
-   }
-
-   EXCEPTION_RETHROW;
-}
-
-//*****************************************************************************
-// sline(std::ostream&)
-//>   Insert a line of hyphen ('-') characters into the argument stream
-//    creating the appearance of a single horizontal line.
-//
-//    @param output The stream to be updated.
-//    @return       The updated stream.
-//<
-//*****************************************************************************
-Util_API
-std::ostream&
-sline(std::ostream& output)
-{
-   EXCEPTION_TRY("Damkjer::sline(std::ostream&)");
-
-   std::size_t lineWidth = static_cast<std::size_t>(
-                                     output.iword(FormatFilter::widthIndex()));
-
-   if (lineWidth == 0)
-   {
-      lineWidth = 79;
-      output.iword(FormatFilter::widthIndex()) = 79;
-   }
-
-   std::size_t blockIndent = static_cast<std::size_t>(
-                                           output.iword(BlockIndent::index()));
-   std::size_t blockWidth  = lineWidth - blockIndent;
-
-   std::string line(blockWidth, '-');
-
-   output << line.c_str() << "\n";
-   
-   return output;
-
-   EXCEPTION_RETHROW;
-}
-
-//*****************************************************************************
-// dline(std::ostream&)
-//>   Insert a line of equals ('=') characters into the argument stream
-//    creating the appearance of a double horizontal line.
-//
-//    @param output The stream to be updated.
-//    @return       The updated stream.
-//<
-//*****************************************************************************
-Util_API
-std::ostream&
-dline(std::ostream& output)
-{
-   EXCEPTION_TRY("Damkjer::dline(std::ostream&)");
-
-   std::size_t lineWidth = static_cast<std::size_t>(
-                                     output.iword(FormatFilter::widthIndex()));
-
-   if (lineWidth == 0)
-   {
-      lineWidth = 79;
-      output.iword(FormatFilter::widthIndex()) = 79;
-   }
-
-   std::size_t blockIndent = static_cast<std::size_t>(
-                                           output.iword(BlockIndent::index()));
-   std::size_t blockWidth  = lineWidth - blockIndent;
-
-   std::string line(blockWidth, '=');
-
-   output << line.c_str() << "\n";
-   
-   return output;
-
-   EXCEPTION_RETHROW;
-}
-
-}
Index: mkjer/Util/Streams/FormatFilter.h
===================================================================
--- Damkjer/Util/Streams/FormatFilter.h	(revision 12)
+++ 	(revision )
@@ -1,122 +1,0 @@
-//*****************************************************************************
-// FILE:        FormatFilter.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION:
-//> The interface definition for the output format filter.
-//<
-//
-// LIMITATIONS:
-//> No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2013-AUG-04  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifndef Damkjer_FormatFilter_HEADER
-#define Damkjer_FormatFilter_HEADER
-
-#include <ostream>   // HASA std::ostream interface and data member.
-#include <streambuf> // ISA  std::streambuf derivative.
-
-#include "Util/UtilAPI.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// CLASS: FormatFilter
-//>   An output stream filter to produce line-wrapped and block-indented text.
-//<
-//*****************************************************************************
-class FormatFilter : public std::streambuf
-{
-public:
-   Util_API explicit FormatFilter(std::ostream&, std::size_t lineWidth = 79);
-      //> Instantiate a format filter.
-      //<
-
-   Util_API virtual ~FormatFilter();
-      //> Destruct the format filter and deallocate resources.
-      //<
-
-   Util_API static int widthIndex() { return soleLineWidthIndex; }
-      //> The index for the line width in the stream buffer extensible iword
-      //  array.
-      //
-      //  @return The line width index.
-      //<
-
-private:
-   FormatFilter();
-      //> Explicitly disable the compiler-generated default constructor. No
-      //  definition provided.
-      //<
-
-   FormatFilter(const FormatFilter&);
-      //> Explicitly disable the compiler-generated copy constructor. No
-      //  definition provided.
-      //<
-
-   FormatFilter& operator=(const FormatFilter&);
-      //> Explicitly disable the compiler-generated assignment operator. No
-      //  definition provided.
-      //
-      //  @return The updated left-hand side when not disabled.
-      //<
-
-   int_type overflow(int_type);
-      //>   Format the stream with line-wrapping and block indentation.
-      //<
-
-   typedef std::basic_string<char_type> FilterString;
-      //> The current count of characters in the block.
-      //<
-
-   std::size_t theCount;
-      //> The current count of characters in the block.
-      //<
-
-   std::ostream& theDestination;
-      //> The destination stream for formatted stream data.
-      //<
-
-   std::streambuf* theDestinationBuf;
-      //> The pointer to the wrapped stream buffer.
-      //<
-
-   FilterString theBuffer;
-      //> The actual buffer contents.
-      //<
-
-   std::size_t theLineWidth;
-      //> The current formatted line width.
-      //<
-
-   static const int soleLineWidthIndex;
-      //> The index for the line width in the stream buffer extensible iword
-      //  array.
-      //<
-
-   static const int soleTabWidth = 8;
-      //> Define tab width as 8 spaces.
-      //<
-};
-
-Util_API std::ostream& sline(std::ostream&);
-   //> Insert a line of hyphen ('-') characters into the argument stream
-   //  creating the appearance of a single horizontal line.
-   //<
-
-Util_API std::ostream& dline(std::ostream&);
-   //> Insert a line of equals ('=') characters into the argument stream
-   //  creating the appearance of a double horizontal line.
-   //<
-
-}
-
-#endif
Index: mkjer/Util/Streams/ManipulatorBase.h
===================================================================
--- Damkjer/Util/Streams/ManipulatorBase.h	(revision 12)
+++ 	(revision )
@@ -1,98 +1,0 @@
-//*****************************************************************************
-// FILE:        ManipulatorBase.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   Base class interface definition for stream manipulators.
-//<
-//
-// LIMITATIONS:
-//>   No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2013-AUG-03  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifndef Damkjer_ManipulatorBase_HEADER
-#define Damkjer_ManipulatorBase_HEADER
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// CLASS: ManipulatorBase
-//>   A template base class for stream manipulators. This class is modeled on
-//    the "Curiously Recurring Template Pattern". This pattern provides a
-//    simple interface for stream manipulators to be called with anonymous
-//    objects on input and output streams. It is an example of "static
-//    polymorphism".
-//
-//    @tparam ManipulatorT The stream manipulator type.
-//<
-//*****************************************************************************
-template <class ManipulatorT>
-class ManipulatorBase
-{
-public:
-   template <class StreamT>
-   StreamT& operator()(StreamT& stream) const
-   {
-      // call Manipulator::operator()
-      static_cast<const ManipulatorT&>(*this)(stream);
-      return stream;
-   }
-      //> Invoke the ManipulatorT functor on the stream. The function operator
-      //  allows manipulators derived from ManipulatorBase to behave as
-      //  functions with state.
-      //
-      //  @tparam StreamT The stream type.
-      //  @param  stream  The stream to be manipulated.
-      //  @return         The manipulated stream.
-      //<
-};
-
-}
-
-//*****************************************************************************
-// FUNCTION: operator<<(OstreamT&, const ManipulatorBase<ManipulatorT>&)
-//>   Manipulate an output stream with a manipulator via stream insertion.
-//
-//    @tparam OstreamT     The output stream type.
-//    @tparam ManipulatorT The output stream manipulator type.
-//    @param  outputStream The output stream to be manipulated.
-//    @param  manipulate   The output stream manipulator functor.
-//    @return              The manipulated output stream.
-//<
-//*****************************************************************************
-template <class OstreamT, class ManipulatorT>
-inline OstreamT&
-operator<<(OstreamT& outputStream,
-           const Damkjer::ManipulatorBase<ManipulatorT>& manipulate)
-{
-   return manipulate(outputStream);
-}
-
-//*****************************************************************************
-// FUNCTION: operator>>(IstreamT&, const ManipulatorBase<ManipulatorT>&)
-//>   Manipulate an input stream with a manipulator via stream extraction.
-//
-//    @tparam IstreamT     The input stream type.
-//    @tparam ManipulatorT The input stream manipulator type.
-//    @param  inputStream  The input stream to be manipulated.
-//    @param  manipulate   The input stream manipulator functor.
-//    @return              The manipulated input stream.
-//<
-//*****************************************************************************
-template <class IstreamT, class ManipulatorT>
-inline IstreamT&
-operator>>(IstreamT& inputStream,
-           const Damkjer::ManipulatorBase<ManipulatorT>& manipulate)
-{
-   return manipulate(inputStream);
-}
-
-#endif
Index: mkjer/Util/UnitTest/TestCase.cpp
===================================================================
--- Damkjer/Util/UnitTest/TestCase.cpp	(revision 12)
+++ 	(revision )
@@ -1,298 +1,0 @@
-//*****************************************************************************
-// FILE:        TestCase.cpp
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The class implementation for unit test cases.
-//<
-//
-// LIMITATIONS:
-//>   No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-24  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include <sstream>
-#include <iomanip>
-#include <ctime>
-
-#include "Util/Exception/Exception.h"
-#include "Util/Streams/BlockIndent.h"
-
-#include "TestCase.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// TestCase::TestCase(int, char**, const std::string&, const std::string&,
-//                    const std::string&, std::ostream&)
-//>   Intialize a test case with required information.
-//
-//    This constructor sets the name, ID, and description for the unit test
-//    case. It also wraps an output stream with a report stream to easily
-//    redirect and format test logs.
-//
-//    @param argc            The command-line argument count.
-//    @param argv            The command-line arguments.
-//    @param caseName        The test case descriptive name.
-//    @param caseID          The test case identifier.
-//    @param caseDescription The test case verbose description.
-//    @param reportStream    The test case report stream. Defaults to standard
-//                           log output.
-//<
-//*****************************************************************************
-Util_API
-TestCase::TestCase(int                argc,
-                   char**             argv,
-                   const std::string& caseName,
-                   const std::string& caseID,
-                   const std::string& caseDescription,
-                   std::ostream&      reportStream)
-   : theStartTime()
-   , theCaseName(caseName)
-   , theCaseID(caseID)
-   , theCaseDescription(caseDescription)
-   , theReportStream(reportStream)
-   , theStreamFormatter(reportStream)
-   , theArgv(argv)
-   , theDetailsIndent(0)
-   , theArgc(argc)
-   , theStepCount(0)
-{
-}
-   
-//*****************************************************************************
-// TestCase::argv(int)
-//>   The requested command line argument, converted to a string.
-//
-//    @param  index      the index of the desired command line argument.
-//    @return            the requested command line argument as a std::string.
-//    @throw  OutOfRange when the reqested argument is outside the range of
-//                       available arguments.
-//<
-//*****************************************************************************
-Util_API
-std::string TestCase::argv(int index) const
-{
-   EXCEPTION_TRY("Damkjer::TestCase::argv(int)");
-
-   if (index >= 0 && index < theArgc)
-   {
-      return theArgv[index];
-   }
-
-   //***
-   // In released code, there's not a whole lot that the user can do about
-   // this problem. This is a logic error and should be prevented through
-   // appropriate bounds checking on the input prior to calling the method.
-   //***
-   std::ostringstream msg;
-
-   msg << "Error encountered while retrieving an argument vector (argv) "
-       << "element.\n\n"
-       << "Unable to access the requested element (" << index << ") because "
-       << "it is outside the valid bounds of [0, " << theArgc << ").";
-
-   throw OutOfRange(msg.str(),  MODULE, __FILE__, __LINE__);
-
-   EXCEPTION_RETHROW;
-}
-
-//*****************************************************************************
-// TestCase::execute()
-//>   Execute the test case ad generate formatted test report. This method
-//    performs the simple sequence:
-//       -# Output Header to the report stream
-//       -# Run steps for the test
-//       -# Output Footer to the report stream
-//
-//    @return EXIT_SUCCESS on successful execution of all test steps.
-//            EXIT_FAILURE otherwise.
-//<
-//*****************************************************************************
-Util_API
-int
-TestCase::execute()
-{
-   EXCEPTION_TRY("Damkjer::TestCase::execute()");
-
-   header();
-
-   theReportStream << BlockIndent(4);
-   // Indent the body of the test report by 4.
-   int results = steps();
-   theReportStream << endBlock;
-
-   footer();
-
-   return results;
-
-   EXCEPTION_RETHROW;
-}
-
-//*****************************************************************************
-// TestCase::testing(const std::string&)
-//>   The formatted test leader.
-//
-//    Return a string in the following format for consistent reports:
-//-    "<step_number>. Testing <description>..."
-//
-//    @param  description The description to include in the test leader.
-//    @return             The formatted testing string.
-//<
-//*****************************************************************************
-void
-TestCase::testing(const std::string& description)
-{
-   std::ostringstream oss;
-   oss << ++theStepCount << ". ";
-   
-   theDetailsIndent = static_cast<long>(oss.str().length());
-
-   theReportStream << oss.str() << "Testing " << description << "...\n";
-
-   return;
-}
-
-//*****************************************************************************
-// TestCase::header()
-//>   Header for the unit test case report entry. This method is also
-//    responsible for starting the test case timer.
-//
-//    @return The formatted test report header.
-//<
-//*****************************************************************************
-std::ostream&
-TestCase::header()
-{
-#if ( _WIN32 || _WIN64 )
-   QueryPerformanceCounter(&theStartTime);
-#elif ( __linux || __unix || __posix )
-   clock_gettime(CLOCK_MONOTONIC, &theStartTime);
-#else
-   // How else can we capture high-resolution timing information?
-#endif
-
-   std::time_t now = std::time(NULL);
-
-   theReportStream
-      << dline
-      << " TEST CASE   :  " << theCaseID << "\n"
-      << " NAME        :  " << theCaseName << "\n"
-      << "\n"
-      << " DESCRIPTION :\n";
-
-   // Indent this block by 4.
-   theReportStream << BlockIndent(4);
-   theReportStream << theCaseDescription << "\n";
-   theReportStream << endBlock;
-
-   theReportStream
-      << dline
-      << sline
-      << " START TIME  :  " << std::asctime(std::localtime(&now))
-      << sline;
-
-   return theReportStream;
-}
-
-//*****************************************************************************
-// TestCase::steps()
-//>   Execute the registered steps for the test case.
-//
-//    @return EXIT_SUCCESS on successful execution of all test steps.
-//            EXIT_FAILURE otherwise.
-//<
-//*****************************************************************************
-int
-TestCase::steps()
-{
-   EXCEPTION_TRY("Damkjer::TestCase::steps()");
-
-   bool testPassed = false;
-   unsigned int passedTests = 0;
-
-   for (unsigned int i = 0; i < theSteps.size(); ++i)
-   {
-      testing(theSteps[i]->description());
-      theReportStream << BlockIndent(theDetailsIndent);
-      testPassed = (*(theSteps[i]))(*this);
-      theReportStream << "\n" << ((testPassed) ? "[PASSED]" : "[FAILED]")
-                      << "\n" << endBlock;
-
-      if (testPassed) ++passedTests;
-
-      theReportStream << sline;
-   }
-   
-   theReportStream << "Summary: " << passedTests << "/" << theSteps.size()
-                   << " tests passed.\n";
-
-   return (passedTests == theSteps.size()) ? EXIT_SUCCESS : EXIT_FAILURE;
-
-   EXCEPTION_RETHROW;
-}
-
-//*****************************************************************************
-// TestCase::footer
-//>   Footer for the unit test case report entry. This method is also
-//    responsible for stopping the test case timer.
-//
-//    @return The formatted test report footer.
-//<
-//*****************************************************************************
-std::ostream&
-TestCase::footer()
-{
-   double elapsed = 0;
-
-#if ( _WIN32 || _WIN64 )
-   TimeT stopTime;
-   QueryPerformanceCounter(&stopTime);
-
-   TimeT frequency;
-   QueryPerformanceFrequency(&frequency);
-
-   elapsed = 1.0 * (stopTime.QuadPart - theStartTime.QuadPart) /
-             frequency.QuadPart;
-#elif ( __linux || __unix || __posix )
-   TimeT stopTime;
-   clock_gettime(CLOCK_MONOTONIC, &stopTime);
-
-   elapsed = (stopTime.tv_sec - theStartTime.tv_sec) +
-             (stopTime.tv_nsec - theStartTime.tv_nsec) * 1e-9;
-#endif
-
-   unsigned int iElapsed = static_cast<unsigned int>(elapsed);
-
-   std::stringstream msg;
-   
-   char cfill = msg.fill('0');
-
-   msg << std::setw(2) << iElapsed / 3600 << ":"
-       << std::setw(2) << ((iElapsed / 60) % 60) << ":"
-       << std::setw(9) << std::fixed << std::setprecision(6)
-       << (elapsed-iElapsed+(iElapsed % 60));
-   
-   msg.fill(cfill);
-
-   std::time_t now = std::time(NULL);
-
-   theReportStream
-      << sline
-      << " STOP TIME   :  " << std::asctime(localtime(&now))
-      << sline
-      << dline
-      << " ELAPSED     :  " << msg.str() << "\n"
-      << dline;
-
-   return theReportStream;
-}
-
-}
Index: mkjer/Util/UnitTest/TestCase.h
===================================================================
--- Damkjer/Util/UnitTest/TestCase.h	(revision 12)
+++ 	(revision )
@@ -1,283 +1,0 @@
-//*****************************************************************************
-// FILE:        TestCase.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION:
-//>   The interface definition for unit test cases.
-//<
-//
-// LIMITATIONS:
-//>   No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-24  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifndef Damkjer_TestCase_HEADER
-#define Damkjer_TestCase_HEADER
-
-#if ( _WIN32 || _WIN64 )
-   #if NOMINMAX      // Avoid macro definitions of min/max infavor of STL
-#include <windows.h> // USES LARGE_INTEGER union
-   #else
-      #define NOMINMAX // Avoid macro definitions of min/max in favor of STL
-#include <windows.h> // USES LARGE_INTEGER union
-      #undef NOMINMAX
-   #endif
-#elif ( __linux || __unix || __posix )
-#include <time.h> // USES timespec structure
-#else
-   // How else can we capture high-resolution timing information?
-#endif
-
-#include <iostream> // HASA std::ostream interface and data member.
-#include <string>   // HASA std::string data member.
-#include <vector>   // HASA std::vector data member.
-
-// ISA component of the Util library API.
-#include "Util/UtilAPI.h"
-
-// HASA FormatFilter data member.
-#include "Util/Streams/FormatFilter.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// CLASS: TestCase
-//>   A common base class for unit test cases.
-//<
-//*****************************************************************************
-class TestCase
-{
-public:
-#if ( _WIN32 || _WIN64 )
-   typedef LARGE_INTEGER TimeT;
-      //> The time structure type for Windows systems.
-      //<
-#elif ( __linux || __unix || __posix )
-   typedef timespec TimeT;
-      //> The time structure type for *nix systems.
-      //<
-#else
-   // How else can we capture high-resolution timing information?
-#endif
-
-   class TestStep;
-
-   Util_API TestCase(int argc, char**,
-                     const std::string&,
-                     const std::string&,
-                     const std::string&,
-                     std::ostream& reportStream=std::clog);
-      //> Intialize a test case with required information.
-      //<
-   
-   Util_API virtual ~TestCase(){}
-      //> Destruct the TestCase and deallocate resources.
-      //<
-
-   Util_API virtual int execute();
-      //> Execute the test case ad generate formatted test report.
-      //<
-
-   Util_API virtual std::ostream& report();
-      //> The test case report output stream.
-      //<
-
-   Util_API std::size_t registerStep(TestStep* const);
-      //> Register a test step with the test case for execution.
-      //<
-
-   Util_API int stepNum() const { return theStepCount; }
-      //> Identify the current step in test exection.
-      //
-      //  @return The current step in execution.
-      //<
-
-   Util_API int argc() const { return theArgc; }
-      //> The command line argument count.
-      //
-      //  @return The command line argument count.
-      //<
-   
-   Util_API std::string argv(int) const;
-      //> The requested command line argument, converted to a string.
-      //<
-
-private:
-   TestCase();
-      //> Explicitly disable the compiler-generated default constructor. No
-      //  definition provided.
-      //<
-
-   TestCase(const TestCase&);
-      //> Explicitly disable the compiler-generated copy constructor. No
-      //  definition provided.
-      //<
-
-   TestCase& operator=(const TestCase&);
-      //> Explicitly disable the compiler-generated assignment operator. No
-      //  definition provided.
-      //
-      //  @return The updated left-hand side when not disabled.
-      //<
-
-   void testing(const std::string&);
-      //> The formatted test leader.
-      //<
-
-   std::ostream& header();
-      //> Header for the unit test case report entry.
-      //<
-   
-   int steps();
-      //> Execute the registered steps for the test case.
-      //<
-
-   std::ostream& footer();
-      //> Footer for the unit test case report entry.
-      //<
-
-   TimeT theStartTime;
-      //> The test case start time.
-      //<
-
-   std::string theCaseName;
-      //> The test case name.
-      //<
-
-   std::string theCaseID;
-      //> The test case identifier.
-      //<
-
-   std::string theCaseDescription;
-      //> The test case description.
-      //<
-   
-   std::ostream& theReportStream;
-      //> The report output stream.
-      //<
-
-   std::vector<TestStep*> theSteps;
-      //> The test steps for evaluation.
-      //<
-
-   FormatFilter theStreamFormatter;
-      //> The test report formatter.
-      //<
-
-   char** theArgv;
-      //> The vector of arguments.
-      //<
-
-   long theDetailsIndent;
-      //> The current report indentation level.
-      //<
-
-   int theArgc;
-      //> The argument count.
-      //<
-
-   int theStepCount;
-      //> The test step counter.
-      //<
-};
-
-//*****************************************************************************
-// CLASS: TestCase::TestStep
-//>   An individual step of a comprehensive test case.
-//<
-//*****************************************************************************
-class TestCase::TestStep
-{
-public:
-   Util_API explicit TestStep(const std::string& description)
-      : theDescription(description)
-   {
-   }
-      //> Instantiate a TestStep with a description.
-      //
-      //  @param description The test step description.
-      //<
-
-   Util_API virtual ~TestStep(){}
-      //> Destruct the TestStep and deallocate resources.
-      //<
-
-   Util_API const std::string& description() const { return theDescription; }
-      //> The description of the test step.
-      //
-      //  @return The test step description.
-      //<
-
-   Util_API virtual bool operator()(TestCase&) const = 0;
-      //> Perform the evaluation of the test step.
-      //
-      //  @return true if and only if the test step is successful.
-      //<
-
-private:
-   TestStep();
-      //> Explicitly disable the compiler-generated default constructor. No
-      //  definition provided.
-      //<
-
-   TestStep(const TestStep&);
-      //> Explicitly disable the compiler-generated copy constructor. No
-      //  definition provided.
-      //<
-
-   TestStep& operator=(const TestStep&);
-      //> Explicitly disable the compiler-generated assignment operator. No
-      //  definition provided.
-      //
-      //  @return The updated left-hand side when not disabled.
-      //<
-
-   std::string theDescription;
-      //> The description of the test step.
-      //<
-};
-
-//*****************************************************************************
-// TestCase::report
-//>   The test case report output stream.
-//
-//    @return the report stream for this test case.
-//<
-//*****************************************************************************
-Util_API
-inline
-std::ostream&
-TestCase::report()
-{
-   return theReportStream;
-}
-
-//*****************************************************************************
-// TestCase::registerStep
-//>   Register a test step with the test case for execution.
-//
-//    @param step a pointer to a step to be executed as part of this test case.
-//    @return     the test case step number associated with the registered
-//                step.
-//<
-//*****************************************************************************
-Util_API
-inline
-std::size_t
-TestCase::registerStep(TestStep* const step)
-{
-   theSteps.push_back(step);
-   return theSteps.size();
-}
-
-
-}
-
-#endif
Index: mkjer/Util/UnitTest/test/TestTestCase.cpp
===================================================================
--- Damkjer/Util/UnitTest/test/TestTestCase.cpp	(revision 12)
+++ 	(revision )
@@ -1,275 +1,0 @@
-//*****************************************************************************
-// FILE:        TestTestCase.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: TestTestCase
-//
-//    See TestTestCase header for detailed description.
-//
-// DESCRIPTION: stepReport
-//
-//    See TestTestCase header for detailed description.
-//
-// DESCRIPTION: stepIncr
-//
-//    See TestTestCase header for detailed description.
-//
-// DESCRIPTION: passArgc
-//
-//    See TestTestCase header for detailed description.
-//
-// DESCRIPTION: passArgv
-//
-//    See TestTestCase header for detailed description.
-//
-// DESCRIPTION: argvThrow
-//
-//    See TestTestCase header for detailed description.
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-24  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include <sstream>
-
-#include "Util/Exception/Exception.h"
-#include "TestTestCase.h"
-#include "Util/Streams/BlockIndent.h"
-
-namespace Damkjer
-{
-
-//*****************************************************************************
-// FUNCTOR: stepReport
-//*****************************************************************************
-class stepReport : public TestCase::TestStep
-{
-public:
-   explicit stepReport(int expected)
-      : TestCase::TestStep("sending a message to the step method")
-      , theExpectedValue(expected)
-   {
-   }
-      //> This functor constructs with a single parameter representing an
-      //  integer expected value.
-      //<
-   
-   bool operator()(TestCase& test) const
-   {
-      test.report() << "Test Number: " << test.stepNum() << "\n"
-                    << "Expecting  : " << theExpectedValue << "\n";
-      return (test.stepNum() == theExpectedValue);
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-
-private:
-   int theExpectedValue;
-      //> The expected value for this test step.
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: stepIncr
-//*****************************************************************************
-class stepIncr : public TestCase::TestStep
-{
-public:
-   explicit stepIncr(int expected)
-      : TestCase::TestStep("another step to ensure step values increment as "
-                           "expected")
-      , theExpectedValue(expected)
-   {
-   }
-      //> This functor constructs with a single parameter representing an
-      //  integer expected value.
-      //<
-
-   bool operator()(TestCase& test) const
-   {
-      test.report() << "Test Number: " << test.stepNum() << "\n"
-                    << "Expecting  : " << theExpectedValue << "\n";
-      return (test.stepNum() == theExpectedValue);
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-
-private:
-   int theExpectedValue;
-      //> The expected value for this test step.
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: passArgc
-//*****************************************************************************
-class passArgc : public TestCase::TestStep
-{
-public:
-   explicit passArgc(int expected)
-      : TestCase::TestStep("argc pass-through")
-      , theExpectedValue(expected)
-   {
-   }
-      //> This functor constructs with a single parameter representing an
-      //  integer expected value.
-      //<
-   
-   bool operator()(TestCase& test) const
-   {
-      test.report() << "argc     : " << test.argc() << "\n"
-                    << "Expecting: " << theExpectedValue << "\n";
-      return (test.argc() == theExpectedValue);
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-
-private:
-   int theExpectedValue;
-      //> The expected value for this test step.
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: passArgv
-//*****************************************************************************
-class passArgv : public TestCase::TestStep
-{
-public:
-   explicit passArgv(char** expected)
-      : TestCase::TestStep("argv pass-through")
-      , theExpectedValues(expected)
-   {
-   }
-      //> This functor constructs with a single parameter representing a
-      //  character pointer array of expected values.
-      //<
-   
-   bool operator()(TestCase& test) const
-   {
-      bool check = true;
-
-      for (int i = 0; i < test.argc() && check; ++i)
-      {
-         std::ostringstream argStm;
-         argStm << "argv[" << i << "]";
-
-         std::ostringstream expStm;
-         expStm << "Expecting";
-
-         int pad = static_cast<int>(argStm.str().length()) -
-                   static_cast<int>(expStm.str().length());
-
-         unsigned int argPad = static_cast<unsigned int>((pad < 0) ? -pad : 0);
-         unsigned int expPad = static_cast<unsigned int>((pad > 0) ?  pad : 0);
-
-         argStm << std::string(argPad, ' ') << ": ";
-         expStm << std::string(expPad, ' ') << ": ";
-
-         test.report() << argStm.str() << test.argv(i) << "\n"
-                       << expStm.str() << theExpectedValues[i] << "\n";
-
-         check &= (strcmp(theExpectedValues[i], test.argv(i).c_str()) == 0);
-      }
-
-      return check;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-
-private:
-   char** theExpectedValues;
-      //> The expected values for this test step.
-      //<
-};
-
-//*****************************************************************************
-// FUNCTOR: argvThrow
-//*****************************************************************************
-class argvThrow : public TestCase::TestStep
-{
-public:
-   argvThrow()
-      : TestCase::TestStep("throw from argv")
-   {
-   }
-      //> This functor constructs with a simple default constructor since the
-      //  test body is not performing a direct comparison against an expected
-      //  value.
-      //<
-   
-   bool operator()(TestCase& test) const
-   {
-      EXCEPTION_TRY("Damkjer::argvThrow::operator(TestCase&)");
-
-      try
-      {
-         test.report() << test.argv(test.argc()) << "\n";
-         test.report() << "Did not catch an exception!\n";
-
-         // If we get here, we didn't throw: failed test.
-         return false;
-      }
-      catch (const OutOfRange& e)
-      {
-         test.report() << "Caught expected exception:\n";
-
-         test.report() << BlockIndent() << e;
-         e.stackTrace(test.report());
-         test.report() << endBlock;
-
-         // If we get here, we threw the correct exception: successful test.
-         return true;
-      }
-      catch (...)
-      {
-         test.report() << "Caught unexpected exception.\n";
-
-         // If we get here, we threw something unexpected: failed test.
-         return false;
-      }
-
-      EXCEPTION_RETHROW;
-   }
-      //> The parentheses operator represents the body of the test step
-      //  function. It will perform the necessary evaluation and return true if
-      //  and only if the test passes.
-      //<
-};
-
-//*****************************************************************************
-// CONSTRUCTOR: TestTestCase::TestTestCase(int, char**)
-//*****************************************************************************
-TestTestCase::TestTestCase(int argc, char** argv)
-   : TestCase(argc, argv,
-              "TestCase: Basic Functionality",
-              "TestCase_01",
-              "This test case tests basic TestCase functionality.")
-{
-   //***
-   // The "step" variable is only needed for this unit test to validate
-   // expected increments.
-   //***
-   int step = 0;
-
-   registerStep(new stepReport(++step));
-   registerStep(new stepIncr(++step));
-   registerStep(new passArgc(argc));
-   registerStep(new passArgv(argv));
-   registerStep(new argvThrow());
-}
-
-}
Index: mkjer/Util/UnitTest/test/TestTestCase.h
===================================================================
--- Damkjer/Util/UnitTest/test/TestTestCase.h	(revision 12)
+++ 	(revision )
@@ -1,38 +1,0 @@
-//*****************************************************************************
-// FILE:        TestTestCase.h
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: 
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-24  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#ifndef TestTestCase_HEADER
-#define TestTestCase_HEADER
-
-#include "Util/UtilAPI.h"
-#include "Util/UnitTest/TestCase.h"
-
-namespace Damkjer
-{
-
-class TestTestCase : public TestCase
-{
-public:
-   TestTestCase(int, char**);
-      //>
-      //<
-private:
-   TestTestCase(const TestTestCase&);
-   TestTestCase& operator=(const TestTestCase&);
-};
-
-}
-
-#endif
Index: mkjer/Util/UnitTest/test/TestUnitTest.vcxproj
===================================================================
--- Damkjer/Util/UnitTest/test/TestUnitTest.vcxproj	(revision 12)
+++ 	(revision )
@@ -1,452 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="DebugOMP|Win32">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="DebugOMP|x64">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|Win32">
-      <Configuration>OpenMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|x64">
-      <Configuration>OpenMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="TestTestCase.cpp" />
-    <ClCompile Include="test_TestCase.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="TestTestCase.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\Util.vcxproj">
-      <Project>{20fe2624-c64f-d61a-bd8f-1725a8e68a42}</Project>
-    </ProjectReference>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <Keyword>Win32Proj</Keyword>
-    <ProjectName>test_TestCase</ProjectName>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <AdditionalOptions>/wd4514 /wd4571 /wd4668 /wd4710 /wd4711 /wd4820 /wd4986 %(AdditionalOptions)</AdditionalOptions>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <SubSystem>Console</SubSystem>
-    </Link>
-    <PostBuildEvent>
-      <Command>setlocal
-
-@rem Perform the unit test
-echo Running Unit Test: $(ProjectName)
-set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-
-@rem Check for success
-if errorlevel 1 goto UnitTestFailed
-
-goto UnitTestPassed
-
-:UnitTestFailed
-echo [FAILED] - Unit Test: $(ProjectName)
-exit 1
-
-:UnitTestPassed
-echo [PASSED] - Unit Test: $(ProjectName)
-exit 0
-
-endlocal
-</Command>
-      <Message>
-      </Message>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
Index: mkjer/Util/UnitTest/test/TestUnitTest.vcxproj.filters
===================================================================
--- Damkjer/Util/UnitTest/test/TestUnitTest.vcxproj.filters	(revision 9)
+++ 	(revision )
@@ -1,26 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4010ed24-e68d-4e6e-97b0-8b8bb335aa86}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{0c039d31-de79-478b-9dc5-c3378145e52a}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="test_TestCase.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="TestTestCase.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="TestTestCase.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-  </ItemGroup>
-</Project>
Index: mkjer/Util/UnitTest/test/test_TestCase.cpp
===================================================================
--- Damkjer/Util/UnitTest/test/test_TestCase.cpp	(revision 12)
+++ 	(revision )
@@ -1,33 +1,0 @@
-//*****************************************************************************
-// FILE:        test_TestCase.cpp
-//
-//    Copyright (C)  2013 Kristian Damkjer.
-//
-// DESCRIPTION: 
-//
-// LIMITATIONS: 
-//
-// SOFTWARE HISTORY:
-//> 2012-JUL-26  K. Damkjer
-//               Initial Coding.
-//<
-//*****************************************************************************
-
-#include "Util/Exception/Exception.h"
-#include "TestTestCase.h"
-
-using namespace Damkjer;
-
-//*****************************************************************************
-// main
-//*****************************************************************************
-int main(int argc, char** argv)
-{
-   EXCEPTION_TRY("main(int, char**)");
-
-   TestTestCase driver(argc, argv);
-
-   return driver.execute();
-
-   EXCEPTION_CATCHALL;
-}
Index: mkjer/Util/Util.dox
===================================================================
--- Damkjer/Util/Util.dox	(revision 13)
+++ 	(revision )
@@ -1,48 +1,0 @@
-//*****************************************************************************
-// DIRECTORY: Util/Exception
-//>   General exception classes.
-//<
-//*****************************************************************************
-
-//*****************************************************************************
-// DIRECTORY: Util/Math
-//>   General mathematics utilities.
-//<
-//*****************************************************************************
-
-//*****************************************************************************
-// DIRECTORY: Util/MATLAB
-//>   Inter-process communication code for interfacing MATLAB and C++.
-//<
-//*****************************************************************************
-
-//*****************************************************************************
-// DIRECTORY: Util/SpatialIndexing
-//>   Multi-dimensional search data structures and algorithms.
-//<
-//*****************************************************************************
-
-//*****************************************************************************
-// DIRECTORY: Util/SpatialIndexing/Metrics
-//>   Definitions of metric spaces fulfilling the requirement that distances
-//    between points are constrained by the triangle inequality.
-//<
-//*****************************************************************************
-
-//*****************************************************************************
-// DIRECTORY: Util/SpatialIndexing/VpTree
-//>   Vantage point tree spatial indexing data structure and search algorithms.
-//<
-//*****************************************************************************
-
-//*****************************************************************************
-// DIRECTORY: Util/Streams
-//>   General stream handlers.
-//<
-//*****************************************************************************
-
-//*****************************************************************************
-// DIRECTORY: Util/UnitTest
-//>   Unit testing framework.
-//<
-//*****************************************************************************
Index: mkjer/Util/Util.vcxproj
===================================================================
--- Damkjer/Util/Util.vcxproj	(revision 15)
+++ 	(revision )
@@ -1,307 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="DebugOMP|Win32">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="DebugOMP|x64">
-      <Configuration>DebugOMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|Win32">
-      <Configuration>OpenMP</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="OpenMP|x64">
-      <Configuration>OpenMP</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="Dictionaries\SplayTree.h" />
-    <ClInclude Include="Dictionaries\SplayTree.hpp" />
-    <ClInclude Include="Exception\Exception.h" />
-    <ClInclude Include="LPt.h" />
-    <ClInclude Include="MATLAB\ClassHandle.h" />
-    <ClInclude Include="MATLAB\ClassHandle.hpp" />
-    <ClInclude Include="SpatialIndexing\Metrics\ChebyshevDistance.h" />
-    <ClInclude Include="SpatialIndexing\Metrics\EuclideanDistance.h" />
-    <ClInclude Include="SpatialIndexing\Metrics\ManhattanDistance.h" />
-    <ClInclude Include="SpatialIndexing\Metrics\Metrics.h" />
-    <ClInclude Include="SpatialIndexing\Metrics\MinkowskiDistance.h" />
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree.h" />
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree.hpp" />
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_Branch.h" />
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_Branch.hpp" />
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_Item.h" />
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_Leaf.h" />
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_Leaf.hpp" />
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_Node.h" />
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_ResultsCandidate.h" />
-    <ClInclude Include="Streams\BlockIndent.h" />
-    <ClInclude Include="Streams\FormatFilter.h" />
-    <ClInclude Include="Streams\ManipulatorBase.h" />
-    <ClInclude Include="UnitTest\TestCase.h" />
-    <ClInclude Include="UtilAPI.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="Exception\Exception.cpp" />
-    <ClCompile Include="LPt.cc" />
-    <ClCompile Include="Streams\BlockIndent.cpp" />
-    <ClCompile Include="Streams\FormatFilter.cpp" />
-    <ClCompile Include="UnitTest\TestCase.cpp" />
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <Keyword>Win32Proj</Keyword>
-    <ProjectName>Util</ProjectName>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <OutDir>$(SolutionDir)lib\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <DisableSpecificWarnings>4514;4571;4668;4710;4711;4820;4986;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <DisableSpecificWarnings>4514;4571;4668;4710;4711;4820;4986;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <DisableSpecificWarnings>4514;4571;4668;4710;4711;4820;4986;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugOMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <DisableSpecificWarnings>4514;4571;4668;4710;4711;4820;4986;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <DisableSpecificWarnings>4514;4571;4668;4710;4711;4820;4986;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <DisableSpecificWarnings>4514;4571;4668;4710;4711;4820;4986;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-    </ClCompile>
-    <Link>
-      <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <DisableSpecificWarnings>4514;4571;4668;4710;4711;4820;4986;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
-    <ClCompile>
-      <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <OpenMPSupport>true</OpenMPSupport>
-      <WarningLevel>EnableAllWarnings</WarningLevel>
-      <RuntimeTypeInfo>true</RuntimeTypeInfo>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <DisableSpecificWarnings>4514;4571;4668;4710;4711;4820;4986;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-    </Link>
-  </ItemDefinitionGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
Index: mkjer/Util/Util.vcxproj.filters
===================================================================
--- Damkjer/Util/Util.vcxproj.filters	(revision 15)
+++ 	(revision )
@@ -1,111 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4010ed24-e68d-4e6e-97b0-8b8bb335aa86}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{0c039d31-de79-478b-9dc5-c3378145e52a}</UniqueIdentifier>
-      <Extensions>h;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-    <Filter Include="Template Implementation Files">
-      <UniqueIdentifier>{62f4b789-a14a-43c6-90be-3878d8e102cf}</UniqueIdentifier>
-      <Extensions>hpp;ipp</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="MATLAB\ClassHandle.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\Metrics\Metrics.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="UtilAPI.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\Exception.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="UnitTest\TestCase.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Streams\ManipulatorBase.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Streams\BlockIndent.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Streams\FormatFilter.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\Metrics\EuclideanDistance.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\Metrics\ChebyshevDistance.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\Metrics\ManhattanDistance.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\Metrics\MinkowskiDistance.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree.hpp">
-      <Filter>Template Implementation Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_Branch.hpp">
-      <Filter>Template Implementation Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_Leaf.hpp">
-      <Filter>Template Implementation Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_Branch.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_Item.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_Leaf.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_Node.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="SpatialIndexing\VpTree\VpTree_ResultsCandidate.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="MATLAB\ClassHandle.hpp">
-      <Filter>Template Implementation Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Dictionaries\SplayTree.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Dictionaries\SplayTree.hpp">
-      <Filter>Template Implementation Files</Filter>
-    </ClInclude>
-    <ClInclude Include="LPt.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="Exception\Exception.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="UnitTest\TestCase.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Streams\BlockIndent.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Streams\FormatFilter.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="LPt.cc">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-</Project>
Index: mkjer/Util/UtilAPI.h
===================================================================
--- Damkjer/Util/UtilAPI.h	(revision 12)
+++ 	(revision )
@@ -1,50 +1,0 @@
-//*****************************************************************************
-// FILE: UtilAPI.h
-//
-// COPYRIGHT:
-//    Copyright (c) Kristian Damkjer 2013
-//
-// DESCRIPTION:
-//>   Macro definitions for the Util Library API.
-//<
-//
-// LIMITATIONS:
-//>   No known limitations.
-//<
-//
-// SOFTWARE HISTORY:
-//> 2013-JUL-26  K. Damkjer
-//     Initial Coding.
-//<
-//*****************************************************************************
-
-#ifndef UtilAPI_HEADER
-#define UtilAPI_HEADER
-
-//*****************************************************************************
-// MACRO: Util_API
-//>   Enable switching between exporting interfaces from a dynamic library and
-//    importing interfaces into a client application for the Util library API.
-//    This macro enables the explicit marking of modules that constitute the
-//    Util library API. We can then easily determine the correct action to take
-//    in the build process by defining a separate flag when building the
-//    library (Util_DLL).
-//<
-//*****************************************************************************
-#ifndef Util_API
-   #if _MSC_VER
-      // Building a Windows DLL
-      #if Util_DLL
-         // Building the library.
-         #define Util_API __declspec(dllexport)
-      #else
-         // Using the library.
-         #define Util_API __declspec(dllimport)
-      #endif
-   #else
-      // Other shared libraries.
-      #define Util_API
-   #endif
-#endif
-
-#endif
Index: Damkjer/Util/Widgets/timebar.m
===================================================================
--- Damkjer/Util/Widgets/timebar.m	(revision 12)
+++ Damkjer/Util/Widgets/timebar.m	(revision 0)
@@ -1,125 +1,58 @@
-% timebar   Create a time-based waitbar.
+%%TIMEBAR    Create a time-based waitbar.
+%   [HANDLE] = TIMEBAR(...) .
 %
-% File: timebar.m
-%
-% Description:
-%    This MATLAB function creates a waitbar dialog with an estimated time to
-%    completion based on linear extrapolation from number of processing steps
-%    completed, number of processing steps remaining and current elapsed time.
-%
-% Limitations:
-%    None.
-%
-% Synopsis:
-%    [handle] = timebar(step, steps, message, start, handle)
-%
-% Inputs:
-%    step     - Current processing step.
-%    steps    - Total steps in process.
-%    message  - Base message to be included in waitbar text.
-%    start    - Process start time.
-%    handle   - Figure handle for existing waitbar.
-%
-% Outputs:
-%    handle  - Figure handle for rendered timebar graphic.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    None.
-%
-% See Also:
-%    waitbar
-%
+%   See also WAITBAR.
 
-% Copyright (C)  2012 Kristian L. Damkjer.
-%
-% Software History:
-%    2012-AUG-29   K. Damkjer
-%       Initial Coding.
+%   Copyright 2012 Kristian Linn Damkjer
+function [handle] = timebar(step, steps, message, start, handle)
 
-%******************************************************************************
-% timebar
-%******************************************************************************
-function [handle] = timebar(step, steps, message, start, handle)
-   % Create a waitbar dialog with an estimated time to completion based on
-   % linear extrapolation from number of processing steps completed, number of 
-   % processing steps remaining and current elapsed time.
-   %
-   % Parameters:
-   %    step    - Current processing step.
-   %
-   %    steps   - Total steps in process.
-   %
-   %    message - Base message to be included in waitbar text.
-   %
-   %    start   - Process start time.
-   %
-   %    handle  - Figure handle for existing waitbar.
-   %
-   % Returns:
-   %    handle - Figure handle for rendered timebar graphic.
-
-step    = double(step);
-steps   = double(steps);
-elapsed = toc(start);
-total   = floor(elapsed/step*steps);
-elapsed = floor(elapsed);
-remain  = total-elapsed;
+try
+    
+step=double(step);
+steps=double(steps);
+elapsed=toc(start);
+total=floor(elapsed/step*steps);
+elapsed=floor(elapsed);
+remain=total-elapsed;
 
 % Construct total string
-tmsg = timeString(total);
+if (total > 7200)
+    tmsg=[num2str(floor(total/3600)) 'h'];
+elseif (total > 120)
+    tmsg=[num2str(floor(total/60)) 'm'];
+else
+    tmsg=[num2str(total) 's'];
+end
 
 % Construct elapsed string
-emsg = timeString(elapsed);
+if (elapsed > 7200)
+    emsg=[num2str(floor(elapsed/3600)) 'h'];
+elseif (elapsed > 120)
+    emsg=[num2str(floor(elapsed/60)) 'm'];
+else
+    emsg=[num2str(elapsed) 's'];
+end
 
 % Construct total string
-rmsg = timeString(remain);
+if (remain > 7200)
+    rmsg=[num2str(floor(remain/3600)) 'h'];
+elseif (remain > 120)
+    rmsg=[num2str(floor(remain/60)) 'm'];
+else
+    rmsg=[num2str(remain) 's'];
+end
 
-% Construct waitbar message
-wbmsg = [message emsg '/' tmsg ' (' rmsg ' remaining)'];
+if (nargin > 4 && all(ishghandle(handle, 'figure')))
+    waitbar(step/steps,handle,...
+        [message emsg '/' tmsg ' (' rmsg ' remaining)']);
+else
+    handle = waitbar(step/steps,...
+        [message emsg '/' tmsg ' (' rmsg ' remaining)']);
+end
 
-% Create a new waitbar if the handle is invalid or wasn't passed in. Otherwise
-% render to the valid figure handle.
-if (nargin > 4 && all(ishghandle(handle, 'figure')))
-    waitbar(step/steps, handle, wbmsg);
-else
-    handle = waitbar(step/steps, wbmsg);
+catch me
+    disp(me.identifier);
+    disp(me.message);
 end
 
 end
-
-%******************************************************************************
-% timeString
-%******************************************************************************
-function [message] = timeString(seconds)
-   % Create a human-readable,  order of magnitude appropriate interpretation of
-   % a time value.
-   %
-   % Parameters:
-   %    seconds - Time as decimal seconds.
-   %
-   % Returns:
-   %    message - Coarse order of magnitude interpretation of the seconds
-   %              value.
-
-   if (seconds > 7200)
-      message = [num2str(floor(seconds/3600)) 'h'];
-   elseif (seconds > 120)
-      message = [num2str(floor(seconds/60)) 'm'];
-   else
-      message = [num2str(seconds) 's'];
-   end
-% message = sprintf('%02d:%02d:%02d',...
-%                   floor(seconds/3600),...
-%                   mod(floor(seconds/60),60),...
-%                   floor(mod(seconds,60)));
-end
-
Index: Damkjer/applications/demo_curvcolor.m
===================================================================
--- Damkjer/applications/demo_curvcolor.m	(revision 12)
+++ Damkjer/applications/demo_curvcolor.m	(revision 0)
@@ -1,54 +1,9 @@
-% demo_curvcolor   Demonstrate point cloud curvature coloring.
+%%
+% DEMO_NORMCOLOR
 %
-% File: demo_curvcolor.m
+% Demonstrates the curvcolor function capability.
 %
-% Description:
-%    Demonstrate point cloud curvature coloring.
-%
-% Limitations:
-%    No known limitations.
-%
-% Synopsis:
-%    [] = demo_curvcolor()
-%
-% Inputs:
-%    None.
-%
-% Outputs:
-%    None.
-%
-% Toolbox requirements:
-%    None.
-%
-% Script requirements:
-%    None.
-%
-% Data requirements:
-%    None.
-%
-% References:
-%    None.
-%
-% See Also:
-%    None.
-%
-
-% Copyright (C)  2012 Kristian L. Damkjer.
-%
-% Software History:
-%    2012-AUG-29   K. Damkjer
-%       Initial Coding.
-
-%******************************************************************************
-% demo_curvcolor
-%******************************************************************************
 function demo_curvcolor
-   % Demonstrate point cloud curvature coloring. The sample point cloud is
-   % hard-coded to be the Armstrong-Enderby Sample LAS file. This can be
-   % changed to any desired sample point cloud manually.
-   %
-   % TODO: Parameterize the sample point cloud input.
-
-dataFile='1815-3_Armstrong-Enderby_Sample1.las';
+dataFile='Serpent Mound Model LAS Data.las';
 
 disp('Building MEX files...');
Index: Damkjer/applications/demo_dimcolor.m
===================================================================
--- Damkjer/applications/demo_dimcolor.m	(revision 6)
+++ Damkjer/applications/demo_dimcolor.m	(revision 0)
@@ -6,5 +6,4 @@
 function demo_dimcolor
 dataFile='Serpent Mound Model LAS Data.las';
-neighbors=20;
 
 disp('Building MEX files...');
@@ -12,35 +11,30 @@
 makeMath('p');
 makeVpTree('p');
-disp(['  ...done: ' timeFormat(toc(buildStart))]);
+disp(['  ...done: ' num2str(toc(buildStart)) ' s']);
 
-[pathstr,~,~] = fileparts(mfilename('fullpath'));
-[pathstr,~,~] = fileparts(pathstr);
+[path,~,~]=fileparts(mfilename('fullpath'));
 
-srcPath = fullfile(pathstr, 'data', 'source');
-outPath = fullfile(pathstr, 'data', 'results');
+srcPath = [path '/../data/source'];
+outPath = [path '/../data/results'];
 
 disp('Loading Data...');
 loadStart=tic;
-sourceData=LasFile(fullfile(srcPath, dataFile));
-disp(['  ...done: read ' num2str(size(sourceData.points,2)) ...
-      ' points in ' timeFormat(toc(loadStart))]);
+sourceData=LasFile([srcPath '/' dataFile]);
+disp(['  ...done: ' num2str(toc(loadStart)) ' s']);
 
 disp('Building Database...');
 dbStart=tic;
 database=VpTree(sourceData.points);
-disp(['  ...done: ' timeFormat(toc(dbStart))]);
+disp(['  ...done: ' num2str(toc(dbStart)) ' s']);
 
 disp('Colorizing by Inherent Dimensionality...');
 colorStart=tic;
-sourceData.color=dimcolor(sourceData.points,database,'n',neighbors);
-disp(['  ...done: evaluated ' num2str(size(sourceData.points,2)) ...
-      ' points in ' num2str(neighbors) '-point neighborhoods in ' ...
-      timeFormat(toc(colorStart))]);
+sourceData.color=dimcolor(sourceData.points,database,'n',27);
+disp(['  ...done: ' num2str(toc(colorStart)) ' s']);
 
-outFile=fullfile(outPath, 'dimcolor.las');
+outFile=[outPath '/dimcolor.las'];
 disp(['Saving Results to: ' outFile '...']);
 writeStart=tic;
 sourceData.saveTo(outFile);
-disp(['   ...done: wrote '  num2str(size(sourceData.points,2)) ...
-      ' points in ' timeFormat(toc(writeStart))]);
+disp(['   ...done: ' num2str(toc(writeStart)) ' s']);
 end
Index: Damkjer/applications/demo_normcolor.m
===================================================================
--- Damkjer/applications/demo_normcolor.m	(revision 12)
+++ Damkjer/applications/demo_normcolor.m	(revision 0)
@@ -5,5 +5,5 @@
 %
 function demo_normcolor
-dataFile='1815-3_Armstrong-Enderby_Sample1.las';
+dataFile='Serpent Mound Model LAS Data.las';
 
 disp('Building MEX files...');
Index: mkjer/applications/demo_spatial_analyze.m
===================================================================
--- Damkjer/applications/demo_spatial_analyze.m	(revision 12)
+++ 	(revision )
@@ -1,50 +1,0 @@
-%%
-% DEMO_SPATIAL_ANALYZE
-%
-% Demonstrates the spatial analyzer function capability.
-%
-function demo_spatial_analyze
-%dataFile='Serpent Mound Model LAS Data.las';
-dataFile='1815-3_Armstrong-Enderby_Sample1.las';
-neighbors=20;
-%counts=10:20;
-
-disp('Building MEX files...');
-buildStart=tic;
-makeMath('p');
-makeVpTree('p');
-disp(['  ...done: ' num2str(toc(buildStart)) 's']);
-
-[path,~,~]=fileparts(mfilename('fullpath'));
-
-srcPath = [path '/../data/source'];
-outPath = [path '/../data/results'];
-
-disp('Loading Data...');
-loadStart=tic;
-sourceData=LasFile([srcPath '/' dataFile]);
-disp(['  ...done: read ' num2str(size(sourceData.points,2)) ' points in ' ...
-      num2str(toc(loadStart)) 's']);
-
-disp('Building Database...');
-dbStart=tic;
-database=VpTree(sourceData.points);
-disp(['  ...done: ' num2str(toc(dbStart)) 's']);
-
-disp('Performing Spatial Analysis...');
-resultsStart=tic;
-results=spanalyze(sourceData.points,database,'n',neighbors);
-%results=spanalyze(sourceData.points,database,'c',counts);
-disp(['  ...done: evaluated ' num2str(size(sourceData.points,2)) ' points in ' ...
-      num2str(neighbors) '-point neighborhoods in ' ...
-      num2str(toc(resultsStart)) 's']);
-
-sourceData.color=(uint16(double(intmax('uint16'))*results.dimensionality));
-   
-outFile=[outPath '/dimcolor.las'];
-disp(['Saving Results to: ' outFile '...']);
-writeStart=tic;
-sourceData.saveTo(outFile);
-disp(['   ...done: wrote '  num2str(size(sourceData.points,2)) ' points in ' ...
-      num2str(toc(writeStart)) 's']);
-end
Index: mkjer/config/doxyfile.txt
===================================================================
--- Damkjer/config/doxyfile.txt	(revision 13)
+++ 	(revision )
@@ -1,1948 +1,0 @@
-	# Doxyfile 1.8.4
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project.
-#
-# All text after a double hash (##) is considered a comment and is placed
-# in front of the TAG it is preceding .
-# All text after a hash (#) is considered a comment and will be ignored.
-# The format is:
-#       TAG = value [value, ...]
-# For lists items can also be appended using:
-#       TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ").
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING      = UTF-8
-
-# The PROJECT_NAME tag is a single word (or sequence of words) that should
-# identify the project. Note that if you do not use Doxywizard you need
-# to put quotes around the project name if it contains spaces.
-
-PROJECT_NAME           = "Damkjer Research"
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER         =
-
-# Using the PROJECT_BRIEF tag one can provide an optional one line description
-# for a project that appears at the top of each page and should give viewer
-# a quick idea about the purpose of the project. Keep the description short.
-
-PROJECT_BRIEF          = "Kristian Damkjer's Doctoral Research Code"
-
-# With the PROJECT_LOGO tag one can specify an logo or icon that is
-# included in the documentation. The maximum height of the logo should not
-# exceed 55 pixels and the maximum width should not exceed 200 pixels.
-# Doxygen will copy the logo to the output directory.
-
-PROJECT_LOGO           =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY       = docs
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS         = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Latvian, Lithuanian, Norwegian, Macedonian,
-# Persian, Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic,
-# Slovak, Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE        = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC      = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF           = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF       =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-# Defaul NO
-ALWAYS_DETAILED_SEC    = YES
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB  = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES        = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip. Note that you specify absolute paths here, but also
-# relative paths, which will be relative from the directory where doxygen is
-# started.
-
-STRIP_FROM_PATH        =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH    =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful if your file system
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES            = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-# Default NO
-JAVADOC_AUTOBRIEF      = YES
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-# Default NO
-QT_AUTOBRIEF           = YES
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS           = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES  = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE               = 3
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES                =
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding
-# "class=itcl::class" will allow you to use the command class in the
-# itcl::class meaning.
-
-TCL_SUBST              =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C  = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA   = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN   = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL   = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given
-# extension. Doxygen has a built-in mapping, but you can override or extend it
-# using this tag. The format is ext=language, where ext is a file extension,
-# and language is one of the parsers supported by doxygen: IDL, Java,
-# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C,
-# C++. For instance to make doxygen treat .inc files as Fortran files (default
-# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note
-# that for custom extensions you also need to set FILE_PATTERNS otherwise the
-# files are not read by doxygen.
-
-#EXTENSION_MAPPING      =
-EXTENSION_MAPPING      = m=C++
-
-# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
-# comments according to the Markdown format, which allows for more readable
-# documentation. See http://daringfireball.net/projects/markdown/ for details.
-# The output of markdown processing is further processed by doxygen, so you
-# can mix doxygen, HTML, and XML commands with Markdown formatting.
-# Disable only in case of backward compatibilities issues.
-
-MARKDOWN_SUPPORT       = YES
-
-# When enabled doxygen tries to link words that correspond to documented
-# classes, or namespaces to their corresponding documentation. Such a link can
-# be prevented in individual cases by by putting a % sign in front of the word
-# or globally by setting AUTOLINK_SUPPORT to NO.
-
-AUTOLINK_SUPPORT       = YES
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also makes the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-# Default NO
-BUILTIN_STL_SUPPORT    = YES
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT        = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT            = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate
-# getter and setter methods for a property. Setting this option to YES (the
-# default) will make doxygen replace the get and set methods by a property in
-# the documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT   = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC   = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING            = YES
-
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
-# unions are shown inside the group in which they are included (e.g. using
-# @ingroup) instead of on a separate page (for HTML and Man pages) or
-# section (for LaTeX and RTF).
-
-INLINE_GROUPED_CLASSES = NO
-
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
-# unions with only public data fields or simple typedef fields will be shown
-# inline in the documentation of the scope in which they are defined (i.e. file,
-# namespace, or group documentation), provided this scope is documented. If set
-# to NO (the default), structs, classes, and unions are shown on a separate
-# page (for HTML and Man pages) or section (for LaTeX and RTF).
-
-INLINE_SIMPLE_STRUCTS  = NO
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT   = NO
-
-# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
-# cache is used to resolve symbols given their name and scope. Since this can
-# be an expensive process and often the same symbol appear multiple times in
-# the code, doxygen keeps a cache of pre-resolved symbols. If the cache is too
-# small doxygen will become slower. If the cache is too large, memory is wasted.
-# The cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid
-# range is 0..9, the default is 0, corresponding to a cache size of 2^16 = 65536
-# symbols.
-
-LOOKUP_CACHE_SIZE      = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES
-
-# Default NO
-EXTRACT_ALL            = NO
-#EXTRACT_ALL            = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-#EXTRACT_PRIVATE        = NO
-EXTRACT_PRIVATE        = YES
-
-# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
-# scope will be included in the documentation.
-
-#EXTRACT_PACKAGE        = NO
-EXTRACT_PACKAGE        = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-#EXTRACT_STATIC         = NO
-EXTRACT_STATIC         = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES  = YES
-#EXTRACT_LOCAL_CLASSES  = NO
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-#EXTRACT_LOCAL_METHODS  = NO
-EXTRACT_LOCAL_METHODS  = YES
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespaces are hidden.
-
-#EXTRACT_ANON_NSPACES   = NO
-EXTRACT_ANON_NSPACES   = YES
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS     = NO
-#HIDE_UNDOC_MEMBERS     = YES
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES     = NO
-#HIDE_UNDOC_CLASSES     = YES
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS  = NO
-#HIDE_FRIEND_COMPOUNDS  = YES
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS      = NO
-#HIDE_IN_BODY_DOCS      = YES
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-#INTERNAL_DOCS          = NO
-INTERNAL_DOCS          = YES
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES       = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES       = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES     = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES   = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO            = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-#SORT_MEMBER_DOCS       = YES
-SORT_MEMBER_DOCS       = NO
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS        = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
-# will sort the (brief and detailed) documentation of class members so that
-# constructors and destructors are listed first. If set to NO (the default)
-# the constructors will appear in the respective orders defined by
-# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
-# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
-# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES       = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME     = NO
-
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
-# do proper type resolution of all parameters of a function it will reject a
-# match between the prototype and the implementation of a member function even
-# if there is only one candidate or it is obvious which candidate to choose
-# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
-# will still accept a match between prototype and implementation in such cases.
-
-STRICT_PROTO_MATCHING  = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST      = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST      = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST       = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if section-label ... \endif
-# and \cond section-label ... \endcond blocks.
-
-ENABLED_SECTIONS       =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or macro consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and macros in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES  = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES        = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES             = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES        = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER    =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. To create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option.
-# You can optionally specify a file name after the option, if omitted
-# DoxygenLayout.xml will be used as the name of the layout file.
-
-LAYOUT_FILE            =
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files
-# containing the references data. This must be a list of .bib files. The
-# .bib extension is automatically appended if omitted. Using this command
-# requires the bibtex tool to be installed. See also
-# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
-# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
-# feature you need bibtex and perl available in the search path. Do not use
-# file names with spaces, bibtex cannot handle them.
-
-CITE_BIB_FILES         = Util.bib
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET                  = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS               = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED   = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR      = YES
-
-# The WARN_NO_PARAMDOC option can be enabled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-#WARN_NO_PARAMDOC       = NO
-WARN_NO_PARAMDOC       = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-# WARN_FORMAT            = "$file:$line: $text"
-WARN_FORMAT            = "$file($line): $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE           =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT                  =
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING         = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
-# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
-# *.f90 *.f *.for *.vhd *.vhdl
-
-FILE_PATTERNS          =
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-# Default NO
-RECURSIVE              = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should be
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-# Note that relative paths are relative to the directory from which doxygen is
-# run.
-
-EXCLUDE                = includes
-
-# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
-# directories that are symbolic links (a Unix file system feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS       = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-# Default ""
-# Add */test/* back into the space delimited list
-#EXCLUDE_PATTERNS       = */test/* *.m
-EXCLUDE_PATTERNS       = */test/*
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS        =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH           =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS       =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE      = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH             =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be ignored.
-# Note that the filter must not add or remove lines; it is applied before the
-# code is scanned, but not when the output code is generated. If lines are added
-# or removed, the anchors will not be placed correctly.
-
-#INPUT_FILTER           = ""
-INPUT_FILTER           = "config\doxyfilter.pl"
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty or if
-# non of the patterns match the file name, INPUT_FILTER is applied.
-
-FILTER_PATTERNS        = *.m=config\m2cpp.pl
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES    = NO
-
-# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
-# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
-# and it is also possible to disable source filtering for a specific pattern
-# using *.ext= (so without naming a filter). This option only has effect when
-# FILTER_SOURCE_FILES is enabled.
-
-FILTER_SOURCE_PATTERNS =
-
-# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that
-# is part of the input, its contents will be placed on the main page
-# (index.html). This can be useful if you have a project on for instance GitHub
-# and want reuse the introduction page also for the doxygen output.
-
-USE_MDFILE_AS_MAINPAGE =
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER         = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES         = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C, C++ and Fortran comments will always remain visible.
-
-STRIP_CODE_COMMENTS    = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-# Default NO
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-# Default NO
-REFERENCES_RELATION    = YES
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS              = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS       = YES
-
-# If CLANG_ASSISTED_PARSING is set to YES, then doxygen will use the clang parser
-# for more acurate parsing at the cost of reduced performance. This can be
-# particularly helpful with template rich C++ code for which doxygen's built-in
-# parser lacks the necessairy type information.
-
-CLANG_ASSISTED_PARSING = NO
-
-# If clang assisted parsing is enabled you can provide the compiler with command
-# line options that you would normally use when invoking the compiler. Note that
-# the include paths will already be set by doxygen for the files and directories
-# specified at INPUT and INCLUDE_PATH.
-
-CLANG_OPTIONS          =
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX     = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX    = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-#IGNORE_PREFIX          = 
-IGNORE_PREFIX          = sole the
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML          = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT            = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION    = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header. Note that when using a custom header you are responsible
-#  for the proper inclusion of any scripts and style sheets that doxygen
-# needs, which is dependent on the configuration options used.
-# It is advised to generate a default header using "doxygen -w html
-# header.html footer.html stylesheet.css YourConfigFile" and then modify
-# that header. Note that the header is subject to change so you typically
-# have to redo this when upgrading to a newer version of doxygen or when
-# changing the value of configuration settings such as GENERATE_TREEVIEW!
-
-HTML_HEADER            =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER            =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If left blank doxygen will
-# generate a default style sheet. Note that it is recommended to use
-# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this
-# tag will in the future become obsolete.
-
-HTML_STYLESHEET        =
-
-# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
-# user-defined cascading style sheet that is included after the standard
-# style sheets created by doxygen. Using this option one can overrule
-# certain style aspects. This is preferred over using HTML_STYLESHEET
-# since it does not replace the standard style sheet and is therefor more
-# robust against future updates. Doxygen will copy the style sheet file to
-# the output directory.
-
-HTML_EXTRA_STYLESHEET  =
-
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the HTML output directory. Note
-# that these files will be copied to the base HTML output directory. Use the
-# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that
-# the files will be copied as-is; there are no commands or markers available.
-
-HTML_EXTRA_FILES       =
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
-# Doxygen will adjust the colors in the style sheet and background images
-# according to this color. Hue is specified as an angle on a colorwheel,
-# see http://en.wikipedia.org/wiki/Hue for more information.
-# For instance the value 0 represents red, 60 is yellow, 120 is green,
-# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
-# The allowed range is 0 to 359.
-
-HTML_COLORSTYLE_HUE    = 220
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
-# the colors in the HTML output. For a value of 0 the output will use
-# grayscales only. A value of 255 will produce the most vivid colors.
-
-HTML_COLORSTYLE_SAT    = 100
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
-# the luminance component of the colors in the HTML output. Values below
-# 100 gradually make the output lighter, whereas values above 100 make
-# the output darker. The value divided by 100 is the actual gamma applied,
-# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
-# and 100 does not change the gamma.
-
-HTML_COLORSTYLE_GAMMA  = 80
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP         = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded.
-
-HTML_DYNAMIC_SECTIONS  = NO
-
-# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
-# entries shown in the various tree structured indices initially; the user
-# can expand and collapse entries dynamically later on. Doxygen will expand
-# the tree to such a level that at most the specified number of entries are
-# visible (unless a fully collapsed tree already exceeds this amount).
-# So setting the number of entries 1 will produce a full collapsed tree by
-# default. 0 is a special value representing an infinite number of entries
-# and will result in a full expanded tree by default.
-
-HTML_INDEX_NUM_ENTRIES = 100
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
-# for more information.
-
-GENERATE_DOCSET        = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME        = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID       = org.doxygen.Project
-
-# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely
-# identify the documentation publisher. This should be a reverse domain-name
-# style string, e.g. com.mycompany.MyDocSet.documentation.
-
-DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
-
-# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
-
-DOCSET_PUBLISHER_NAME  = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP      = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE               =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION           =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI           = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING     =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC             = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND             = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
-# that can be used as input for Qt's qhelpgenerator to generate a
-# Qt Compressed Help (.qch) of the generated HTML documentation.
-
-GENERATE_QHP           = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE               =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE          = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER     = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
-# add. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME   =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
-# Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS  =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
-# Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS  =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION           =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-#  will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
-# the help appears.
-
-GENERATE_ECLIPSEHELP   = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID         = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
-# at top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it. Since the tabs have the same information as the
-# navigation tree you can set this option to NO if you already set
-# GENERATE_TREEVIEW to YES.
-
-DISABLE_INDEX          = NO
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-# Since the tree basically has the same information as the tab index you
-# could consider to set DISABLE_INDEX to NO when enabling this option.
-
-GENERATE_TREEVIEW      = NO
-
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
-# (range [0,1..20]) that doxygen will group on one line in the generated HTML
-# documentation. Note that a value of 0 will completely suppress the enum
-# values from appearing in the overview section.
-
-ENUM_VALUES_PER_LINE   = 4
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH         = 250
-
-# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
-# links to external symbols imported via tag files in a separate window.
-
-EXT_LINKS_IN_WINDOW    = NO
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE       = 10
-
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are
-# not supported properly for IE 6.0, but are supported on all modern browsers.
-# Note that when changing this option you need to delete any form_*.png files
-# in the HTML output before the changes have effect.
-
-FORMULA_TRANSPARENT    = YES
-
-# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
-# (see http://www.mathjax.org) which uses client side Javascript for the
-# rendering instead of using prerendered bitmaps. Use this if you do not
-# have LaTeX installed or if you want to formulas look prettier in the HTML
-# output. When enabled you may also need to install MathJax separately and
-# configure the path to it using the MATHJAX_RELPATH option.
-
-#Default NO
-USE_MATHJAX            = YES
-
-# When MathJax is enabled you can set the default output format to be used for
-# the MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and
-# SVG. The default value is HTML-CSS, which is slower, but has the best
-# compatibility.
-
-# Default HTML-CSS
-MATHJAX_FORMAT         = HTML-CSS
-
-# When MathJax is enabled you need to specify the location relative to the
-# HTML output directory using the MATHJAX_RELPATH option. The destination
-# directory should contain the MathJax.js script. For instance, if the mathjax
-# directory is located at the same level as the HTML output directory, then
-# MATHJAX_RELPATH should be ../mathjax. The default value points to
-# the MathJax Content Delivery Network so you can quickly see the result without
-# installing MathJax.
-# However, it is strongly recommended to install a local
-# copy of MathJax from http://www.mathjax.org before deployment.
-
-# Default http://cdn.mathjax.org/mathjax/latest/
-MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest/
-
-# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
-# names that should be enabled during MathJax rendering.
-
-MATHJAX_EXTENSIONS     = 
-
-# The MATHJAX_CODEFILE tag can be used to specify a file with javascript
-# pieces of code that will be used on startup of the MathJax code.
-
-MATHJAX_CODEFILE       = 
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box
-# for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using
-# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
-# (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE           = YES
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a web server instead of a web client using Javascript.
-# There are two flavours of web server based search depending on the
-# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
-# searching and an index file used by the script. When EXTERNAL_SEARCH is
-# enabled the indexing and searching needs to be provided by external tools.
-# See the manual for details.
-
-SERVER_BASED_SEARCH    = NO
-
-# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP
-# script for searching. Instead the search results are written to an XML file
-# which needs to be processed by an external indexer. Doxygen will invoke an
-# external search engine pointed to by the SEARCHENGINE_URL option to obtain
-# the search results. Doxygen ships with an example indexer (doxyindexer) and
-# search engine (doxysearch.cgi) which are based on the open source search
-# engine library Xapian. See the manual for configuration details.
-
-EXTERNAL_SEARCH        = NO
-
-# The SEARCHENGINE_URL should point to a search engine hosted by a web server
-# which will returned the search results when EXTERNAL_SEARCH is enabled.
-# Doxygen ships with an example search engine (doxysearch) which is based on
-# the open source search engine library Xapian. See the manual for configuration
-# details.
-
-SEARCHENGINE_URL       =
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
-# search data is written to a file for indexing by an external tool. With the
-# SEARCHDATA_FILE tag the name of this file can be specified.
-
-SEARCHDATA_FILE        = searchdata.xml
-
-# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the
-# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
-# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
-# projects and redirect the results back to the right project.
-
-EXTERNAL_SEARCH_ID     =
-
-# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
-# projects other than the one defined by this configuration file, but that are
-# all added to the same external search index. Each project needs to have a
-# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id
-# of to a relative location where the documentation can be found.
-# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ...
-
-EXTRA_SEARCH_MAPPINGS  =
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX         = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT           = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME         = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME     = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX          = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, letter, legal and
-# executive. If left blank a4 will be used.
-
-# Default a4
-PAPER_TYPE             = letter
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES         = bm
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER           =
-
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
-# the generated latex document. The footer should contain everything after
-# the last chapter. If it is left blank doxygen will generate a
-# standard footer. Notice: only use this tag if you know what you are doing!
-
-LATEX_FOOTER           =
-
-# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images
-# or other source files which should be copied to the LaTeX output directory.
-# Note that the files will be copied as-is; there are no commands or markers
-# available.
-
-LATEX_EXTRA_FILES      =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS         = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX           = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE        = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES     = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include
-# source code with syntax highlighting in the LaTeX output.
-# Note that which sources are shown also depends on other settings
-# such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE      = NO
-
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
-# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
-# http://en.wikipedia.org/wiki/BibTeX for more info.
-
-LATEX_BIB_STYLE        = plain
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF           = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT             = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF            = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS         = NO
-
-# Load style sheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE    =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE    =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN           = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT             = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION          = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS              = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML           = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT             = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA             =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD                =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING     = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the DOCBOOK output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_DOCBOOK tag is set to YES Doxygen will generate DOCBOOK files
-# that can be used to generate PDF.
-
-GENERATE_DOCBOOK       = NO
-
-# The DOCBOOK_OUTPUT tag is used to specify where the DOCBOOK pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
-# front of it. If left blank docbook will be used as the default path.
-
-DOCBOOK_OUTPUT         = docbook
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF   = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD       = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX          = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY         = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING   = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-# MACRO_EXPANSION        = NO
-MACRO_EXPANSION        = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-# EXPAND_ONLY_PREDEF     = NO
-EXPAND_ONLY_PREDEF     = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# pointed to by INCLUDE_PATH will be searched when a #include is found.
-
-SEARCH_INCLUDES        = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH           =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS  =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED             = __declspec(x)=    \
-                         __attribute(x)__= \
-						 _WIN64 \
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition that
-# overrules the definition found in the source code.
-
-EXPAND_AS_DEFINED      =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all references to function-like macros
-# that are alone on a line, have an all uppercase name, and do not end with a
-# semicolon, because these will confuse the parser if not removed.
-
-SKIP_FUNCTION_MACROS   = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles. For each
-# tag file the location of the external documentation should be added. The
-# format of a tag file without this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths
-# or URLs. Note that each tag file must have a unique name (where the name does
-# NOT include the path). If a tag file is not located in the directory in which
-# doxygen is run, you must also specify the path to the tagfile here.
-
-TAGFILES               =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE       =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS           = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS        = YES
-
-# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed
-# in the related pages index. If set to NO, only the current project's
-# pages will be listed.
-
-EXTERNAL_PAGES         = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-# PERL_PATH              = /usr/bin/perl
-PERL_PATH              = "C:\Program Files\MATLAB\R2012a\sys\perl\win32\bin\perl"
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option also works with HAVE_DOT disabled, but it is recommended to
-# install and use dot, since it yields more powerful graphs.
-
-CLASS_DIAGRAMS         = YES
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH            =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-#HIDE_UNDOC_RELATIONS   = YES
-HIDE_UNDOC_RELATIONS = NO
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-# Default NO
-HAVE_DOT               = YES
-
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
-# allowed to run in parallel. When set to 0 (the default) doxygen will
-# base this on the number of processors available in the system. You can set it
-# explicitly to a value larger than 0 to get control over the balance
-# between CPU load and processing speed.
-
-DOT_NUM_THREADS        = 0
-
-# By default doxygen will use the Helvetica font for all dot files that
-# doxygen generates. When you want a differently looking font you can specify
-# the font name using DOT_FONTNAME. You need to make sure dot is able to find
-# the font, which can be done by putting it in a standard location or by setting
-# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
-# directory containing the font.
-
-DOT_FONTNAME           = Helvetica
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE           = 10
-
-# By default doxygen will tell dot to use the Helvetica font.
-# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
-# set the path where dot can find it.
-
-DOT_FONTPATH           =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH            = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH    = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS           = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-# Maybe set this to YES
-UML_LOOK               = NO
-
-# If the UML_LOOK tag is enabled, the fields and methods are shown inside
-# the class node. If there are many fields or methods and many nodes the
-# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
-# threshold limits the number of items for each type to make the size more
-# manageable. Set this to 0 for no limit. Note that the threshold may be
-# exceeded by 50% before the limit is enforced.
-
-UML_LIMIT_NUM_FIELDS   = 10
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-# Default NO
-TEMPLATE_RELATIONS     = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH          = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH      = YES
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-# Default NO
-CALL_GRAPH             = YES
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-# Default NO
-CALLER_GRAPH           = YES
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will generate a graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY    = YES
-
-# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH        = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are svg, png, jpg, or gif.
-# If left blank png will be used. If you choose svg you need to set
-# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
-# visible in IE 9+ (other browsers do not have this requirement).
-
-DOT_IMAGE_FORMAT       = png
-
-# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
-# enable generation of interactive SVG images that allow zooming and panning.
-# Note that this requires a modern browser other than Internet Explorer.
-# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
-# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
-# visible. Older versions of IE do not have SVG support.
-
-INTERACTIVE_SVG        = NO
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH               = "C:\Program Files (x86)\Graphviz2.32\bin"
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS           =
-
-# The MSCFILE_DIRS tag can be used to specify one or more directories that
-# contain msc files that are included in the documentation (see the
-# \mscfile command).
-
-MSCFILE_DIRS           =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES    = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH    = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT        = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS      = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND        = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP            = YES
Index: mkjer/config/doxyfilter.pl
===================================================================
--- Damkjer/config/doxyfilter.pl	(revision 13)
+++ 	(revision )
@@ -1,145 +1,0 @@
-##############################################################################
-## FILE:              doxygen-filter
-##
-##    Copyright (C) 2006 Harris Corporation.  All rights reserved.
-##
-## DESCRIPTION:       Filters the input files to translate Origin style
-##                    documentation into Doxygen style.
-##
-## LIMITATIONS:       Only really works on one file at a time.
-##
-## SOFTWARE HISTORY:
-##
-##  19JAN06 932D PTR#06427-IPL  S. Minster
-##               Initial delivery.
-##  09APR07 932D PTR#07441-IPL  S. Minster
-##               Use doxygen tags instead of HTML.
-##  30JUN08 956F PTR#10111-IPL  S. Minster
-##               Improved filter to better mark code sections.
-##############################################################################
-
-$state = 0;
-$swhist = 0;
-$filehead = 0;
-$isNote = 0;
-$isBug = 0;
-$isWarn = 0;
-$isAttn = 0;
-$isPre = 0;
-$isInv = 0;
-$isPost = 0;
-$isFormula = 0;
-
-my $extraClassInfo = "";
-if (@ARGV)
-{
-  $ARGV[0] =~ s/\\/\//g;
-  my $fullpath = $ARGV[0];
-  my ($path, $file) = ($fullpath =~ /Damkjer\/(.*\/([^\/]+))$/);
-
-  if ($path and $file)
-  {
-    $extraClassInfo = "$file \"$path\"";
-  }
-}
-
-while (<>)
-{
-  $swhist = 1 if (/SOFTWARE HISTORY/);
-
-  if ($isFormula)
-  {
-     s|^\s*//||;
-	 s|\\bm\{|\\boldsymbol\{|g;
-	 $isFormula = 0 if ($isFormula && m|\\f\]|);
-  }
-  if ($filehead)
-  {
-    if (m|//\s+DESCRIPTION|)
-	{
-        $filehead = 0;
-    }
-	else
-	{
-     s|.+||; chomp;
-    }
-  }
-  if ($swhist && /^\/\/\>/)
-  {
-    $swhist = 0;
-  }
-  elsif ($state == 0)
-  {
-    if (s|^//\>\s*(\S+\|\n)|//\! $1|)
-    {
-      $state = 1;
-    }
-    elsif (s|//\>\s*(\S+\|\n)|//\!\< $1|)
-    {
-      $state = 1;
-    }
-
-    s|//\s+CLASS:\s+(\S+)|//\! \\class $1 $extraClassInfo|;
-    s|//\s+FUNCTOR:\s+(\S+)|//\! \\class $1 $extraClassInfo|;
-    s|//\s+DIRECTORY:\s+(\S+)|//\! \\dir $1|;
-    s|//\s+ENUMERATION:\s+(\S+)|//\! \\enum $1|;
-    s|//\s+NAMESPACE:\s+(\S+)|//\! \\namespace $1|;
-
-    $filehead = 1 if (m|//\s+FILE:|);
-    s|//\s+FILE:\s+(\S+)|//\! \\file $1|;
-    s"//\s+DESCRIPTION:(.*|$)"//\! $1";
-    $isNote = 1 if (s"//\s+LIMITATIONS:(.*|$)"//\! \\note $1");
-    s|^\s*//.*Copyright.*$||;
-    s|^\s*//\s*$||;
-  }
-  elsif ($state == 1)
-  {
-    if (!s/^(\s*)\/\/( |$)/$1\/\/\!$2/)
-    {
-      # <pre> seems to strip C++ comments from the output
-      # According to bug 315006, this should be fixed, but I saw this error in 1.5.1:
-      # http://gcsd.harris.com/orgs/programs/origin/doxygen/3.11/html/d7/d22/classTimer.html#_details
-      # See the bug report for the potential workaround:
-      # http://bugzilla.gnome.org/show_bug.cgi?id=315006
-      $state = 2 if (s|^(\s*)//\-|$1//! \\code\n$1//!|);
-      $state = 0 if (s|\/\/<|\/\/\!|);
-
-      if (!$state)
-      {
-        $isNote = 0;
-        $isBug = 0;
-        $isWarn = 0;
-        $isAttn = 0;
-        $isPre = 0;
-        $isInv = 0;
-        $isPost = 0;
-      }
-    }
-    else
-    {
-      s|\s+->\s+| \&rarr\; |;
-      s|\s+<-\s+| \&larr\; |;
-      s|\s+<->\s+| \&harr\; |;
-
-      s|^\s*//\!\s*$|//\! \\note\n| if ($isNote);
-      s|^\s*//\!\s*$|//\! \\bug\n| if ($isBug);
-      s|^\s*//\!\s*$|//\! \\warning\n| if ($isWarn);
-      s|^\s*//\!\s*$|//\! \\attention\n| if ($isAttn);
-      s|^\s*//\!\s*$|//\! \\pre\n| if ($isPre);
-      s|^\s*//\!\s*$|//\! \\inv\n| if ($isInv);
-      s|^\s*//\!\s*$|//\! \\post\n| if ($isPost);
-    }
-  }
-  elsif ($state == 2)
-  {
-    if (!s|//\-|//!|)
-    {
-      $state = 1 if (s/(\s*)\/\/( |$)/$1\/\/\! \\endcode\n$1\/\/\!$2/);
-      $state = 0 if (s|//<|//\! \\endcode|);
-    }
-  }
-
-  $isFormula = 1 if (m|\\f\[| && !m|\\f\]|);
-
-  print;
-}
Index: mkjer/config/m2cpp.pl
===================================================================
--- Damkjer/config/m2cpp.pl	(revision 13)
+++ 	(revision )
@@ -1,1054 +1,0 @@
-##############################################################################
-## FILE:              m2cpp.pl
-##
-##    Copyright (C) 2013 Harris Corporation.  All rights reserved.
-##
-## DESCRIPTION:       
-##
-## LIMITATIONS:       Only really works on one file at a time.
-##
-## SOFTWARE HISTORY:
-##
-##############################################################################
-
-use strict;
-use warnings;
-
-use Cwd 'abs_path';
-
-sub tee;
-
-my $fullFile = undef; # The full file name passed to the script.
-my @fileList = ();    # Allow for classes defined in multiple files.
-my $output = "";      # Aggregate transformed text into $output.
-
-if ($#ARGV != 0)
-{
-   die "Argument must contain filename $#ARGV"
-}
-else
-{
-  $fullFile=abs_path($ARGV[0]);
-}
-
-# debug
-my $filtered = "$fullFile.flt";
-#my $out = "";
-open (my $out, '>', $filtered) or die "unable to open debug output file, $filtered: $!";
-
-# define MATLAB file grammar
-my $bolComment     = "^\\s*\[%\]+\\s*";
-my $identifier     = "[_a-zA-Z]\\w*";
-my $fqIdentifier   = "$identifier(?:\\.$identifier)*";
-my $fqMetaIdent    = "[?]$fqIdentifier";
-my $metaList       = "(?:$fqMetaIdent|\{(?:$fqMetaIdent\\s*(?:,\\s*$fqMetaIdent\\s*)*)?\})";
-my $superclassList = "$fqIdentifier(?:\\s*&\\s*$fqIdentifier)*";
-my $attrValue      = "[\\?\\w.]+";
-my $attrValueList  = "(?:$attrValue|\{\\s*(?:$attrValue\\s*(?:,\\s*$attrValue\\s*)*)?\\s*\})";
-my $attrItem       = "\\w+(?:\\s*=\\s*$attrValueList)?";
-my $attrList       = "\\(\\s*(?:$attrItem\\s*(?:,\\s*$attrItem\\s*)*)?\\s*\\)";
-my $argItem        = "(?:$identifier|~)";
-my $argList        = "\\(\\s*(?:$argItem\\s*(?:,\\s*$argItem\\s*)*)?\\s*\\)";
-my $returns        = "[\\[\\w,\\s\\]]+";
-
-#***
-# Determine if there is a special structure associated with the m file. MATLAB
-# provides two special folder constructs in the context of class definitions.
-#
-# 1. @-folders: allow for classes to be defined in multiple files. The @-folder
-#               is contained by a path folder, but is not on the path itself.
-#               The folder must contain a class definition file of the same
-#               name.
-# 2. +-folders: allow for package definition. Packages impose a namespace.
-#***
-
-my $packageStr = "";
-my @packages = ();
-my $inClassFolder = 0;
-
-if ($fullFile =~ /(?:[+]?([\w\-]+)[\/\\])+/)
-{
-   $packageStr = $fullFile;
-   $packageStr =~ s/(?:^|[\/\\])[^\/\\]*$//g;
-   $packageStr =~ s/(?:^|[\/\\])[^+\/\\][^\/\\]*//g;
-   $packageStr =~ s/[+]([^\/\\]+)/$1/g;
-   $packageStr =~ s/[\/\\]+/\//g;
-   $packageStr =~ s/^[\/]//;
-   @packages = split('/',$packageStr);
-}
-
-if ($fullFile =~ /^(.*)\@([\w\-]+)[\/\\](\2)\.m/)
-{
-   #***
-   # If we have a .m file inside a (@)-folder with the same name :
-   # we will read each file of this folder to acquire the complete class
-   # definition
-   #
-   # TODO: Make sure to associate the captured functions with the class.
-   #***
-   my $className = $2;
-   my $classFile = $className.".m";
-   my $pattern = $1."@".$className."/\*.m";
-   my @files = glob($pattern);
-
-   $fileList[0] = $fullFile;
-
-   my $i = 0;
-
-   my $classPattern = $classFile;
-   $classPattern =~ s/\./\\\./g;
-   $inClassFolder = 1;
-   
-   foreach my $testFile (@files)
-   {
-      if ($testFile !~ /$classPattern/)
-      {
-         $fileList[++$i] = $testFile;
-      }
-   }
-}
-elsif ($fullFile =~ /^(.*)\@([\w\-]+)[\/\\](.+)\.m/)
-{
-   # otherwise @-folder, but .m with a different name : ignore it
-}
-else
-{
-   # otherwise
-   $fileList[0] = $fullFile;
-}
-
-# track states
-my $className = "";
-my $inClass = 0;
-my $classIsHandle = 0;
-my $classIsSealed = 0;
-my $inProps = 0;
-my $propGet = "public:";
-my $propSet = "public:";
-my $propIsAbstract  = 0;
-my $propIsConstant  = 0;
-my $propIsDependent = 0;
-my $inMeths = 0;
-my $methAcc = "public:";
-my $methIsAbstract  = 0;
-my $methIsStatic  = 0;
-my $methIsSealed = 0;
-my $methDecl = "";
-my $methHead = "";
-my $inFunc = 0;
-my $inParams = 0;
-my $inReturns = 0;
-my $openControl = 0;
-my $startNext = 0;
-my $makeDoxyComments = 0;
-my $extraLines = 0;
-my $isLocalFunc = 0;
-my $funcsUseEnd = 1;
-my $blankComment = 0;
-my $inAnonNamespace = 0;
-
-my @blocks = ();
-
-my %propMeths;
-
-#***
-# First pass.
-#
-# 1. Look for overloaded getters and setters. Don't want to auto-gen them.
-# 2. TODO: Determine if functions use "end" or not
-# 3. and then?...
-#
-#***
-my $file;
-foreach $file (@fileList)
-{
-   open(my $in, $file) or die "unable to open input file: $file";
-
-   while (<$in>)
-   {
-      if (/^\s*(?:function)\s*(?:($returns)=)?\s*($fqIdentifier)/)
-      {
-         push(@blocks,"function");
-         
-         my $methName = $2 if defined($2);
-         
-         $propMeths{$methName} = 1 if ($methName =~ m/^[gs]et\./); 
-      }
-      elsif (/^\s*(?:classdef|properties|methods|events|enumeration|if|for|parfor|switch|try|while)/)
-      {
-         push(@blocks,"other");
-      }
-      
-      if (/^\s*\bend\b\s*/)
-      {
-         pop(@blocks) if (scalar @blocks > 0);
-      }
-   }
-   
-   $funcsUseEnd = 0 if (scalar(@blocks) > 0);
-
-   close($in);
-}
-
-@blocks = ();
-
-# Process each file.
-tee($out, "/** MATLAB files, packages, classes and functions. */");
-tee($out, "/** \@addtogroup MATLAB MATLAB Code */");
-tee($out, "/** \@{ */");
-tee($out, "namespace MATLAB {");
-tee($out, "/** \@addtogroup MATLAB*/");
-tee($out, "/** \@{ */ ");
-tee($out, "/** The MATLAB-defined Package: \"$_\". */namespace $_ { /** \@addtogroup MATLAB*//** \@{ */ ") foreach (@packages);
-
-my $funcNo = 0;
-foreach $file (@fileList)
-{
-   open(my $in, $file) or die "unable to open input file: $file";
- 
-   $file =~ /[\/\\]([^\/\\]*)\.m$/;
-   my $baseName = $1;
- 
-   # Process each line. We must not add or remove lines from the code.
-   while (<$in>)
-   {
-      chomp;
-      s/([^%]*)\.\.\./$1\%/;
-      
-      if (s/($bolComment)file\:/$1\@file /i)
-      {
-         $makeDoxyComments = 1;
-         $inParams = 0;
-         $inReturns = 0;
-      }
-      elsif (s/($bolComment)description\:/$1/i)
-      {
-         $makeDoxyComments = 1;
-         $inParams = 0;
-         $inReturns = 0;
-      }
-      elsif (s/($bolComment)limitations\:/$1\@note /i)
-      {
-         $makeDoxyComments = 1;
-         $inParams = 0;
-         $inReturns = 0;
-      }
-      elsif (s/($bolComment)class\:/$1\@class /i)
-      {
-         $makeDoxyComments = 1;
-         $inParams = 0;
-         $inReturns = 0;
-      }
-      elsif (s/($bolComment)todo\:/$1\@todo /i)
-      {
-      }
-      elsif (s/(?:$bolComment)parameters\:\s*$//i)
-      {
-         $makeDoxyComments = 1;
-         $inParams = 1;
-         $inReturns = 0;
-         $startNext = 1;
-         $extraLines = $extraLines + 1;
-      }
-      elsif (s/(?:$bolComment)returns\:\s*$//i)
-      {
-         $makeDoxyComments = 1;
-         $inParams = 0;
-         $inReturns = 1;
-         $startNext = 1;
-         $extraLines = $extraLines + 1;
-      }
-      elsif (!$inFunc && $blankComment && /(?:$bolComment)($identifier(\s+)?)+\:\s*$/i)
-      {
-         $makeDoxyComments = 0;
-         $inParams = 0;
-         $inReturns = 0;
-      }
-      elsif (/(?:$bolComment)[*]{3,}/i)
-      {
-         $makeDoxyComments = 0;
-         $inParams = 0;
-         $inReturns = 0;
-      }
-
-      elsif (/($bolComment|^)\s*$/)
-      {
-         $blankComment = 1;
-      }
-      else
-      {
-         $blankComment = 0;
-      }
-      
-      if (/^\s*\bend\b\s*/)
-      {
-         my $closing = "";
-         $closing = pop(@blocks) if (scalar @blocks > 0);
-
-         if ($closing =~ /classdef/)
-         {
-            tee($out, "\};\n");
-            $inClass = 0;
-            $makeDoxyComments = 0;
-         }
-         elsif ($closing =~ /properties/)
-         {
-#            tee($out, "\n");
-            tee($out, "/**\@}*/\n");
-            $inProps = 0;
-            $makeDoxyComments = 0;
-         }
-         elsif ($closing =~ /methods/)
-         {
-            tee($out, "\n");
-            $inMeths = 0;
-            $makeDoxyComments = 0;
-         }
-         elsif ($closing =~ /function/)
-         {
-            tee($out, "}") if ($inAnonNamespace);
-            tee($out, "}\n");
-            $inFunc = 0;
-            $makeDoxyComments = 0;
-            $inAnonNamespace = 0;
-         }
-         elsif ($closing =~ /control/)
-         {
-#            tee($out, "}\n");
-            tee($out, "\n");
-         }
-         else
-         {
-            tee($out, "\n");
-         }
-         next;
-      }
-
-      if (/^\s*\bfunction\b\s*/ && $inFunc  && !$funcsUseEnd)
-      {
-         my $closing = "";
-         $closing = pop(@blocks) if (scalar @blocks > 0);
-
-         if ($closing =~ /function/)
-         {
-            tee($out, "}") if ($inAnonNamespace);
-            tee($out, "}\n");
-            $inFunc = 0;
-            $makeDoxyComments = 0;
-            $inAnonNamespace = 0;
-         }
-         else
-         {
-            push(@blocks, $closing) if ("$closing" ne "");
-            warn "Unexpected function structure";
-         }
-      }
-      
-      if ($inProps && (/^\s*($identifier)\s*(=\s*[\w\d\{\}\(\)'',\s\[\].]+)?\s*(?:%(.*))?/))
-      {
-         my $propName = $1;
-         my $propValue = "";
-         my $propComment = "";
-         
-         $propValue = $2 if defined($2);
-         $propComment = $3 if defined($3);
-         
-         $propValue =~ s/\([^\)]*(?:\))?//g;
-         $propValue =~ s/\{[^\}]*(?:\})?//g;
-         $propValue =~ s/\./::/g;
-
-         tee($out, "/** $propComment */") if ($propComment ne "");
-
-         unless ($propIsDependent)
-         {
-#            tee($out, "private: ");
-            tee($out, " const") if ($propIsConstant);
-            tee($out, " Property $propName$propValue;");
-
-            unless (exists $propMeths{"get.$propName"})
-            {
-#               tee($out, "/** Accessor for the property: $propName ");
-#               tee($out, "\@retval value The value stored in $propName");
-#               tee($out, "*/ ");
-#               tee($out, "$propGet ");
-#               tee($out, "virtual ") if ($propIsAbstract);
-#               tee($out, "Values $propName()");
-#               tee($out, "=0") if ($propIsAbstract);
-#               tee($out, "; ");
-            }
-
-            unless ($propIsConstant || exists $propMeths{"set.$propName"})
-            {
-#               tee($out, "/** Mutator for the property: $propName ");
-#               tee($out, "\@param value the value to set ");
-#               tee($out, "\@retval object The object with $propName updated to the argument value") unless ($classIsHandle);
-#               tee($out, "*/"); 
-#               tee($out, "$propSet ");
-#               tee($out, "virtual ") if ($propIsAbstract);
-               if ($classIsHandle)
-               {
-#                  tee($out, "void ");
-               }
-               else
-               {
-#                  tee($out, "MATLAB::$className ");
-               }
-#               tee($out, "$propName(Values value)");
-#               tee($out, "=0") if ($propIsAbstract);
-#               tee($out, "; ");
-            }
-         }
-
-         tee($out, "\n");
-         next;
-      }
-
-      if ($inParams && $startNext && s/^(\s*[%]+\s*)($identifier)\s*-/% \@param $2 /)
-      {
-         $startNext = 0;
-      }
-      
-      if ($inReturns && $startNext && s/^(\s*[%]+\s*)($identifier)\s*-/% \@retval $2 /)
-      {
-         $startNext = 0;
-      }
-      
-      if (($inParams || $inReturns) && /^(\s*[%]+\s*)$/)
-      {
-         $startNext = 1;
-      }
-      
-      if ($inFunc && $makeDoxyComments && /^\s*(?:[^%\s]|\n$)/)
-      {
-         $makeDoxyComments = 0;
-         tee($out, "/** Helper functions visible only to $baseName.m */ namespace {") if ($inAnonNamespace);
-         tee($out, "$methHead");
-         tee($out, "//\!\n" x $extraLines);
-         tee($out, "$methDecl");
-         $methHead = "";
-         $methDecl = "";
-         $extraLines = 0;
-      }
-      
-      if (!$inFunc && ($inMeths || !$inClass))
-      {
-         my $methRets = "";
-         my $methName = "";
-         my $methArgs = "()";
-         my $methComm = "";
-         
-         if (/^\s*(function)?\s*(?:($returns)=)?\s*($fqIdentifier)\s*($argList)?\s*(?:%(.*))?/ &&
-             (defined($1) || $inMeths))
-         {
-#            tee($out, "//$_\n");
-            
-            my $isDecl = ($inMeths && !defined($1));
-            
-            unless ($isDecl)
-            {
-               push(@blocks,"function");
-               $inFunc = 1;
-               $makeDoxyComments = 1;
-               ++$funcNo;
-            }
-            $methRets = $2 if defined($2);
-            $methName = $3 if defined($3);
-            $methArgs = $4 if defined($4);
-            $methComm = $5 if defined($5);
-
-            my $isClassFunc = 0;
-            
-            $isClassFunc = 1 if ($inMeths);
-            $isClassFunc = 1 if ($inClassFolder && !$inMeths && ("$baseName" eq "$methName"));
-
-#            tee($out, "//$methArgs\n");
-
-            my $tempSealed = 0;
-            my $methIsCtor = 0;
-
-            # Constructors are always sealed
-            if ($methName =~ /^$className$/)
-            {
-               $tempSealed = 1;
-               $methIsCtor = 1;
-            }
-
-            # So are accessors and mutators
-            if ($methName =~ s/^[gs]et\.//)
-            {
-               $tempSealed = 1;
-            }
-
-#            $methArgs =~ s/,/,MATLAB::Array /g;
-            $methArgs =~ s/^\s+//;
-            $methArgs =~ s/\s+$//;
-            $methArgs =~ s/,/,Value /g;
-            $methArgs =~ s/\b~\b/ignored/g;
-#            $methArgs =~ s/\(/\(MATLAB::Array /;
-            $methArgs =~ s/^([^\(])/Value $1/ unless ($methArgs =~ /^\s*$/);
-            $methArgs =~ s/\(/\(Value / unless ($methArgs =~ /^\(\s*\)$/);
-            $methArgs =~ s/^\(([^,)]+)(.*)/\($2/ unless (!$isClassFunc || $methIsCtor || $methIsStatic);
-            $methArgs =~ s/^\(,/\(/;
-               
-            $methArgs = "()" if ($methArgs =~ /^\(Value\s*\)$/);
-
-            if ($inMeths)
-            {
-               $methDecl .= "$methAcc ";
-
-               $methDecl .=  "virtual " unless ($tempSealed || $methIsSealed || $methIsStatic);
-
-               $methDecl .=  "static " if ($methIsStatic);
-            }
-
-            if(!$inClass && $funcNo > 1)
-            {
-               $inAnonNamespace = 1;
-            }
-
-            unless($methIsCtor)
-            {
-               if ($methRets =~ /^\s*$/)
-               {
-                  $methDecl .=  "void ";
-               }
-               else
-               {
-#                  $methArgs =~ s/^\s+//;
-#                  $methArgs =~ s/\s+$//;
-#                  $methRets =~ s/,/,Value /g;
-#                  $methRets =~ s/^([^\[])/Value $1/ unless ($methRets =~ /^\s*$/);
-#                  $methRets =~ s/^\[/\[Value / unless ($methRets =~ /^\[\s*\]$/);
-                  $methDecl .=  "Values ";
-#                  $methDecl .=  "Value ";
-#                  $methDecl .=  "$methRets ";
-               }
-#               $methDecl .=  "$methRets ";
-            }
-
-            if ($inClassFolder && !$inMeths && ("$baseName" eq "$methName"))
-            {
-               $methDecl .= "${className}::";
-            }
-            $methDecl .= "$methName ";
-            $methDecl .= "$methArgs";
-
-            if ($methIsAbstract)
-            {
-               $methDecl .=  "=0; ";
-            }
-            elsif ($isDecl)
-            {
-               $methDecl .=  "; ";
-            }
-            else
-            {
-               $methDecl .=  "\{ ";
-            }
-
-            $methDecl .=  "//\!< $methComm" unless ($methComm =~ /^\s*$/);
-            
-            $methDecl .= "\n";
-            
-            tee($out, "$methDecl") if ($isDecl);
-            $methDecl = "" if ($isDecl);
-         }
-      }
-      
-      {
-         no warnings 'uninitialized';
-         s/\'([^\']|\'\')*%([^\']|\'\')*\'/\'$1&#x25;$2\'/;
-
-         if ($makeDoxyComments)
-         {
-            if ($inFunc)
-            {
-               s|%|//\!|;
-            }
-            else
-            {
-               s|%|//\!|;
-            }
-         }
-         else
-         {
-            s|%|//|;
-         }
-         
-         s/\'([^\']|\'\')*&#x25;([^\']|\'\')*\'/\'$1%$2\'/;
-      }
-
-      if (m|(//\!.*)|)
-      {
-         $methHead .= "$1\n" if ($inFunc);
-         tee($out, "$1\n") unless ($inFunc);
-         next;
-      }
-
-      #***
-      # Class definition blocks
-      #
-      # classdef := classdef (\(<class_attrs>\))? <class_name> (< <super_classes>)?
-      #***
-      if (/^\s*(?:classdef)\s+($attrList)?\s*($identifier)\s*(?:<\s*($superclassList))?/)
-      {
-         #tee($out, "===classdef===\n";
-         push(@blocks,"classdef");
-         $inClass = 1;
-         $makeDoxyComments = 0;
-         $classIsHandle = 0;
-         $classIsSealed = 0;
-
-         my $classAttrs   = "";
-         my $classParents = "";
-         my @classParents = ();
-         
-         $className    = $2;
-
-         # Attributes
-         my $classIsAbstract = 0;
-         my @baseFriends  = ();
-
-         $classAttrs   = $1 if defined($1);
-         $classParents = $3 if defined($3);
- 
-         if ($classParents !~ /^\s*$/)
-         {
-            $classIsHandle = 1 if ($classParents =~ /\bhandle\b/);
-            $classParents =~ s/\s//g;
-            @classParents = split('&',$classParents);
-            $classParents =~ s/&/,public /g;
-            $classParents = "public MATLAB::$classParents";
-#            $classParents = "public $classParents";
-         }
-
-         #***
-         # Abstract
-         # 
-         # The C++ equivalent is a class with at least one pure virtual method.
-         #***
-         if ($classAttrs =~ /abstract\s*=\s*false/i)
-         {
-            # ignore "Abstract=false" settings.
-         }
-         elsif ($classAttrs =~ /abstract(?:\s*=\s*true)?/i)
-         {
-            $classIsAbstract = 1;
-         }
-
-         #***
-         # AllowedSubclasses
-         #
-         # The C++ equivalent is a "final" or "leaf" class with specific friend
-         # classes. There is no way to directly specify this restriction. It
-         # can be imposed through exploiting virtual inheritance.
-         #***
-         if ($classAttrs =~ /allowedsubclasses\s*=\s*($metaList)/i)
-         {
-            # AllowedSubclasses always implies Sealed=true.
-            $classIsSealed = 1;
-
-            my $allowed = $1;            
-            $allowed =~ s/[\{\}\?\s]//g;
-            $allowed =~ s/\./::/g;
-            @baseFriends = split(',',$allowed);
-            @baseFriends = ($className, @baseFriends);
-         }
-         
-         #***
-         # ConstructOnLoad
-         #
-         # The C++ equivalent would be to create a global instance immediately
-         # after defining the class.
-         #
-         # Not yet implemented.
-         #***
-
-         #***
-         # HandleCompatible
-         #
-         # No C++ equivalent. Ignore.
-         #***
-
-         #***
-         # Hidden
-         #
-         # No C++ equivalent. Ignore.
-         #***
-
-         #***         
-         # InferiorClasses
-         #
-         # No C++ equivalent. Ignore.
-         #***                  
-
-         #***
-         # Sealed
-         #
-         # The C++ equivalent is a "final" or "leaf" class. There is no way to
-         # directly specify this restriction. It can be imposed through
-         # exploiting virtual inheritance.
-         #
-         # Update: C++11 introduces the `final' keyword which performs the
-         #         desired modification. Doxygen understands the keyword.
-         #***
-         if ($classAttrs =~ /sealed\s*=\s*false/i)
-         {
-            # ignore "Sealed=false" settings.
-         }
-         elsif ($classAttrs =~ /sealed(?:\s*=\s*true)?/i)
-         {
-            $classIsSealed = 1;
-            @baseFriends = ($className, @baseFriends);
-            
-         }
-
-         if ($classIsSealed)
-         {
-            tee($out, "class $_;") foreach (@baseFriends);
-            tee($out, "/** Enforce the \"Sealed\" attribute for ${className}. ");
-            tee($out, "This class is automatically generated specifically to ");
-            tee($out, "illustrate the behavior of the \"Sealed\" class attribute.");
-            tee($out, "*/");
-            tee($out, "class ${className}Seal {");
-            tee($out, "/** Allowed subclass: $_ */ friend class $_;") foreach (@baseFriends);
-            tee($out, "/** Prevent public construction of the ${className} seal */");
-            tee($out, "private:${className}Seal()\{\}\};");
-            
-            $classParents = join(', ',("private virtual ${className}Seal",$classParents));
-         }
-
-         $classParents = ": $classParents";
-         tee($out, "/** \@nosubgrouping */class $className");
-         tee($out, " final") if ($classIsSealed);
-         tee($out, " $classParents\{\n");         
-      }
-      elsif (/^\s*(?:properties)\s*($attrList)?/)
-      {
-         #tee($out, "===properties===\n";
-         #***
-         # MATLAB properties are more like methods (class functions) than
-         # members. Non-dependant properties behave as though a member is
-         # backing them and all properties have default get/set methods.
-         #***
-         push(@blocks,"properties");
-         $inProps = 1;
-
-         my $getGrp = "Public";
-         my $setGrp = "Public";
-         
-         my $propAttrs = "";
-         $propAttrs = $1 if defined($1);
-         $propGet = "public:";
-         $propSet = "public:";
-         $propIsAbstract  = 0;
-         $propIsConstant  = 0;
-         $propIsDependent = 0;
-         
-         #***
-         # AbortSet
-         #
-         # No C++ equivalent. Ignore.
-         #***
-
-         #***
-         # Abstract
-         #
-         # Property get and set are pure virtual. Not yey implemented.
-         #***
-         if ($propAttrs =~ /abstract\s*=\s*false/i)
-         {
-            # Ignore Constant=false settings.
-         }
-         elsif ($propAttrs =~ /abstract\s*(?:=\s*true)?/i)
-         {
-            $propIsAbstract = 1;
-         }
-                  
-         #***
-         # Access
-         #
-         # Restrict access. C++ friendship is granted on a per-class basis, not
-         # a per-propery basis, so the friendship here will only be approximate.
-         #***
-         if ($propAttrs =~ /\baccess\b\s*=\s*private/i)
-         {
-            $propGet = "private:";
-            $propSet = "private:";
-            $getGrp = "Private";
-            $setGrp = "Private";
-         }
-         elsif ($propAttrs =~ /\baccess\b\s*=\s*$metaList/i)
-         {
-            $propGet = "private:";
-            $propSet = "private:";
-            $getGrp = "Restricted";
-            $setGrp = "Restricted";
-         }
-         elsif ($propAttrs =~ /\baccess\b\s*=\s*protected/i)
-         {
-            $propGet = "protected:";
-            $propSet = "protected:";
-            $getGrp = "Protected";
-            $setGrp = "Protected";
-         }
-         elsif ($propAttrs =~ /\baccess\b\s*=\s*public/i)
-         {
-            $propGet = "public:";
-            $propSet = "public:";
-            $getGrp = "Public";
-            $setGrp = "Public";
-         }
-
-         #***
-         # Constant
-         #
-         # Treat property as const.
-         #***
-         if ($propAttrs =~ /constant\s*=\s*false/i)
-         {
-            # Ignore Constant=false settings.
-         }
-         elsif ($propAttrs =~ /constant\s*(?:=\s*true)?/i)
-         {
-            $propIsConstant = 1;
-         }
-         
-         #***
-         # Dependent
-         #
-         # Treat property as non-member.
-         #***
-         if ($propAttrs =~ /dependent\s*=\s*false/i)
-         {
-            # Ignore Dependent=false settings.
-         }
-         elsif ($propAttrs =~ /dependent\s*(?:=\s*true)?/i)
-         {
-            $propIsDependent = 1;
-         }
-         
-         #***
-         # GetAccess
-         #
-         # Restrict access. C++ friendship is granted on a per-class basis, not
-         # a per-propery basis, so the friendship here will only be approximate.
-         #***
-         if ($propAttrs =~ /\bgetaccess\b\s*=\s*private/i)
-         {
-            $propGet = "private:";
-            $getGrp = "Private";
-         }
-         elsif ($propAttrs =~ /\bgetaccess\b\s*=\s*$metaList/i)
-         {
-            $propGet = "private:";
-            $getGrp = "Restricted";
-         }
-         elsif ($propAttrs =~ /\bgetaccess\b\s*=\s*protected/i)
-         {
-            $propGet = "protected:";
-            $getGrp = "Protected";
-         }
-         elsif ($propAttrs =~ /\bgetaccess\b\s*=\s*public/i)
-         {
-            $propGet = "public:";
-            $getGrp = "Public";
-         }
-
-         #***
-         # SetAccess
-         #
-         # Restrict access. C++ friendship is granted on a per-class basis, not
-         # a per-propery basis, so the friendship here will only be approximate.
-         #***
-         if ($propAttrs =~ /\bsetaccess\b\s*=\s*private/i)
-         {
-            $propSet = "private:";
-            $setGrp = "Private";
-         }
-         elsif ($propAttrs =~ /\bsetaccess\b\s*=\s*$metaList/i)
-         {
-            $propSet = "private:";
-            $setGrp = "Restricted";
-         }
-         elsif ($propAttrs =~ /\bsetaccess\b\s*=\s*protected/i)
-         {
-            $propSet = "protected:";
-            $setGrp = "Protected";
-         }
-         elsif ($propAttrs =~ /\bsetaccess\b\s*=\s*public/i)
-         {
-            $propSet = "public:";
-            $setGrp = "Public";
-         }
-         
-         $makeDoxyComments = 1 unless ($propIsDependent || $propIsAbstract);
-
-         tee($out, "public: /** \@name $getGrp Get Access, $setGrp Set Access Properties *//**\@{*/\n");
-#         tee($out, "\n");
-      }
-      elsif (/^\s*(?:methods)\s*($attrList)?/)
-      {
-#         tee($out, "//===methods===");
-         push(@blocks,"methods");
-         $inMeths = 1;
-         $makeDoxyComments = 0;
-
-         my $methAttrs = "";
-         $methAttrs = $1 if defined($1);
-         $methAcc = "public:";
-         $methIsAbstract  = 0;
-         $methIsStatic  = 0;
-         $methIsSealed = 0;
-         
-         #***
-         # Abstract
-         #
-         # Property get and set are pure virtual. Not yey implemented.
-         #***
-         if ($methAttrs =~ /abstract\s*=\s*false/i)
-         {
-            # Ignore Constant=false settings.
-         }
-         elsif ($methAttrs =~ /abstract\s*(?:=\s*true)?/i)
-         {
-            $methIsAbstract = 1;
-            $makeDoxyComments = 1;
-         }
-          
-         #***
-         # Access
-         #
-         # Restrict access. C++ friendship is granted on a per-class basis, not
-         # a per-propery basis, so the friendship here will only be approximate.
-         #***
-         if ($methAttrs =~ /\baccess\b\s*=\s*private/i)
-         {
-            $methAcc = "private:";
-         }
-         elsif ($methAttrs =~ /\baccess\b\s*=\s*$metaList/i)
-         {
-            $methAcc = "private:";
-         }
-         elsif ($methAttrs =~ /\baccess\b\s*=\s*protected/i)
-         {
-            $methAcc = "protected:";
-         }
-         elsif ($methAttrs =~ /\baccess\b\s*=\s*public/i)
-         {
-            $methAcc = "public:";
-         }
-
-         #***
-         # Hidden
-         #
-         # No C++ equivalent. Ignore.
-         #***
-         
-         #***
-         # Sealed
-         #
-         # Treat method as final.
-         #***
-         if ($methAttrs =~ /sealed\s*=\s*false/i)
-         {
-            # Ignore Sealed=false settings.
-         }
-         elsif ($methAttrs =~ /sealed\s*(?:=\s*true)?/i)
-         {
-            $methIsSealed = 1;
-         }
-         
-         #***
-         # Static
-         #
-         # Class method.
-         #***
-         if ($methAttrs =~ /static\s*=\s*false/i)
-         {
-            # Ignore Static=false settings.
-         }
-         elsif ($methAttrs =~ /static\s*(?:=\s*true)?/i)
-         {
-            $methIsStatic = 1;
-         }
-
-         tee($out, "\n");
-      }
-      elsif (/^\s*(if|for|parfor|switch|try|while)(.*)/)
-      {
-#         tee($out, "//===control===");
-         push(@blocks,"control");
-#         my $ctrl = $1;
-#         my $stmt = $2;
-#         $stmt =~ s/~/\!/g;
-#         $stmt =~ s/:/,/g;
-#         $stmt =~ s/($identifier)\.($identifier)/$1::$2/g;
-#         $stmt =~ s/\[$identifier(?:,$identifier)*\]/MATLAB::Array/g;
-#         $stmt =~ s/[\[]/\(/g;
-#         $stmt =~ s/[\)]/\)/g;
-#         $stmt =~ s/($identifier)\{(.*)\}/$1\[$2\]/g;
-#         $stmt =~ s/''/\"/g;
-#         $stmt =~ s/\'/\"/g;
-#         tee($out, "$ctrl$stmt";
-#         
-#         if ($_ !~ /[^%]*\.\.\./)
-#         {
-#            tee($out, "{";
-#         }
-#         else
-#         {
-#            $openControl = 1;
-#         }
-         
-         tee($out, "\n");
-      }
-      else
-      {
-         #tee($out, "===other===\n");
-#         s/~/\!/g;
-#         s/:/,/g;
-#         s/($identifier)\.($identifier)/$1::$2/g;
-#         s/\[$identifier(?:,$identifier)*\]/MATLAB::Array/g;
-#         s/[\[]/\(/g;
-#         s/[\]]/\)/g;
-#         s/($identifier)\{(.*)\}/$1\[$2\]/g;
-#         s/''/\"/g;
-#         s/\'/\"/g;
-#         
-#         unless ($inFunc && $makeDoxyComments)
-#         {
-#            if ($openControl && $_ !~ /[^%]*\.\.\./)
-#            {
-#               $openControl = 0;
-#               tee($out, "$_\{");
-#            }
-#            else
-#            {
-#               s|([^%]*)\.\.\.|$1//|;
-#               tee($out, "$_");
-#            }
-#         }
-
-         tee($out, "\n") unless ($inFunc && $makeDoxyComments);
-      }
-      
-
-   }
-
-   close $in;
-}
-
-tee($out, "}") if ($inFunc);
-
-tee($out, "/**\@}*/}" x scalar(@packages));
-tee($out, "/**\@}*/}/**\@}*/\n");
-
-close $out;
-
-sub tee (@)
-{
-   my $handle = shift;
-   print $handle @_;
-   print @_;
-}
Index: mkjer/includes/README.txt
===================================================================
--- Damkjer/includes/README.txt	(revision 11)
+++ 	(revision )
@@ -1,3 +1,0 @@
-Required includes:
-
-The Eigen Template Library: http://eigen.tuxfamily.org/ -> includes/eigen
