<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NumRS2 WebAssembly Demo</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: white;
border-radius: 12px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
overflow: hidden;
}
header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 30px;
text-align: center;
}
header h1 {
font-size: 2.5em;
margin-bottom: 10px;
}
header p {
font-size: 1.1em;
opacity: 0.9;
}
.content {
padding: 30px;
}
.section {
margin-bottom: 30px;
padding: 20px;
background: #f8f9fa;
border-radius: 8px;
}
.section h2 {
color: #667eea;
margin-bottom: 15px;
font-size: 1.8em;
}
.section h3 {
color: #764ba2;
margin: 20px 0 10px 0;
font-size: 1.3em;
}
.controls {
display: flex;
gap: 10px;
margin-bottom: 15px;
flex-wrap: wrap;
}
button {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
padding: 12px 24px;
border-radius: 6px;
cursor: pointer;
font-size: 1em;
font-weight: 600;
transition: transform 0.2s, box-shadow 0.2s;
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
button:active {
transform: translateY(0);
}
button:disabled {
background: #ccc;
cursor: not-allowed;
}
.output {
background: white;
border: 2px solid #e0e0e0;
border-radius: 6px;
padding: 15px;
font-family: 'Courier New', monospace;
font-size: 0.9em;
white-space: pre-wrap;
max-height: 300px;
overflow-y: auto;
color: #333;
}
.output.error {
border-color: #ff4444;
background: #ffebee;
color: #c62828;
}
.output.success {
border-color: #4caf50;
background: #e8f5e9;
color: #2e7d32;
}
.info-box {
background: #e3f2fd;
border-left: 4px solid #2196f3;
padding: 15px;
margin: 15px 0;
border-radius: 4px;
}
.info-box strong {
color: #1976d2;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin-top: 20px;
}
.card {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.card h4 {
color: #667eea;
margin-bottom: 10px;
}
.loading {
text-align: center;
padding: 40px;
color: #667eea;
font-size: 1.2em;
}
.spinner {
border: 4px solid #f3f3f3;
border-top: 4px solid #667eea;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 20px auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
footer {
background: #f8f9fa;
padding: 20px;
text-align: center;
color: #666;
border-top: 1px solid #e0e0e0;
}
footer a {
color: #667eea;
text-decoration: none;
font-weight: 600;
}
footer a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>NumRS2 WebAssembly Demo</h1>
<p>High-Performance Numerical Computing in Your Browser</p>
</header>
<div class="content">
<div id="loading" class="loading">
<div class="spinner"></div>
<p>Loading NumRS2 WebAssembly module...</p>
</div>
<div id="main-content" style="display: none;">
<div class="info-box">
<strong>Status:</strong> NumRS2 WASM module loaded successfully!
<span id="version-info"></span>
<span id="simd-info"></span>
</div>
<div class="section">
<h2>Array Operations</h2>
<h3>Basic Array Creation</h3>
<div class="controls">
<button onclick="createZerosArray()">Create Zeros Array</button>
<button onclick="createOnesArray()">Create Ones Array</button>
<button onclick="createArangeArray()">Create Arange Array</button>
<button onclick="createRandomArray()">Create Random Array</button>
</div>
<div id="array-output" class="output">Click a button to create an array...</div>
<h3>Array Arithmetic</h3>
<div class="controls">
<button onclick="arrayAddition()">Array Addition</button>
<button onclick="arrayMultiplication()">Array Multiplication</button>
<button onclick="arrayBroadcasting()">Broadcasting Example</button>
</div>
<div id="arithmetic-output" class="output">Click a button to perform operations...</div>
</div>
<div class="section">
<h2>Linear Algebra</h2>
<div class="controls">
<button onclick="matrixMultiply()">Matrix Multiplication</button>
<button onclick="matrixTranspose()">Matrix Transpose</button>
<button onclick="matrixDeterminant()">Determinant</button>
<button onclick="matrixInverse()">Matrix Inverse</button>
</div>
<div id="linalg-output" class="output">Click a button to perform linear algebra...</div>
</div>
<div class="section">
<h2>Statistics</h2>
<div class="controls">
<button onclick="computeStats()">Compute Statistics</button>
<button onclick="computeCorrelation()">Correlation Matrix</button>
<button onclick="generateDistribution()">Random Distribution</button>
</div>
<div id="stats-output" class="output">Click a button to compute statistics...</div>
</div>
<div class="section">
<h2>Performance Benchmark</h2>
<p>Compare NumRS2 WASM performance with native JavaScript</p>
<div class="controls">
<button onclick="benchmarkArrayOps()">Benchmark Array Operations</button>
<button onclick="benchmarkMatrixOps()">Benchmark Matrix Operations</button>
</div>
<div id="benchmark-output" class="output">Click a button to run benchmarks...</div>
</div>
</div>
</div>
<footer>
<p>NumRS2 - Pure Rust Numerical Computing Library</p>
<p>
<a href="https://github.com/cool-japan/numrs" target="_blank">GitHub</a> |
<a href="https://docs.rs/numrs2" target="_blank">Documentation</a>
</p>
<p style="margin-top: 10px; font-size: 0.9em;">
Part of the <strong>COOLJAPAN</strong> Ecosystem - 100% Pure Rust, Zero C Dependencies
</p>
</footer>
</div>
<script type="module" src="./app.js"></script>
</body>
</html>