aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/examples
diff options
context:
space:
mode:
authorGravatar Carlos Becker <carlosbecker@gmail.com>2010-07-08 18:16:39 +0100
committerGravatar Carlos Becker <carlosbecker@gmail.com>2010-07-08 18:16:39 +0100
commit951da96f146f3c6dc806a9e3d0fbbd96bbeb495b (patch)
treebf11f91e8ad4549e09d4f410ed39bef0b107c184 /doc/examples
parentcb3aad1d91082dcf5edc6e5fe0fe883bbe816ebc (diff)
Added more redux types/examples in tutorial and fixed some display issues
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp24
-rw-r--r--doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp28
-rw-r--r--doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp~28
3 files changed, 80 insertions, 0 deletions
diff --git a/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp b/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp
new file mode 100644
index 000000000..10916877f
--- /dev/null
+++ b/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp
@@ -0,0 +1,24 @@
+#include <Eigen/Dense>
+#include <iostream>
+
+using namespace std;
+using namespace Eigen;
+
+int main()
+{
+ MatrixXf m(2,2), n(2,2);
+
+ m << 0,2,
+ 3,4;
+
+ n << 1,2,
+ 3,4;
+
+ cout << "m.all() = " << m.all() << endl;
+ cout << "m.any() = " << m.any() << endl;
+ cout << "m.count() = " << m.count() << endl;
+ cout << endl;
+ cout << "n.all() = " << n.all() << endl;
+ cout << "n.any() = " << n.any() << endl;
+ cout << "n.count() = " << n.count() << endl;
+}
diff --git a/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp b/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp
new file mode 100644
index 000000000..f3364d7fc
--- /dev/null
+++ b/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp
@@ -0,0 +1,28 @@
+#include <Eigen/Dense>
+#include <iostream>
+
+using namespace std;
+using namespace Eigen;
+
+int main()
+{
+ VectorXf v(2);
+ MatrixXf m(2,2), n(2,2);
+
+ v << 5,
+ 10;
+
+ m << 2,2,
+ 3,4;
+
+ n << 1, 2,
+ 32,12;
+
+ cout << "v.norm() = " << v.norm() << endl;
+ cout << "m.norm() = " << m.norm() << endl;
+ cout << "n.norm() = " << n.norm() << endl;
+ cout << endl;
+ cout << "v.squaredNorm() = " << v.squaredNorm() << endl;
+ cout << "m.squaredNorm() = " << m.squaredNorm() << endl;
+ cout << "n.squaredNorm() = " << n.squaredNorm() << endl;
+}
diff --git a/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp~ b/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp~
new file mode 100644
index 000000000..03057f8d2
--- /dev/null
+++ b/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp~
@@ -0,0 +1,28 @@
+#include <Eigen/Dense>
+#include <iostream>
+
+using namespace std;
+using namespace Eigen;
+
+int main()
+{
+ VectorXf v(2);
+ MatrixXf m(2,2), n(2,2);
+
+ v << 2,
+ 5;
+
+ m << 0,2,
+ 3,4;
+
+ n << 1,2,
+ 3,4;
+
+ cout << "v.norm() = " << m.norm() << endl;
+ cout << "m.norm() = " << m.norm() << endl;
+ cout << "n.norm() = " << m.norm() << endl;
+ cout << endl;
+ cout << "v.squaredNorm() = " << v.squaredNorm() << endl;
+ cout << "m.squaredNorm() = " << m.squaredNorm() << endl;
+ cout << "n.squaredNorm() = " << n.squaredNorm() << endl;
+}