OSDN Git Service

12
[psychlops/silverlight.git] / dev5 / psychlops / core / math / matrix.cs
index de4a836..4d011e5 100644 (file)
@@ -6,6 +6,11 @@ namespace Psychlops
 \r
        public abstract class Matrix\r
        {\r
+               public static Matrix gen(int row, int col)\r
+               {\r
+                       return new Internal.MatrixImplementation(row, col);\r
+               }\r
+\r
                public abstract double this[int row, int col]\r
                {\r
                        get;\r
@@ -26,6 +31,16 @@ namespace Psychlops
                        return new Internal.MatrixExpression();\r
                }\r
                */\r
+               public void each(Func<double, double> f)\r
+               {\r
+                       for (int i = 1; i <= getRows(); i++)\r
+                       {\r
+                               for (int j = 1; j <= getCols(); j++)\r
+                               {\r
+                                       this[i, j] = f(this[i, j]);\r
+                               }\r
+                       }\r
+               }\r
 \r
                public abstract int rows { get; }\r
                public abstract int cols { get; }\r