Compare commits
33 Commits
648c2e491e
...
3ebb0d3fe0
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ebb0d3fe0 | |||
|
|
c7ebbe30c1 | ||
|
|
2fa852a050 | ||
|
|
36fe9135db | ||
|
|
05e935f552 | ||
|
|
6b7594cc90 | ||
|
|
9e52a78022 | ||
|
|
7a8ab669d6 | ||
|
|
d59d60b1a7 | ||
| 42793522a4 | |||
|
|
8163a68e03 | ||
|
|
3a038ef50b | ||
|
|
8b6a356349 | ||
|
|
604aa44e57 | ||
|
|
d0e703751a | ||
|
|
8b5f80d6dc | ||
|
|
9f6fa4cb8e | ||
|
|
2b2ad436f0 | ||
|
|
88a147e0a1 | ||
|
|
eab3317ae6 | ||
|
|
ee6b026c61 | ||
|
|
7a94de5af8 | ||
|
|
d003a2e7d8 | ||
|
|
2471231943 | ||
|
|
012981baf7 | ||
| a0c53bf689 | |||
|
|
14a8c11a71 | ||
|
|
97a17a892d | ||
|
|
781a1e75e2 | ||
|
|
608e09c9a0 | ||
|
|
6ba17c1122 | ||
| 9a6fab980c | |||
| cb2ef7113a |
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
|
||||
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
||||
project(pip)
|
||||
set(pip_MAJOR 2)
|
||||
set(pip_MINOR 5)
|
||||
set(pip_MINOR 6)
|
||||
set(pip_REVISION 0)
|
||||
set(pip_SUFFIX _beta)
|
||||
set(pip_COMPANY SHS)
|
||||
|
||||
@@ -785,9 +785,9 @@ inline PIString operator +(const char c, const PIString & f) {return PIChar(c) +
|
||||
inline PIString operator +(const PIString & f, const char c) {return f + PIChar(c);}
|
||||
|
||||
|
||||
int versionCompare(const PIString & v0, const PIString & v1, int components = 6);
|
||||
int PIP_EXPORT versionCompare(const PIString & v0, const PIString & v1, int components = 6);
|
||||
|
||||
PIString versionNormalize(const PIString & v);
|
||||
PIString PIP_EXPORT versionNormalize(const PIString & v);
|
||||
|
||||
|
||||
|
||||
|
||||
1
main.cpp
1
main.cpp
@@ -1,6 +1,7 @@
|
||||
#include "pip.h"
|
||||
|
||||
int main() {
|
||||
versionCompare("","");
|
||||
PICloudServer s("127.0.0.1:10101");
|
||||
s.startThreadedRead();
|
||||
piSleep(10);
|
||||
|
||||
@@ -52,6 +52,25 @@ TEST(PIMathMatrixT_Test, element) {
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(PIMathMatrixT_Test, element) {
|
||||
auto matrix = PIMathMatrix<double>::identity(3, 3);
|
||||
for(int i = 0; i < 3; i++){
|
||||
for(int j = 0; j < 3; j++){
|
||||
if(i != j){
|
||||
if(matrix[i][j] != 0.0){
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(matrix.element(i,i) != 1.0) {
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(PIMathMatrix_Test, matrixRow) {
|
||||
PIMathVector<double> vector;
|
||||
vector.resize(3, 3.0);
|
||||
@@ -554,3 +573,58 @@ TEST(PIMathMatrix_Test, hermitian) {
|
||||
}
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(PIMathMatrix_Test, matrixMultiplication)
|
||||
{
|
||||
PIMathMatrix<double> matrix1(2, 2, 1.5);
|
||||
PIMathMatrix<double> matrix2(2, 2, 2.5);
|
||||
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1 * matrix2, 7.5, 2));
|
||||
}
|
||||
|
||||
TEST(PIMathMatrix_Test, matrixAndVectorMultiplication) {
|
||||
PIMathMatrix<double> matrix1(2, 2, 1.5);
|
||||
PIMathVector<double> vector;
|
||||
vector.resize(2, 2.5);
|
||||
for(uint i = 0; i < 2; i++) {
|
||||
if((matrix1 * vector)[i] != 7.5) {
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(PIMathMatrix_Test, vectorAndMatrixMultiplication) {
|
||||
PIMathMatrix<double> matrix1(2, 2, 1.5);
|
||||
PIMathVector<double> vector;
|
||||
vector.resize(2, 2.5);
|
||||
for(uint i = 0; i < 2; i++) {
|
||||
if((vector * matrix1)[i] != 7.5) {
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(PIMathMatrix_Test, valAndMatrixMultiplication) {
|
||||
PIMathMatrix<double> matrix1(3, 3, 1.5);
|
||||
ASSERT_TRUE(cmpSquareMatrixWithValue(25.0*matrix1, 37.5, 3));
|
||||
}
|
||||
|
||||
TEST(PIMathMatrix_Test, hermitian) {
|
||||
complex<double> val;
|
||||
complex<double> res;
|
||||
val.imag(1.0);
|
||||
val.real(1.0);
|
||||
PIMathMatrix<complex<double>> matrix(3, 3, val);
|
||||
res.imag(-1.0);
|
||||
res.real(1.0);
|
||||
auto matr = hermitian(matrix);
|
||||
for(uint i = 0; i < 3; i++) {
|
||||
for(uint j = 0; j < 3; j++) {
|
||||
if(matr.element(i, j) != res) {
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ TEST(PIMathMatrixT_Test, identity) {
|
||||
}
|
||||
}
|
||||
}
|
||||
>>>>>>> 05a32cc... doc correction
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
@@ -297,7 +298,8 @@ TEST(PIMathMatrixT_Test, operator_Addition_Assignment) {
|
||||
auto matrix1 = PIMathMatrixT<rows, cols, double>::filled(6.72) ;
|
||||
auto matrix2 = PIMathMatrixT<rows, cols, double>::filled(1.0) ;
|
||||
matrix1 += matrix2;
|
||||
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1, 7.72, rows));
|
||||
b = cmpSquareMatrixWithValue(matrix1, 7.72, rows);
|
||||
ASSERT_TRUE(b);
|
||||
}
|
||||
|
||||
TEST(PIMathMatrixT_Test, operator_Subtraction_Assignment) {
|
||||
|
||||
Reference in New Issue
Block a user