Files
panic/main.cpp
T
Bausager a791201f3a Matrix
First matrix implementation with print_matrix in io
2026-06-23 20:28:11 +02:00

93 lines
3.4 KiB
C++

/**++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* PANIC
* Portable Algorithms and Numerics In C++
*
* Scientific computing from scratch, with feeling.
*
* Copyright (c) 2026 Michelle Bausager
*
* This file is part of PANIC.
*
* PANIC is free software licensed under the GNU General Public License v3.0 or later.
* You may redistribute and/or modify it under the terms of the GPL.
*
* PANIC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the LICENSE file for the full license text.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* Project Name: PANIC
* Module Name: <module-name>
* File Name: <file-name>
* Revision: 0.1.0
* Date: <yyyy-mm-dd>
* Author: Michelle Bausager
*
* Description:
* <short description of what this file/module does>
*
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
//---------------------------------------------------------------------------------------------------------------------------
// INCLUDE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
#include <iostream> // std::cout, std::endl
#include <config/types.hpp> // include types to use
#include <config/constants.hpp> // Math constants
#include <tensor/vector.hpp>
#include <tensor/matrix.hpp>
#include <io/print_tensor.hpp>
//---------------------------------------------------------------------------------------------------------------------------
// DEFINE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// difinitions like:
// #define TEST_FALG 1
//---------------------------------------------------------------------------------------------------------------------------
// VARIABLE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// Variable difinition like:
panic::real_t x = 2.4;
//---------------------------------------------------------------------------------------------------------------------------
// FUNCTION PROTOTYPE
//---------------------------------------------------------------------------------------------------------------------------
// Function prototypes like:
// static void TestLeds(void);
int main(void) {
panic::tensor::real_vector a(3);
panic::tensor::uint_vector b(3);
panic::tensor::int_vector c(10);
a[2] = 1.2;
b[2] = 3;
c[2] = -3;
panic::io::print_vector(a);
panic::io::print_vector(b);
panic::io::print_vector(c);
std::cout << a[100] << std::endl;
std::cout << a.at(100) << std::endl;
std::cout << panic::constants::pi << std::endl;
std::cout << 1.23249238423847 << std::endl;
panic::tensor::real_matrix A(2,2, 1);
panic::tensor::uint_matrix B(2,2, 2);
panic::tensor::int_matrix C(2,2, 3);
A(1,0) = 1.2;
B(1,0) = 3;
C(1,0) = -2;
panic::io::print_matrix(A);
panic::io::print_matrix(B);
panic::io::print_matrix(C);
return 0;
}