PHP Classes

File: TEST/Threading/Thread_dot.php

Recommend this page to a friend!
  Classes of Cuthbert Martin Lwinga   PHP Neural Net Library   TEST/Threading/Thread_dot.php   Download  
File: TEST/Threading/Thread_dot.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP Neural Net Library
Build, train, evaluate, and use neural networks
Author: By
Last change:
Date: 5 months ago
Size: 1,459 bytes
 

Contents

Class file image Download
<?php
ini_set
('memory_limit', '20480M'); // Increase the memory limit to 20480MB (20GB)

include_once("../../CLASSES/Headers.php");
use
NameSpaceNumpyLight\NumpyLight;


function
generateRandomMatrix($rows, $cols, $min = 0.0, $max = 1.0) {
   
$matrix = [];

    for (
$i = 0; $i < $rows; $i++) {
       
$row = [];
        for (
$j = 0; $j < $cols; $j++) {
           
$row[] = $min + mt_rand() / mt_getrandmax() * ($max - $min);
        }
       
$matrix[] = $row;
    }

    return
$matrix;
}


$rows = 2000; // Number of rows
$cols = 2000; // Number of columns
$min = 0.0000001; // Minimum float value
$max = 0.0000008; // Maximum float value


$matrixA = generateRandomMatrix($rows, $cols, $min, $max);

$startTime = microtime(true); // Start time 3.8503890037537 seconds.
$dotproductOutput = (NumpyLight::dot($matrixA,$matrixA));
$endTime = microtime(true); // End time
$executionTime = $endTime - $startTime; // Calculate execution time
echo "Task dot with threading operation with caller function test executed time $executionTime seconds.\n";


// $startTime = microtime(true); // Start time 3.8503890037537 seconds.
// $dotproductOutput = (NumpyLight::jacobiansdf_matrix($matrixA,$matrixA));
// $endTime = microtime(true); // End time
// $executionTime = $endTime - $startTime; // Calculate execution time
// echo "Task dot with threading operation with caller function test executed time $executionTime seconds.\n";

// var_dump($dotproductOutput)
?>