KIDS  ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
Loading...
Searching...
No Matches
debug_utils.h File Reference

provide utils for debugging the code More...

#include <iomanip>
#include <iostream>
#include "kids/fmt.h"
Include dependency graph for debug_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PRINT_ARRAY(_A, _n1, _n2)
 
#define PRINT_ARRAY_8(_A, _n1, _n2)
 

Detailed Description

provide utils for debugging the code

utils printing prettly in the format of numpy array.

Author
Xin He
Date
2024-03
Version
1.0
Warning
Do not include this file to any header. You'd better include it only in source files!
[logs]:
Date Description
2024-03-29 initial version.

Definition in file debug_utils.h.

Macro Definition Documentation

◆ PRINT_ARRAY

#define PRINT_ARRAY ( _A,
_n1,
_n2 )
Value:
({ \
std::cout << #_A << " = np.array([\n"; \
int _idxA = 0; \
for (int _i = 0; _i < (_n1); ++_i) { \
for (int _j = 0; _j < (_n2); ++_j) std::cout << FMT(4) << (_A)[_idxA++] << ","; \
std::cout << std::endl; \
} \
{ std::cout << "])\n"; } \
})
#define FMT(X)
Definition fmt.h:40

Definition at line 37 of file debug_utils.h.

◆ PRINT_ARRAY_8

#define PRINT_ARRAY_8 ( _A,
_n1,
_n2 )
Value:
({ \
std::cout << #_A << " = np.array([\n"; \
int _idxA = 0; \
for (int _i = 0; _i < (_n1); ++_i) { \
for (int _j = 0; _j < (_n2); ++_j) std::cout << FMT(8) << (_A)[_idxA++] << ","; \
std::cout << std::endl; \
} \
{ std::cout << "])\n"; } \
})

Definition at line 48 of file debug_utils.h.