Project
Loading...
Searching...
No Matches
mathUtil.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include <cstdio>
13
14#include "mathUtil.h"
15
16namespace o2
17{
18namespace mch
19{
20void vectorPrint(const char* str, const double* x, int K)
21{
22 int nPackets = K / 10 + 1;
23
24 printf("%s %d ???%d\n", str, K, nPackets);
25 for (int i = 0; i < nPackets; i++) {
26 for (int k = 0; (k < 10) && ((i * 10 + k) < K); k++) {
27 printf(" %9.6g", x[i * 10 + k]);
28 }
29 printf("\n");
30 }
31 printf("\n");
32}
33
34void vectorPrintInt(const char* str, const int* x, int K)
35{
36 printf("%s", str);
37 for (int k = 0; k < K; k++) {
38 printf(" %3d", x[k]);
39 }
40 printf("\n");
41}
42
43void vectorPrintShort(const char* str, const short* x, int K)
44{
45 printf("%s", str);
46 for (int k = 0; k < K; k++) {
47 printf(" %3d", x[k]);
48 }
49 printf("\n");
50}
51
52void vectorPrint2Columns(const char* str, const double* x, const double* y,
53 int K)
54{
55 for (int k = 0; k < K; k++) {
56 printf("%s", str);
57 printf(" %6.3g %6.3g\n", x[k], y[k]);
58 printf("\n");
59 }
60}
61
62void printMatrixInt(const char* str, const int* matrix, int N, int M)
63{
64 printf("%s\n", str);
65 for (int i = 0; i < N; i++) {
66 for (int j = 0; j < M; j++) {
67 printf(" %2d", matrix[i * M + j]);
68 }
69 printf("\n");
70 }
71 printf("\n");
72}
73
74void printMatrixShort(const char* str, const short* matrix, int N, int M)
75{
76 printf("%s\n", str);
77 for (int i = 0; i < N; i++) {
78 for (int j = 0; j < M; j++) {
79 printf(" %2d", matrix[i * M + j]);
80 }
81 printf("\n");
82 }
83 printf("\n");
84}
85
86void printMatrixChar(const char* str, const char* matrix, int N, int M)
87{
88 printf("%s\n", str);
89 for (int i = 0; i < N; i++) {
90 for (int j = 0; j < M; j++) {
91 printf(" %2d", matrix[i * M + j]);
92 }
93 printf("\n");
94 }
95 printf("\n");
96}
97
98void printInterMap(const char* str, const PadIdx_t* inter, int N)
99{
100 const PadIdx_t* ij_ptr = inter;
101 printf("%s\n", str);
102 for (PadIdx_t i = 0; i < N; i++) {
103 printf("row/col %d:", i);
104 for (int k = 0; *ij_ptr != -1; k++, ij_ptr++) {
105 printf(" %2d", *ij_ptr);
106 }
107 // skip -1, row/col change
108 ij_ptr++;
109 printf("\n");
110 }
111 printf("\n");
112}
113
114} // namespace mch
115} // namespace o2
int32_t i
uint32_t j
Definition RawData.h:0
GLint GLenum GLint x
Definition glcorearb.h:403
void vectorPrintShort(const char *str, const short *x, int K)
Definition mathUtil.cxx:43
void printMatrixInt(const char *str, const int *matrix, int N, int M)
Definition mathUtil.cxx:62
void vectorPrint2Columns(const char *str, const double *x, const double *y, int K)
Definition mathUtil.cxx:52
void vectorPrint(const char *str, const double *x, int K)
Definition mathUtil.cxx:20
void printMatrixShort(const char *str, const short *matrix, int N, int M)
Definition mathUtil.cxx:74
void printInterMap(const char *str, const PadIdx_t *inter, int N)
Definition mathUtil.cxx:98
void printMatrixChar(const char *str, const char *matrix, int N, int M)
Definition mathUtil.cxx:86
void vectorPrintInt(const char *str, const int *x, int K)
Definition mathUtil.cxx:34
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
const std::string str