Home
|
Develop
|
Download
|
Contact
test
example_vector_create.cpp
1
48
#include <Pds/Ra>
49
#include <cmath>
50
51
int
main(
void
)
52
{
53
Pds::Matrix
Mat(
"0 2\n1 3"
);
54
55
Pds::Vector
A(2);
// All zeros
56
Pds::Vector
B(Mat);
// Vectorize matrix
57
Pds::Vector
C(Mat,1);
// Use column 1 of matrix Mat
58
Pds::Vector
D(
"1 2\n4 5"
);
// Load from string and ignores \n
59
Pds::Vector
E(Mat.Size());
// Vectorize size
60
Pds::Vector
F(cos,A);
// Evaluate cos(A)
61
Pds::Vector
G(cos,Mat);
// Vectorize matrix and evaluate cos(Mat)
62
Pds::Vector
H(3,-1.2);
// Initialize all -1.2
63
64
A.T().Print(
"\nA.T():\n"
);
// Transpose of A
65
B.T().Print(
"\nB.T():\n"
);
// Transpose of B
66
C.T().Print(
"\nC.T():\n"
);
// Transpose of C
67
D.T().Print(
"\nD.T():\n"
);
// Transpose of D
68
E.T().Print(
"\nE.T():\n"
);
// Transpose of E
69
F.T().Print(
"\nF.T():\n"
);
// Transpose of F
70
G.T().Print(
"\nG.T():\n"
);
// Transpose of G
71
H.T().Print(
"\nH.T():\n"
);
// Transpose of H
72
73
Pds::Ra::SaveString
(
"filedat.txt"
,
"1 2 3\n4 5 6\n"
);
74
Pds::Vector
I(
Pds::Ra::TextFormat
,
"filedat.txt"
);
// Load from string and ignores \n
75
76
I.T().Print(
"\nI.T():\n"
);
// Transpose of I
77
78
return
0;
79
}
Pds::Matrix
La clase tipo Pds::Matrix . Esta clase genera una matriz de Nlin lineas y Ncol columnas....
Definition:
Matrix.hpp:86
Pds::Vector
La clase tipo Pds::Vector . Esta clase genera una matriz de Nlin lineas y 1 columna....
Definition:
Vector.hpp:78
Pds::Ra::TextFormat
@ TextFormat
Definition:
RaDefines.hpp:161
Pds::Ra::SaveString
bool SaveString(std::string filepath, std::string str)
Save the string in a text file.
Enlaces de interés
Manual de referencia generado el Domingo, 28 de Noviembre de 2021 01:25:50 para la biblioteca
libpdsramm
usando Generado el Domingo, 28 de Noviembre de 2021 01:25:50 para libpdsramm por
1.9.2