add vector

This commit is contained in:
csyer
2024-02-22 19:53:46 +08:00
parent b648f3923d
commit d65c91fee8
24 changed files with 3974 additions and 2 deletions

View File

@ -0,0 +1,80 @@
Test for classes without default constructor...
Test OK...
Test for my Matrix...
1.00000000
2.00000000 2.00000000
2.00000000 2.00000000
3.00000000 3.00000000 3.00000000
3.00000000 3.00000000 3.00000000
3.00000000 3.00000000 3.00000000
4.00000000 4.00000000 4.00000000 4.00000000
4.00000000 4.00000000 4.00000000 4.00000000
4.00000000 4.00000000 4.00000000 4.00000000
4.00000000 4.00000000 4.00000000 4.00000000
5.00000000 5.00000000 5.00000000 5.00000000 5.00000000
5.00000000 5.00000000 5.00000000 5.00000000 5.00000000
5.00000000 5.00000000 5.00000000 5.00000000 5.00000000
5.00000000 5.00000000 5.00000000 5.00000000 5.00000000
5.00000000 5.00000000 5.00000000 5.00000000 5.00000000
6.00000000 6.00000000 6.00000000 6.00000000 6.00000000 6.00000000
6.00000000 6.00000000 6.00000000 6.00000000 6.00000000 6.00000000
6.00000000 6.00000000 6.00000000 6.00000000 6.00000000 6.00000000
6.00000000 6.00000000 6.00000000 6.00000000 6.00000000 6.00000000
6.00000000 6.00000000 6.00000000 6.00000000 6.00000000 6.00000000
6.00000000 6.00000000 6.00000000 6.00000000 6.00000000 6.00000000
7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000
7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000
7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000
7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000
7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000
7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000
7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000 7.00000000
8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000
8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000
8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000
8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000
8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000
8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000
8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000
8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000 8.00000000
9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000
9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000
9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000
9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000
9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000
9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000
9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000
9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000
9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000 9.00000000
10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000
10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000
10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000
10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000
10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000
10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000
10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000
10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000
10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000
10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000 10.00000000
Test for big integer
1267650600228229401496703205376 1267650600228231653296516890625 1267650600228233905096330575876 1267650600228236156896144261129 1267650600228238408695957946384 1267650600228240660495771631641 1267650600228242912295585316900 1267650600228245164095399002161 1267650600228247415895212687424 1267650600228249667695026372689

View File

@ -0,0 +1,51 @@
#include "vector.hpp"
#include "class-integer.hpp"
#include "class-matrix.hpp"
#include "class-bint.hpp"
#include <iostream>
#include <fstream>
#include <string>
void TestInteger()
{
std::cout << "Test for classes without default constructor..." << std::endl;
sjtu::vector<Integer> vInt;
for (int i = 1; i <= 100; ++i) {
vInt.push_back(Integer(i));
}
std::cout << "Test OK..." << std::endl;
}
void TestMatrix()
{
std::cout << "Test for my Matrix..." << std::endl;
sjtu::vector<Diamond::Matrix<double>> vM;
for (int i = 1; i <= 10; ++i) {
vM.push_back(Diamond::Matrix<double>(i, i, i));
}
for (size_t i = 0; i < vM.size(); ++i) {
std::cout << vM[i] << std::endl;
}
}
void TestBint()
{
std::cout << "Test for big integer" << std::endl;
sjtu::vector<Util::Bint> vBint;
for (long long i = 1LL << 50; i < (1LL << 50) + 10; ++i) {
vBint.push_back(Util::Bint(i) * i);
}
for (sjtu::vector<Util::Bint>::iterator it = vBint.begin(); it != vBint.end(); ++it) {
std::cout << *it << " ";
}
std::cout << std::endl;
}
int main()
{
TestInteger();
TestMatrix();
TestBint();
}