PHP Classes

File: CLASSES/dot.cpp

Recommend this page to a friend!
  Classes of Cuthbert Martin Lwinga   PHP Neural Net Library   CLASSES/dot.cpp   Download  
File: CLASSES/dot.cpp
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Neural Net Library
Build, train, evaluate, and use neural networks
Author: By
Last change:
Date: 4 months ago
Size: 1,364 bytes
 

Contents

Class file image Download
// Main.cpp #include <iostream> #include <chrono> #include "Utility.h" #include "Matrix.h" int main(int argc, char* argv[]) { if (argc != 3) { std::cerr << "Usage: " << argv[0] << " <file-path> <output-file-path>" << std::endl; return 1; } auto start_time = std::chrono::high_resolution_clock::now(); std::string filePath(argv[1]); std::string outputFilePath(argv[2]); std::string jsonData = readJsonFromFile(filePath); if (jsonData.empty()) { std::cerr << "Failed to read JSON data from the file." << std::endl; return 1; } std::vector<std::vector<float>> matrixA = extractMatrixData(jsonData, "a"); std::vector<std::vector<float>> matrixB = extractMatrixData(jsonData, "b"); Matrix<float> a(1,1); Matrix<float> b(1,1); a.initialize(matrixA); b.initialize(matrixB); Matrix<float> output = a.dot(b); // output.print(); if (saveToJSON(outputFilePath, output.getData())) { std::cout << "Successful" << std::endl; } else { std::cout << "Fail" << std::endl; } auto end_time = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time); // std::cout<<std::endl<< "Elapsed time: " << duration.count() << " milliseconds" << std::endl; return 0; }