Home | Develop | Download | Contact
example_vector_create.cpp
1
70#include <Pds/Ra>
71#include <cmath>
72
73int main(void)
74{
75 Pds::Matrix Mat("0 2\n1 3");
76
78 R.In(0)=0;R.In(1)=1;R.In(2)=2;
79 R.In(3)=3;R.In(4)=4;R.In(5)=5;
80
81 Pds::Vector A(2); // All zeros
82 Pds::Vector B(Mat); // Vectorize matrix
83 Pds::Vector C(Mat,1); // Use column 1 of matrix Mat
84 Pds::Vector D("1 2\n4 5"); // Load from string and ignores \n
85 Pds::Vector E(Mat.Size()); // Vectorize size
86 Pds::Vector F(cos,A); // Evaluate cos(A)
87 Pds::Vector G(cos,Mat); // Vectorize matrix and evaluate cos(Mat)
88 Pds::Vector H(3,-1.2); // Initialize all -1.2
89
90 A.T().Print("\nA.T():\n"); // Transpose of A
91 B.T().Print("\nB.T():\n"); // Transpose of B
92 C.T().Print("\nC.T():\n"); // Transpose of C
93 D.T().Print("\nD.T():\n"); // Transpose of D
94 E.T().Print("\nE.T():\n"); // Transpose of E
95 F.T().Print("\nF.T():\n"); // Transpose of F
96 G.T().Print("\nG.T():\n"); // Transpose of G
97 H.T().Print("\nH.T():\n"); // Transpose of H
98
99 Pds::Ra::SaveString("filedat.txt","1 2 3\n4 5 6\n");
100 Pds::Vector I(Pds::Ra::TextFormat,"filedat.txt"); // Load from string and ignores \n
101
102 I.T().Print("\nI.T():\n"); // Transpose of I
103
104 A=Mat;
105 A.Print("\nA:\n");
106
107 A.Copy(Mat);
108 A.Print("\nA.Copy(Mat):\n");
109
110 A.Copy(R);
111 A.Print("\nA.Copy(R):\n");
112
113 std::cout<<"H.ToString():\n"<<H.ToString();
114
115 return 0;
116}
La clase tipo Array . Esta clase genera una agrupación de 2 datos. Para usar incluir Pds/Array.
Definition: Array.hpp:71
La clase tipo Pds::Matrix . Esta clase genera una matriz de Nlin lineas y Ncol columnas....
Definition: Matrix.hpp:96
La clase tipo Pds::Vector . Esta clase genera una matriz de Nlin lineas y 1 columna....
Definition: Vector.hpp:80
@ TextFormat
Definition: RaDefines.hpp:373
bool SaveString(const std::string &filepath, const std::string &str)
Save the string in a text file.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed