Skip to content
Snippets Groups Projects
Commit 5c22c7a7 authored by Aaron Franke's avatar Aaron Franke Committed by Rasmus Munk Larsen
Browse files

Make file formatting comply with POSIX and Unix standards

UTF-8, LF, no BOM, and newlines at the end of files
parent 5afdaa47
No related branches found
No related tags found
No related merge requests found
Showing
with 20 additions and 20 deletions
...@@ -2,4 +2,4 @@ MatrixXd m { ...@@ -2,4 +2,4 @@ MatrixXd m {
{1, 2, 3}, {1, 2, 3},
{4, 5, 6} {4, 5, 6}
}; };
cout << m << endl; cout << m << endl;
\ No newline at end of file
VectorXi v {{1, 2}}; VectorXi v {{1, 2}};
cout << v << endl; cout << v << endl;
\ No newline at end of file
Matrix<int, 1, 6> a(1, 2, 3, 4, 5, 6); Matrix<int, 1, 6> a(1, 2, 3, 4, 5, 6);
Matrix<int, 3, 1> b {1, 2, 3}; Matrix<int, 3, 1> b {1, 2, 3};
cout << a << "\n\n" << b << endl; cout << a << "\n\n" << b << endl;
\ No newline at end of file
ArrayXi ind(5); ind<<4,2,5,5,3; ArrayXi ind(5); ind<<4,2,5,5,3;
MatrixXi A = MatrixXi::Random(4,6); MatrixXi A = MatrixXi::Random(4,6);
cout << "Initial matrix A:\n" << A << "\n\n"; cout << "Initial matrix A:\n" << A << "\n\n";
cout << "A(all,ind-1):\n" << A(all,ind-1) << "\n\n"; cout << "A(all,ind-1):\n" << A(all,ind-1) << "\n\n";
\ No newline at end of file
...@@ -9,4 +9,4 @@ A.reshaped() = VectorXi::LinSpaced(9,1,9); ...@@ -9,4 +9,4 @@ A.reshaped() = VectorXi::LinSpaced(9,1,9);
cout << "Initial matrix A:\n" << A << "\n\n"; cout << "Initial matrix A:\n" << A << "\n\n";
MatrixXi B(5,5); MatrixXi B(5,5);
B = A(pad{3,5}, pad{3,5}); B = A(pad{3,5}, pad{3,5});
cout << "A(pad{3,N}, pad{3,N}):\n" << B << "\n\n"; cout << "A(pad{3,N}, pad{3,N}):\n" << B << "\n\n";
\ No newline at end of file
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
MatrixXi A = MatrixXi::Random(4,6); MatrixXi A = MatrixXi::Random(4,6);
cout << "Initial matrix A:\n" << A << "\n\n"; cout << "Initial matrix A:\n" << A << "\n\n";
cout << "A(all,{4,2,5,5,3}):\n" << A(all,{4,2,5,5,3}) << "\n\n"; cout << "A(all,{4,2,5,5,3}):\n" << A(all,{4,2,5,5,3}) << "\n\n";
#endif #endif
\ No newline at end of file
std::vector<int> ind{4,2,5,5,3}; std::vector<int> ind{4,2,5,5,3};
MatrixXi A = MatrixXi::Random(4,6); MatrixXi A = MatrixXi::Random(4,6);
cout << "Initial matrix A:\n" << A << "\n\n"; cout << "Initial matrix A:\n" << A << "\n\n";
cout << "A(all,ind):\n" << A(all,ind) << "\n\n"; cout << "A(all,ind):\n" << A(all,ind) << "\n\n";
\ No newline at end of file
...@@ -2,4 +2,4 @@ MatrixXf A(2,2), B(3,2); ...@@ -2,4 +2,4 @@ MatrixXf A(2,2), B(3,2);
B << 2, 0, 0, 3, 1, 1; B << 2, 0, 0, 3, 1, 1;
A << 2, 0, 0, -2; A << 2, 0, 0, -2;
A = (B * A).cwiseAbs(); A = (B * A).cwiseAbs();
cout << A; cout << A;
\ No newline at end of file
...@@ -3,4 +3,4 @@ M1 << 1, 2, 3, 4, 5, 6, ...@@ -3,4 +3,4 @@ M1 << 1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12; 7, 8, 9, 10, 11, 12;
Map<MatrixXf> M2(M1.data(), 6,2); Map<MatrixXf> M2(M1.data(), 6,2);
cout << "M2:" << endl << M2 << endl; cout << "M2:" << endl << M2 << endl;
\ No newline at end of file
...@@ -8,4 +8,4 @@ cout << "v1:" << endl << v1 << endl; ...@@ -8,4 +8,4 @@ cout << "v1:" << endl << v1 << endl;
Matrix<float,Dynamic,Dynamic,RowMajor> M2(M1); Matrix<float,Dynamic,Dynamic,RowMajor> M2(M1);
Map<RowVectorXf> v2(M2.data(), M2.size()); Map<RowVectorXf> v2(M2.data(), M2.size());
cout << "v2:" << endl << v2 << endl; cout << "v2:" << endl << v2 << endl;
\ No newline at end of file
...@@ -8,4 +8,4 @@ RowMajorMatrixXf M3(M1); ...@@ -8,4 +8,4 @@ RowMajorMatrixXf M3(M1);
cout << "Row major input:" << endl << M3 << "\n"; cout << "Row major input:" << endl << M3 << "\n";
Map<RowMajorMatrixXf,0,Stride<Dynamic,3> > M4(M3.data(), M3.rows(), (M3.cols()+2)/3, Map<RowMajorMatrixXf,0,Stride<Dynamic,3> > M4(M3.data(), M3.rows(), (M3.cols()+2)/3,
Stride<Dynamic,3>(M3.outerStride(),3)); Stride<Dynamic,3>(M3.outerStride(),3));
cout << "1 column over 3:" << endl << M4 << "\n"; cout << "1 column over 3:" << endl << M4 << "\n";
\ No newline at end of file
RowVectorXf v = RowVectorXf::LinSpaced(20,0,19); RowVectorXf v = RowVectorXf::LinSpaced(20,0,19);
cout << "Input:" << endl << v << endl; cout << "Input:" << endl << v << endl;
Map<RowVectorXf,0,InnerStride<2> > v2(v.data(), v.size()/2); Map<RowVectorXf,0,InnerStride<2> > v2(v.data(), v.size()/2);
cout << "Even:" << v2 << endl; cout << "Even:" << v2 << endl;
\ No newline at end of file
VectorXi v = VectorXi::Random(4); VectorXi v = VectorXi::Random(4);
cout << "Here is the vector v:\n"; cout << "Here is the vector v:\n";
for(auto x : v) cout << x << " "; for(auto x : v) cout << x << " ";
cout << "\n"; cout << "\n";
\ No newline at end of file
...@@ -2,4 +2,4 @@ Matrix2i A = Matrix2i::Random(); ...@@ -2,4 +2,4 @@ Matrix2i A = Matrix2i::Random();
cout << "Here are the coeffs of the 2x2 matrix A:\n"; cout << "Here are the coeffs of the 2x2 matrix A:\n";
for(auto x : A.reshaped()) for(auto x : A.reshaped())
cout << x << " "; cout << x << " ";
cout << "\n"; cout << "\n";
\ No newline at end of file
...@@ -2,4 +2,4 @@ MatrixXi m = Matrix4i::Random(); ...@@ -2,4 +2,4 @@ MatrixXi m = Matrix4i::Random();
cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl; cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl;
m.resize(2,8); m.resize(2,8);
cout << "Here is the matrix m after m.resize(2,8):" << endl << m << endl; cout << "Here is the matrix m after m.resize(2,8):" << endl << m << endl;
\ No newline at end of file
Array4i v = Array4i::Random().abs(); Array4i v = Array4i::Random().abs();
cout << "Here is the initial vector v:\n" << v.transpose() << "\n"; cout << "Here is the initial vector v:\n" << v.transpose() << "\n";
std::sort(v.begin(), v.end()); std::sort(v.begin(), v.end());
cout << "Here is the sorted vector v:\n" << v.transpose() << "\n"; cout << "Here is the sorted vector v:\n" << v.transpose() << "\n";
\ No newline at end of file
...@@ -2,4 +2,4 @@ ArrayXXi A = ArrayXXi::Random(4,4).abs(); ...@@ -2,4 +2,4 @@ ArrayXXi A = ArrayXXi::Random(4,4).abs();
cout << "Here is the initial matrix A:\n" << A << "\n"; cout << "Here is the initial matrix A:\n" << A << "\n";
for(auto row : A.rowwise()) for(auto row : A.rowwise())
std::sort(row.begin(), row.end()); std::sort(row.begin(), row.end());
cout << "Here is the sorted matrix A:\n" << A << "\n"; cout << "Here is the sorted matrix A:\n" << A << "\n";
\ No newline at end of file
...@@ -2,4 +2,4 @@ Matrix2i a; a << 1, 2, 3, 4; ...@@ -2,4 +2,4 @@ Matrix2i a; a << 1, 2, 3, 4;
cout << "Here is the matrix a:\n" << a << endl; cout << "Here is the matrix a:\n" << a << endl;
a = a.transpose(); // !!! do NOT do this !!! a = a.transpose(); // !!! do NOT do this !!!
cout << "and the result of the aliasing effect:\n" << a << endl; cout << "and the result of the aliasing effect:\n" << a << endl;
\ No newline at end of file
...@@ -3,4 +3,4 @@ cout << "Here is the initial matrix a:\n" << a << endl; ...@@ -3,4 +3,4 @@ cout << "Here is the initial matrix a:\n" << a << endl;
a.transposeInPlace(); a.transposeInPlace();
cout << "and after being transposed:\n" << a << endl; cout << "and after being transposed:\n" << a << endl;
\ No newline at end of file
...@@ -11,4 +11,4 @@ int main() ...@@ -11,4 +11,4 @@ int main()
#else #else
b.swap(ac.const_cast_derived()); b.swap(ac.const_cast_derived());
#endif #endif
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment