commit 2024564e21d6bf7d6756113c09528a9c32559849
parent a4d44c9cc06cb67b293f2d31749da557463df781
Author: Yuval Langer <yuval.langer@gmail.com>
Date: Fri, 24 Jan 2014 15:44:26 +0200
Moving from wiki
Diffstat:
6 files changed, 72 insertions(+), 0 deletions(-)
diff --git a/Commands.md b/Commands.md
@@ -0,0 +1,3 @@
+Commands I infrequently need.
+
+Dump streams, vlecs (personal use, of course), videos - mplayer -dumpfile [file] -dumpstream [url]
diff --git a/Home.md b/Home.md
@@ -0,0 +1,6 @@
+I forget, so I write.
+
+* [scipy.weave](wiki/Weave)
+* [command line](wiki/Commands)
+* [Python versus C](wiki/python-versus-c)
+* [Vim](wiki/Vim)
diff --git a/Python-versus-c.org b/Python-versus-c.org
@@ -0,0 +1,3 @@
+** Modulus
+
+[[http://stackoverflow.com/questions/1907565/c-python-different-behaviour-of-the-modulo-operation][C/Python different behaviour of the modulo operation]]
+\ No newline at end of file
diff --git a/Python.org b/Python.org
@@ -0,0 +1,11 @@
+* Python
+** Getting a dictionary of the attribute name and attribute value pairs
+
+#+BEGIN_SRC python
+class a:
+ b = 'b'
+ def __init__(self, c):
+ self.c = c
+ def who(self):
+ return(scipy.who(vars(self)))
+#+END_SRC
diff --git a/Vim.md b/Vim.md
@@ -0,0 +1,5 @@
+How many lines / Count marked lines
+
+"In visual mode, press g C-g."
+
+http://stackoverflow.com/questions/7262536/vim-count-lines-in-selected-range
diff --git a/weave.md b/weave.md
@@ -0,0 +1,43 @@
+# Accessing an array and its metadata through C/C++ in *scipy.weave.inline()*
+
+* Accessing an array *foo* with *foo.ndim == 3*:
+ - The array itself will be accessable through the *FOO3(i, j, k)* function.
+ - Array assignments will be the same. *FOO3(i, j, k) = bar;*
+ - *foo.shape* will be accessable through the *Nfoo[]* array.
+
+
+## The inline code:
+
+~~~ { .cpp }
+
+long dim1, dim2, dim3;
+
+dim1 = Nfoo[0]; // dimension access.
+dim2 = Nfoo[1];
+dim3 = Nfoo[2];
+
+FOO3(0,0,0) = 1; // array assignment
+return_val = FOO3(0,0,0); // array access.
+
+~~~
+
+## The Python code:
+
+~~~ { .python }
+import scipy
+import scipy.weave
+inline_code = r"""
+put C/C++ code in here
+"""
+foo = scipy.arange(3**3).reshape((3,3,3))
+scipy.weave.inline(inline_code, foo)
+~~~
+
+# Using Python functions in weave.inline
+
+Call *foo.call(py:tuple arg)*.
+
+# Links
+
+* At Weave and Numpy array arguments: [Scipy's Weave page](http://www.scipy.org/Weave)
+* [Calling Python functions from inline C with scipy.weave (stackoverflow)](http://stackoverflow.com/questions/5929600/calling-python-functions-from-inline-c-with-scipy-weave)