initial push

This commit is contained in:
2026-06-23 09:35:43 +02:00
parent 683a33967d
commit b842990cd4
44 changed files with 4738 additions and 92 deletions
+96
View File
@@ -0,0 +1,96 @@
/**++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* 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: config
* File Name: constants.hpp
* Revision: 0.1.0
* Date: 20-06-2026
* Author: Michelle Bausager
*
* Description:
* Defines which types will be used in the rest of the libraries.
*
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma once
//---------------------------------------------------------------------------------------------------------------------------
// INCLUDE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
#include <config/types.hpp> // Use to define types.
//---------------------------------------------------------------------------------------------------------------------------
// DEFINE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
// TYPE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
// VARIABLE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
namespace panic {
//---------------------------------------------------------------------------------------------------------------------------
// Type Name : panic::pi
//
// Description:
// Default difinition of pi (3.14159265358979323846) used inside PANIC.
// static_cast makes sure the right number of decimals are used when defining the constant.
//
// Underlying Type:
// panic::real_t
//---------------------------------------------------------------------------------------------------------------------------
static const panic::real_t pi = static_cast<panic::real_t>(3.14159265358979323846);
//---------------------------------------------------------------------------------------------------------------------------
//
// Type Name : panic::tau
//
// Description:
// Default difinition of tau (6.28318530717958647692) used inside PANIC.
// static_cast makes sure the right number of decimals are used when defining the constant.
//
// Underlying Type:
// panic::real_t
//---------------------------------------------------------------------------------------------------------------------------
static const panic::real_t tau = static_cast<panic::real_t>(6.28318530717958647692);
//---------------------------------------------------------------------------------------------------------------------------
//
// Type Name : panic::e
//
// Description:
// Default difinition of eulers number, e (2.71828182845904523536) used inside PANIC.
// static_cast makes sure the right number of decimals are used when defining the constant.
//
// Underlying Type:
// panic::real_t
//---------------------------------------------------------------------------------------------------------------------------
static const panic::real_t e = static_cast<panic::real_t>(2.71828182845904523536);
} // namespace panic
//---------------------------------------------------------------------------------------------------------------------------
// FUNCTION PROTOTYPE
//---------------------------------------------------------------------------------------------------------------------------
+90
View File
@@ -0,0 +1,90 @@
/**++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* 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: config
* File Name: types.hpp
* Revision: 0.1.0
* Date: 20-06-2026
* Author: Michelle Bausager
*
* Description:
* Defines which types will be used in the rest of the libraries.
*
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma once
//---------------------------------------------------------------------------------------------------------------------------
// INCLUDE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
#include <cstdint> // used for uintx_t and intx_t types.
//---------------------------------------------------------------------------------------------------------------------------
// DEFINE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
// TYPE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// Type Name : panic::uint_t
//
// Description:
// Default unsigned integer type used inside PANIC.
//
// Underlying Type:
// uint32_t
//---------------------------------------------------------------------------------------------------------------------------
//
// Type Name : panic::int_t
//
// Description:
// Default signed integer type used inside PANIC.
//
// Underlying Type:
// int32_t
//---------------------------------------------------------------------------------------------------------------------------
//
// Type Name : panic::real_t
//
// Description:
// Default floating-point type used inside PANIC.
//
// Underlying Type:
// float
//---------------------------------------------------------------------------------------------------------------------------
namespace panic {
typedef uint32_t uint_t;
typedef int32_t int_t;
typedef float real_t;
} // namespace panic
//---------------------------------------------------------------------------------------------------------------------------
// VARIABLE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
// FUNCTION PROTOTYPE
//---------------------------------------------------------------------------------------------------------------------------
+80
View File
@@ -0,0 +1,80 @@
/**++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* 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: io
* File Name: print_tensor.hpp
* Revision: 0.1.0
* Date: 21-06-2026
* Author: Michelle Bausager
*
* Description:
* Functions to print out tensors with std::cout << x std::endl;
*
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma one
//---------------------------------------------------------------------------------------------------------------------------
// INCLUDE DESCRIPTION
//-----------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
// DEFINE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
// VARIABLE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
// FUNCTION PROTOTYPE
//---------------------------------------------------------------------------------------------------------------------------
namespace panic{
namespace io{
//--------------------------------------------------------------------------------------------------------------------------
// Function Name : panic::io::print
//
// Description:
// Prints a panic::tensor::vector out in the terminal
//
// Inputs:
// v const panic::tensor::vector&
// vector to print
//
// Outputs:
// None.
//
// Returns:
// void
//
// Notes:
// The vector is printed out in square brackets.
//--------------------------------------------------------------------------------------------------------------------------
void print(const panic::tensor::vector& v);
} // namespace io
} // namespace panic
+80
View File
@@ -0,0 +1,80 @@
/**++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* 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: math
* File Name: sqrt_serial.c
* Revision: 0.1.0
* Date: <yyyy-mm-dd>
* Author: Michelle Bausager
*
* Description:
* <short description of what this file/module does>
*
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#ifndef __SQRT_SERIAL_H_
#define __SQRT_SERIAL_H_
//---------------------------------------------------------------------------------------------------------------------------
// INCLUDE FILE
//---------------------------------------------------------------------------------------------------------------------------
// includes like:
// #include <stdint.h>
//---------------------------------------------------------------------------------------------------------------------------
// DEFINE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// difinitions like:
// #define TEST_FALG 1
//---------------------------------------------------------------------------------------------------------------------------
// ENUM DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// LIKE
//typedef enum
//{
// eConfDac0 = 0x00,
// eConfDac1 = 0x01,
// eConfDac2 = 0x02
//} enDebugBoardDacType_t;
//---------------------------------------------------------------------------------------------------------------------------
// VARIABLE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// Variable difinition like:
// static uint32_t AmountOfCool = 0;
//---------------------------------------------------------------------------------------------------------------------------
// FUNCTION PROTOTYPE
//---------------------------------------------------------------------------------------------------------------------------
// Function prototypes like:
T sqrt(T c);
//---------------------------------------------------------------------------------------------------------------------------
// End of module
//---------------------------------------------------------------------------------------------------------------------------
#endif
+80
View File
@@ -0,0 +1,80 @@
/**++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* 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: math
* File Name: sqrt_serial.c
* Revision: 0.1.0
* Date: <yyyy-mm-dd>
* Author: Michelle Bausager
*
* Description:
* <short description of what this file/module does>
*
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#ifndef __SQRT_SERIAL_H_
#define __SQRT_SERIAL_H_
//---------------------------------------------------------------------------------------------------------------------------
// INCLUDE FILE
//---------------------------------------------------------------------------------------------------------------------------
// includes like:
// #include <stdint.h>
//---------------------------------------------------------------------------------------------------------------------------
// DEFINE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// difinitions like:
// #define TEST_FALG 1
//---------------------------------------------------------------------------------------------------------------------------
// ENUM DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// LIKE
//typedef enum
//{
// eConfDac0 = 0x00,
// eConfDac1 = 0x01,
// eConfDac2 = 0x02
//} enDebugBoardDacType_t;
//---------------------------------------------------------------------------------------------------------------------------
// VARIABLE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// Variable difinition like:
// static uint32_t AmountOfCool = 0;
//---------------------------------------------------------------------------------------------------------------------------
// FUNCTION PROTOTYPE
//---------------------------------------------------------------------------------------------------------------------------
// Function prototypes like:
T sqrt(T c);
//---------------------------------------------------------------------------------------------------------------------------
// End of module
//---------------------------------------------------------------------------------------------------------------------------
#endif
+80
View File
@@ -0,0 +1,80 @@
/**++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* 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: math
* File Name: sqrt_serial.c
* Revision: 0.1.0
* Date: <yyyy-mm-dd>
* Author: Michelle Bausager
*
* Description:
* <short description of what this file/module does>
*
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#ifndef __SQRT_SERIAL_H_
#define __SQRT_SERIAL_H_
//---------------------------------------------------------------------------------------------------------------------------
// INCLUDE FILE
//---------------------------------------------------------------------------------------------------------------------------
// includes like:
// #include <stdint.h>
//---------------------------------------------------------------------------------------------------------------------------
// DEFINE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// difinitions like:
// #define TEST_FALG 1
//---------------------------------------------------------------------------------------------------------------------------
// ENUM DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// LIKE
//typedef enum
//{
// eConfDac0 = 0x00,
// eConfDac1 = 0x01,
// eConfDac2 = 0x02
//} enDebugBoardDacType_t;
//---------------------------------------------------------------------------------------------------------------------------
// VARIABLE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// Variable difinition like:
// static uint32_t AmountOfCool = 0;
//---------------------------------------------------------------------------------------------------------------------------
// FUNCTION PROTOTYPE
//---------------------------------------------------------------------------------------------------------------------------
// Function prototypes like:
T sqrt(T c);
//---------------------------------------------------------------------------------------------------------------------------
// End of module
//---------------------------------------------------------------------------------------------------------------------------
#endif
View File
+131
View File
@@ -0,0 +1,131 @@
/**++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* 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: tensor
* File Name: vector.hpp
* Revision: 0.1.0
* Date: 21-06-2026
* Author: Michelle Bausager
*
* Description:
* Defines the vector object that will be used in the rest of the libraries.
*
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma once
//---------------------------------------------------------------------------------------------------------------------------
// INCLUDE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
#include <config/types.hpp> // panic::uint_t, panic::int_t, and panic::real_t
//---------------------------------------------------------------------------------------------------------------------------
// DEFINE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
// TYPE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
// Type Name : panic::tensor::vector
//
// Description:
// Dynamic vector storing panic::real_t values.
// The vector owns its memory and releases it in the destructor.
//
// Member Variables:
// length panic::uint_t
// Number of elements in the vector.
//
// data panic::real_t*
// Pointer to the allocated vector data.
//
// Notes:
// This vector uses dynamic allocation with new[] and delete[].
// Copying performs a deep copy.
//---------------------------------------------------------------------------------------------------------------------------
namespace panic{
namespace tensor{
struct vector{
panic::uint_t length;
panic::real_t* data;
// empty contructor
vector();
// contructor with size allocation
vector(panic::uint_t size);
// contructor with size allocation and sets it all to a value
vector(panic::uint_t size, panic::real_t value);
// copy-contructor
// vector a(3);
// vector b = a;
vector(const vector& other);
// de-contructor, releases memory
~vector();
// copy-assignment
//vector a(5);
//vector b(3);
//b = a;
vector& operator=(const vector& other);
// function returns size.
// const tells compiler that the fuction don't edit the objert.
panic::uint_t size() const;
// function to resize data vector (I need a new that don't save the vlaues)
bool resize(panic::uint_t new_size);
// fill data with value
bool fill(panic::real_t value);
// lets you read and write v[index]
panic::real_t& operator[](panic::uint_t index);
// lets you read v[index] from a const vector
const panic::real_t& operator[](panic::uint_t index) const;
// lets you read and write v.at(index)
panic::real_t& at(panic::uint_t index);
// lets you read v.at(index) from a const vector
const panic::real_t& at(panic::uint_t index) const;
};
} // namespace tensor
} // namespace panic
//---------------------------------------------------------------------------------------------------------------------------
// VARIABLE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
// FUNCTION PROTOTYPE
//---------------------------------------------------------------------------------------------------------------------------