diff --git a/Source/Math/InstantiateTemplates.cpp b/Source/Math/InstantiateTemplates.cpp
deleted file mode 100644
index 37bdcebe3..000000000
--- a/Source/Math/InstantiateTemplates.cpp
+++ /dev/null
@@ -1,346 +0,0 @@
-//
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-#include
-#include
-#include "CPUMatrix.cpp"
-#include "Matrix.cpp"
-
-#include "..\..\Common\Include\fileutil.cpp"
-#include "..\..\Common\Include\File.cpp"
-
- //don't treat it as sample code. some code does not make sense
- //only used to force compiler to build the code
-namespace Microsoft { namespace MSR { namespace CNTK {
-#pragma region instantiate all classes (so clients can link to them)
-
- template
- void CallEverythingInMatrix()
- {
- const size_t numRows = 1;
- const size_t numCols = 1;
- const bool srcIsColMajor = true;
- Matrix matx;
- matx.GetCurrentMatrixLocation();
- matx.TransferFromDeviceToDevice(matx.GetDeviceId(),0);
- Matrix mat(numRows, numCols);
- const Matrix matt(numRows, numCols);
- T y = matt(0,0);
- Matrix mat2(numRows, numCols, nullptr, srcIsColMajor);
- Matrix mat3(mat); //copy constructor, deep copy
- Matrix mat4 = mat2; //assignment operator, deep copy
- Matrix mat5(mat3);
- mat5.ColumnElementMultiplyWith(mat3);
- FILE * f=0;
- Matrix mat6(f, "test");
- std::wstring s;
- File ff(s,fileOptionsText | fileOptionsReadWrite);
- Matrix MM;
- ff>>MM;
- ff<> v;
- v.insert(v.begin() + 1, Matrix(1,1,-1)); //enable move assignment
-
- size_t rows = mat.GetNumRows();
- size_t cols = mat.GetNumCols();
- size_t elems = mat.GetNumElements();
- mat.Reshape(numRows, numCols);
- mat.Resize(numRows, numCols);
- mat.IsEmpty();
- size_t row = 0, col = 0;
- T val = (const T&)mat(row, col);
- mat(row, col) = 0;
- mat.SetValue(val);
- mat.SetValue(mat2);
- mat.SetValue(numRows, numCols, NULL, srcIsColMajor);
-
- mat.SetDiagonalValue(1);
- mat.SetDiagonalValue(mat2);
- mat.SetUniformRandomValue(0, 1);
- mat.SetGaussianRandomValue(0,1);
-
- mat2 = mat.Transpose();
- mat2.AssignTransposeOf(mat);
- //mat.InplaceTranspose();
-
- T alpha = (T)2;
- mat += alpha;
- Matrix& newmat2 = mat + alpha; //enable operator+ and move constructor
- mat += mat2;
- mat3 = mat + mat2;
- mat3.AssignSumOf(alpha, mat);
- mat3.AssignSumOf(mat, mat);
- mat -= alpha;
- mat3 = mat - alpha;
- mat3.AssignDifferenceOf(alpha, mat);
- mat3.AssignDifferenceOf(mat, alpha);
- mat -= mat2;
- mat3 = mat - mat2;
- mat3.AssignDifferenceOf(mat, mat2);
- mat *= alpha;
- mat3 = mat * alpha;
- mat3.AssignProductOf(alpha, mat);
- mat3 = mat * mat2;
- mat = mat3.AssignProductOf(mat, true, mat2, false);
- mat /= alpha;
- mat3 = mat / alpha;
- mat ^= alpha;
- mat3 = mat ^ alpha;
- mat3.AssignElementPowerOf(mat, alpha);
- mat3 = mat2.ElementMultiplyWith (mat);
- mat3 = mat2.AssignElementProductOf (mat, mat4);
- mat3.AddElementProductOf(mat,mat4);
-
- mat3 = mat2.ElementInverse();
- mat3.AssignElementInverseOf (mat2);
-
- mat3 = mat2.InplaceSigmoid ();
- mat3.AssignSigmoidOf (mat);
-
- mat3 = mat2.InplaceTanh ();
- mat3.AssignTanhOf (mat2);
-
- const bool isColWise = true;
- mat3 = mat2.InplaceSoftmax (isColWise);
- mat3.AssignSoftmaxOf (mat2, isColWise);
-
- mat3 = mat2.InplaceSqrt ();
- mat3.AssignSqrtOf (mat2);
-
- mat3 = mat2.InplaceExp ();
- mat3.AssignExpOf (mat2);
-
- mat3 = mat2.InplaceLog ();
- mat3.AssignLogOf (mat2);
-
- mat3 = mat2.InplaceAbs ();
- mat3.AssignAbsOf (mat2);
-
- mat3 = mat2.InplaceTruncateBottom ((T)1);
- mat3 = mat2.InplaceTruncateTop ((T)1);
- mat3 = mat2.SetToZeroIfAbsLessThan ((T)1);
-
- T sum = mat3.Sum (); //sum of all elements
-
- mat.IsEqualTo(mat3);
- mat.IsEqualTo(mat3, 0.1f);
-
- mat.VectorNorm1(mat2, isColWise);
- mat2.AssignVectorNorm1Of(mat2, isColWise);
-
- mat.VectorNorm2(mat2, isColWise);
- mat2.AssignVectorNorm2Of(mat2, isColWise);
-
- mat.VectorNormInf(mat2, isColWise);
- mat2.AssignVectorNormInfOf(mat2, isColWise);
-
- T frob = mat.FrobeniusNorm();
- T norm = mat.MatrixNormInf();
- mat.VectorMax(mat2, mat3, isColWise);
- mat.VectorMin(mat2, mat3, isColWise);
-
- mat3.AssignInnerProductOf(mat, mat2, isColWise);
- mat3.AddWithScaleOf(alpha, mat);
-
- mat.Print("test", 0,1,0,1);
- mat.Print();
- mat.Print("test");
-
- mat.ReadFromFile(f, "test");
- mat.WriteToFile(f, "test");
-
- T beta = (T)1.0;
- const bool transposeA = true;
- const bool transposeB = false;
- Matrix::MultiplyAndWeightedAdd(alpha, mat2, transposeA, mat3, transposeB, beta, mat4);
- Matrix::MultiplyAndAdd(mat2, transposeA, mat3, transposeB, mat4);
- Matrix::Multiply(mat2, transposeA, mat3, transposeB, mat4);
- Matrix::Multiply(mat2, mat3, mat4);
- Matrix::ScaleAndAdd(alpha, mat2, mat3);
- Matrix::Scale(alpha, mat2);
- Matrix::Scale(alpha, mat2, mat);
- Matrix::InnerProduct(mat2, mat3, mat4, isColWise);
- Matrix::ElementWisePower (0, mat, mat3);
- Matrix::AreEqual(mat, mat3);
- Matrix::AreEqual(mat, mat3, (T)0.1);
-
- Matrix::Ones(2,3);
- Matrix::Zeros(2,3);
- Matrix::Eye(2);
- Matrix::RandomUniform(2, 3,0, 1);
- Matrix::RandomGaussian(2, 3,0, 1);
- }
-
-
- template
- void CallEverythingInCPUMatrix()
- {
- const size_t numRows = 1;
- const size_t numCols = 1;
- const bool srcIsColMajor = true;
- CPUMatrix matx;
- CPUMatrix mat(numRows, numCols);
- CPUMatrix mat2(numRows, numCols, nullptr, srcIsColMajor);
- CPUMatrix mat3(mat); //copy constructor, deep copy
- CPUMatrix mat4 = mat2; //assignment operator, deep copy
- CPUMatrix mat5(mat3);
- mat5.ColumnElementMultiplyWith(mat3);
- FILE * f=0;
- std::wstring s;
- File ff(s,fileOptionsText | fileOptionsReadWrite);
- CPUMatrix MM;
- ff>>MM;
- ff< mat6(f, "test");
- std::vector> v;
- v.insert(v.begin() + 1, CPUMatrix(1,1)); //enable move assignment
-
- size_t rows = mat.GetNumRows();
- size_t cols = mat.GetNumCols();
- size_t elems = mat.GetNumElements();
- mat.Reshape(numRows, numCols);
- mat.Resize(numRows, numCols);
- mat.IsEmpty();
- size_t row = 0, col = 0;
- T val = mat(row, col);
- mat(row, col) = 0;
- mat.SetValue(val);
- mat.SetValue(mat2);
- mat.SetValue(numRows, numCols, NULL, srcIsColMajor);
-
- mat.SetDiagonalValue(1);
- mat.SetDiagonalValue(mat2);
- mat.SetUniformRandomValue(0, 1);
- mat.SetGaussianRandomValue(0,1);
-
- mat2 = mat.Transpose();
- mat2.AssignTransposeOf(mat);
- //mat.InplaceTranspose();
-
- T alpha = (T)2;
- mat += alpha;
- CPUMatrix& newmat2 = mat + alpha; //enable operator+ and move constructor
- mat += mat2;
- mat3 = mat + mat2;
- mat3.AssignSumOf(alpha, mat);
- mat3.AssignSumOf(mat2, mat);
- mat -= alpha;
- mat3 = mat - alpha;
- mat3.AssignDifferenceOf(alpha, mat);
- mat3.AssignDifferenceOf(mat, alpha);
- mat -= mat2;
- mat3 = mat - mat2;
- mat3.AssignDifferenceOf(mat, mat2);
- mat *= alpha;
- mat3 = mat * alpha;
- mat3.AssignProductOf(alpha, mat);
- mat3 = mat * mat2;
- mat = mat3.AssignProductOf(mat, true, mat2, false);
- mat /= alpha;
- mat3 = mat / alpha;
- mat ^= alpha;
- mat3 = mat ^ alpha;
- mat3.AssignElementPowerOf(mat, alpha);
- mat3 = mat2.ElementMultiplyWith (mat);
- mat3 = mat2.AssignElementProductOf (mat, mat4);
- mat3 = mat2.AddElementProductOf (mat, mat4);
- mat2.ColumnElementMultiplyWith(mat);
-
- mat3 = mat2.ElementInverse();
- mat3.AssignElementInverseOf (mat2);
-
- mat3 = mat2.InplaceSigmoid ();
- mat3.AssignSigmoidOf (mat);
-
- mat3 = mat2.InplaceTanh ();
- mat3.AssignTanhOf (mat2);
-
- const bool isColWise = true;
- mat3 = mat2.InplaceSoftmax (isColWise);
- mat3.AssignSoftmaxOf (mat2, isColWise);
-
- mat3 = mat2.InplaceSqrt ();
- mat3.AssignSqrtOf (mat2);
-
- mat3 = mat2.InplaceExp ();
- mat3.AssignExpOf (mat2);
-
- mat3 = mat2.InplaceLog ();
- mat3.AssignLogOf (mat2);
-
- mat3 = mat2.InplaceAbs ();
- mat3.AssignAbsOf (mat2);
-
- mat3 = mat2.InplaceTruncateBottom ((T)1);
- mat3 = mat2.InplaceTruncateTop ((T)1);
- mat3 = mat2.SetToZeroIfAbsLessThan ((T)1);
-
- T sum = mat3.Sum (); //sum of all elements
-
- mat.IsEqualTo(mat3);
- mat.IsEqualTo(mat3, 0.1f);
-
- mat.VectorNorm1(mat2, isColWise);
- mat2.AssignVectorNorm1Of(mat2, isColWise);
-
- mat.VectorNorm2(mat2, isColWise);
- mat2.AssignVectorNorm2Of(mat2, isColWise);
-
- mat.VectorNormInf(mat2, isColWise);
- mat2.AssignVectorNormInfOf(mat2, isColWise);
-
- T frob = mat.FrobeniusNorm();
- T norm = mat.MatrixNormInf();
- norm = mat.MatrixNorm1();
- mat.AssignSignOf(mat2);
- mat.AddSignOf(mat2);
-
- mat.VectorMax(mat2, mat3, isColWise);
- mat.VectorMin(mat2, mat3, isColWise);
-
- mat3.AssignInnerProductOf(mat, mat2, isColWise);
- mat3.AddWithScaleOf(alpha, mat);
-
- mat.Print("test", 0,1,0,1);
- mat.Print();
- mat.Print("test");
-
- mat.ReadFromFile(f, "test");
- mat.WriteToFile(f, "test");
-
- T beta = (T)1.0;
- const bool transposeA = true;
- const bool transposeB = false;
- CPUMatrix::MultiplyAndWeightedAdd(alpha, mat2, transposeA, mat3, transposeB, beta, mat4);
- CPUMatrix::MultiplyAndAdd(mat2, transposeA, mat3, transposeB, mat4);
- CPUMatrix::Multiply(mat2, transposeA, mat3, transposeB, mat4);
- CPUMatrix::Multiply(mat2, mat3, mat4);
- CPUMatrix::ScaleAndAdd(alpha, mat2, mat3);
- CPUMatrix::Scale(alpha, mat2);
- CPUMatrix::Scale(alpha, mat2, mat);
- CPUMatrix::InnerProduct(mat2, mat3, mat4, isColWise);
- CPUMatrix::InnerProductOfMatrices(mat,mat2);
- CPUMatrix::ElementWisePower (0, mat, mat3);
- CPUMatrix::AreEqual(mat, mat3);
- CPUMatrix::AreEqual(mat, mat3, (T)0.1);
-
- CPUMatrix::Ones(2,3);
- CPUMatrix::Zeros(2,3);
- CPUMatrix::Eye(2);
- CPUMatrix::RandomUniform(2, 3,0, 1);
- CPUMatrix::RandomGaussian(2, 3,0, 1);
- }
-
- void InstantiateAllCPUMatrixMethods()
- {
- CallEverythingInCPUMatrix();
- CallEverythingInCPUMatrix();
-
- CallEverythingInMatrix();
- CallEverythingInMatrix();
- }
-#pragma endregion instantiate all classes
-}}}
diff --git a/Source/Math/InstantiateTemplates.cu b/Source/Math/InstantiateTemplates.cu
deleted file mode 100644
index e5d91bc6e..000000000
--- a/Source/Math/InstantiateTemplates.cu
+++ /dev/null
@@ -1,185 +0,0 @@
-#pragma once
-#include
-#include
-#include "GPUMatrix.cu"
-
-//#include "..\..\common\include\fileutil.cpp"
-//#include "..\..\common\include\File.cpp"
-
-
-//don't treat it as sample code. some code does not make sense
-//only used to force compiler to build the code
-namespace Microsoft { namespace MSR { namespace CNTK {
-
-#pragma region instantiate all classes (so clients can link to them)
-
- template
- void CallEverythingInGPUMatrix()
- {
- const size_t numRows = 1;
- const size_t numCols = 1;
- const bool srcIsColMajor = true;
- GPUMatrix matx;
- GPUMatrix mat(numRows, numCols);
- GPUMatrix mat2(numRows, numCols, nullptr, srcIsColMajor);
- GPUMatrix mat3(mat); //copy constructor, deep copy
- GPUMatrix mat4 = mat2; //assignment operator, deep copy
- GPUMatrix mat5(mat3);
- mat5.ColumnElementMultiplyWith(mat3);
- FILE * f=0;
- GPUMatrix mat6(f, "test");
- std::wstring s;
- File ff(s,fileOptionsText | fileOptionsReadWrite);
- GPUMatrix MM;
- ff>>MM;
- ff<> v;
- v.insert(v.begin() + 1, GPUMatrix(1,1)); //enable move assignment
- mat.CopyToArray();
- mat.ChangeDeviceTo(2);
- int y = GPUMatrix::GetBestGPUDeviceId();
-
- size_t rows = mat.GetNumRows();
- size_t cols = mat.GetNumCols();
- size_t elems = mat.GetNumElements();
- mat.Reshape(numRows, numCols);
- mat.Resize(numRows, numCols);
- mat.IsEmpty();
- size_t row = 0, col = 0;
- T val = mat(row, col);
- mat(row, col) = 0;
- mat.SetValue(val);
- mat.SetValue(mat2);
- mat.SetValue(numRows, numCols, NULL, srcIsColMajor);
-
- mat.SetDiagonalValue(1);
- mat.SetDiagonalValue(mat2);
- mat.SetUniformRandomValue(0, 1);
- mat.SetGaussianRandomValue(0,1);
- T vv = mat.Get00Element();
-
- mat2 = mat.Transpose();
- mat2.AssignTransposeOf(mat);
- //mat.InplaceTranspose();
-
- T alpha = (T)2;
- mat += alpha;
- //GPUMatrix& newmat2 = mat + alpha; //enable operator+ and move constructor
- mat += mat2;
- mat3 = mat + mat2;
- mat3.AssignSumOf(alpha, mat);
- mat -= alpha;
- mat3 = mat - alpha;
- mat3.AssignDifferenceOf(alpha, mat);
- mat3.AssignDifferenceOf(mat, alpha);
- mat -= mat2;
- mat3 = mat - mat2;
- mat3.AssignDifferenceOf(mat, mat2);
- mat *= alpha;
- mat3 = mat * alpha;
- mat3.AssignProductOf(alpha, mat);
- mat3 = mat * mat2;
- mat = mat3.AssignProductOf(mat, true, mat2, false);
- mat /= alpha;
- mat3 = mat / alpha;
- mat ^= alpha;
- mat3 = mat ^ alpha;
- mat3.AssignElementPowerOf(mat, alpha);
- mat3.AddElementProductOf(mat,mat2);
- mat3 = mat2.ElementMultiplyWith (mat);
- mat3 = mat2.AssignElementProductOf (mat, mat4);
- //mat3 = mat2.AddElementProductOf (mat, mat4);
-
- mat3 = mat2.ElementInverse();
- mat3.AssignElementInverseOf (mat2);
-
- mat3 = mat2.InplaceSigmoid ();
- mat3.AssignSigmoidOf (mat);
-
- mat3 = mat2.InplaceTanh ();
- mat3.AssignTanhOf (mat2);
-
- const bool isColWise = true;
- mat3 = mat2.InplaceSoftmax (isColWise);
- mat3.AssignSoftmaxOf (mat2, isColWise);
-
- mat3 = mat2.InplaceSqrt ();
- mat3.AssignSqrtOf (mat2);
-
- mat3 = mat2.InplaceExp ();
- mat3.AssignExpOf (mat2);
-
- mat3 = mat2.InplaceLog ();
- mat3.AssignLogOf (mat2);
-
- mat3 = mat2.InplaceAbs ();
- mat3.AssignAbsOf (mat2);
-
- mat3 = mat2.InplaceTruncateBottom ((T)1);
- mat3 = mat2.InplaceTruncateTop ((T)1);
- mat3 = mat2.SetToZeroIfAbsLessThan ((T)1);
-
- T sum = mat3.Sum (); //sum of all elements
-
- mat.IsEqualTo(mat3);
- mat.IsEqualTo(mat3, 0.1f);
-
- mat.VectorNorm1(mat2, isColWise);
- mat2.AssignVectorNorm1Of(mat2, isColWise);
-
- mat.VectorNorm2(mat2, isColWise);
- mat2.AssignVectorNorm2Of(mat2, isColWise);
-
- mat.VectorNormInf(mat2, isColWise);
- mat2.AssignVectorNormInfOf(mat2, isColWise);
-
- T frob = mat.FrobeniusNorm();
- T norm = mat.MatrixNormInf();
- //norm = mat.MatrixNorm1();
- //mat.AssignSignOf(mat2);
- //mat.AddSignOf(mat2);
-
- mat.VectorMax(mat2, mat3, isColWise);
- mat.VectorMin(mat2, mat3, isColWise);
-
- mat3.AssignInnerProductOf(mat, mat2, isColWise);
- mat3.AddWithScaleOf(alpha, mat);
-
- mat.Print("test", 0,1,0,1);
- mat.Print();
- mat.Print("test");
-
- mat.ReadFromFile(f, "test");
- mat.WriteToFile(f, "test");
-
- T beta = (T)1.0;
- const bool transposeA = true;
- const bool transposeB = false;
- GPUMatrix::MultiplyAndWeightedAdd(alpha, mat2, transposeA, mat3, transposeB, beta, mat4);
- GPUMatrix::MultiplyAndAdd(mat2, transposeA, mat3, transposeB, mat4);
- GPUMatrix::Multiply(mat2, transposeA, mat3, transposeB, mat4);
- GPUMatrix::Multiply(mat2, mat3, mat4);
- GPUMatrix::ScaleAndAdd(alpha, mat2, mat3);
- GPUMatrix::Scale(alpha, mat2);
- GPUMatrix::Scale(alpha, mat2, mat);
- GPUMatrix::InnerProduct(mat2, mat3, mat4, isColWise);
- //GPUMatrix::InnerProductOfMatrices(mat,mat2);
- GPUMatrix::ElementWisePower (0, mat, mat3);
- GPUMatrix::AreEqual(mat, mat3);
- GPUMatrix::AreEqual(mat, mat3, (T)0.1);
-
- GPUMatrix::Ones(2,3);
- GPUMatrix::Zeros(2,3);
- GPUMatrix::Eye(2);
- GPUMatrix::RandomUniform(2, 3,0, 1);
- GPUMatrix::RandomGaussian(2, 3,0, 1);
- }
-
- void InstantiateAllGPUMatrixMethods()
- {
- CallEverythingInGPUMatrix();
- CallEverythingInGPUMatrix();
- }
-#pragma endregion instantiate all classes
-}}}
diff --git a/Source/Math/Makefile b/Source/Math/Makefile
deleted file mode 100644
index 87c9e1f35..000000000
--- a/Source/Math/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-CSOURCES = CPUMatrix.cpp CPUSparseMatrix.cpp Matrix.cpp
-
-OBJECTS = CPUMatrix.o CPUSparseMatrix.o Matrix.o \
- GPUMatrixCUDAKernels.o GPUMatrix.o \
- GPUWatcher.o GPUSparseMatrix.o
-
-INCLUDES = -I../../Common/Include -I/opt/acml5.3.1/gfortran64_mp_int64/include
-
-DEPS =
-
-CFLAGS = $(INCLUDES) \
- -D BASETYPES_NO_UNSAFECRTOVERLOAD -DBASETYPES_NO_STRPRINTF \
- -DLINUX -Wnon-template-friend -std=c++11 # -D_FILEUTIL_
-
-NVCFLAGS = -DLINUX -D BASETYPES_NO_UNSAFECRTOVERLOAD -DBASETYPES_NO_STRPRINTF \
- -I../../Common/Include -arch=compute_20 -std=c++11 # -D_FILEUTIL_
-
-CXX = gcc
-NVCC = nvcc
-
-all: libmatrixmat.so
-
-libmatrixmat.so: $(OBJECTS)
- $(CXX) -shared $(OBJECTS) -o libmatrixmat.so
-
-libmatrixmat.so: $(OBJECTS)
-
-
-%.o: %.cpp $(DEPS)
- $(CXX) -c $(CFLAGS) $< -o $@
-
-%.o: %.cu $(DEPS)
- $(NVCC) -c $(NVCFLAGS) $< -o $@
diff --git a/Source/Math/pingme.txt b/Source/Math/pingme.txt
deleted file mode 100644
index e69de29bb..000000000
diff --git a/KaldiReaderReadme b/Source/Readers/KaldiReaderReadme
similarity index 100%
rename from KaldiReaderReadme
rename to Source/Readers/KaldiReaderReadme