Send Toon-members mailing list submissions to
address@hiddenTo subscribe or unsubscribe via the World Wide Web, visit
http://lists.nongnu.org/mailman/listinfo/toon-members
or, via email, send a message with subject or body 'help' to
address@hidden
You can reach the person managing the list at
address@hidden
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Toon-members digest..."
Today's Topics:
1. TooN/doc documentation.h (Edward Rosten)
2. Re: Efficient (dynamic) slicing (Rafael Spring)
----------------------------------------------------------------------
Message: 1
Date: Fri, 26 Feb 2010 19:11:07 +0000
From: Edward Rosten <address@hidden>
Subject: [Toon-members] TooN/doc documentation.h
To: address@hidden
Message-ID: <address@hidden>
CVSROOT:
/cvsroot/toon
Module name:
TooN
Changes by:
Edward Rosten <edrosten>
10/02/26 19:11:07
Modified files:
doc : documentation.h
Log message:
Documentation on how to return slices from functions.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/doc/documentation.h?cvsroot=toon&r1=1.46&r2=1.47
Patches:
Index: documentation.h
===================================================================
RCS file: /cvsroot/toon/TooN/doc/documentation.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- documentation.h
9 Feb 2010 13:43:19 -0000
1.46
+++ documentation.h
26 Feb 2010 19:11:06 -0000
1.47
@@ -67,6 +67,7 @@
- \ref sResize
- \ref sDebug
- \ref sSlices
+ - \ref sFuncSlices
- \ref sPrecision
- \ref sSolveLinear
- \ref sOtherStuff
@@ -502,6 +503,8 @@
Slices are usually strange types. See \ref sFunctionVector
+
See also \sFuncSlices
+
\subsection sPrecision Can I have a precision other than double?
Yes!
@@ -523,6 +526,31 @@
rules. The result of multiplying a <code>Matrix<double></code> by a
<code>Vector<float></code> is a <code>Vector<double></code>.
+
+
\subsection sFuncSlices How do I return a slice from a function?
+
+
Each vector has a <code>SliceBase</code> type indicating the type of a slice.
+
+
They can be slightly tricky to use:
+
@code
+
Vector<2, double, Vector<4>::SliceBase> sliceof(Vector<4>& v)
+
{
+
return v.slice<1,2>();
+
}
+
+
template<int S, class P, class B>
+
Vector<2, P, Vector<S, P, B>::SliceBase> sliceof(Vector<S, P, B>& v)
+
{
+
return v.template slice<1,2>();
+
}
+
+
template<int S, class P, class B>
+
const Vector<2, const P, typename Vector<S, P, B>::ConstSliceBase > foo(const Vector<S, P, B>& v)
+
{
+
return v.template slice<1,2>();
+
}
+
@endcode
+
\subsection sSolveLinear How do I invert a matrix / solve linear equations?
You use the decomposition objects (see \ref sDecompos "below"), for example to solve Ax=b:
------------------------------
Message: 2
Date: Fri, 26 Feb 2010 11:46:00 -0800
From: Rafael Spring <address@hidden>
Subject: Re: [Toon-members] Efficient (dynamic) slicing
To: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
Ok, so the real situation is that fillSubMatrix() is virtual
(sorry, should have mentioned that in my first mail). That would
probably require to be explicit about the template parameters, right?
Can I now assume that the proposed pattern would not result in
temp. matrix data being allocated from the heap? Or is there a
better practice than this?
I am also a little confused by the Matrix documentation. For the
slice() method there is an example:
Matrix<> m(3,3);
// Extract the top-left 2x2 matrix
Matrix<2> b = m.slice(0,0,2,2);
Is Matrix b now a copy of m's top left 2x2 or is b just referencing
this data? Would then the following be a reference?
Matrix<Dynamic, Dynamic, double, TooN::Internal::Slice<-1,1> > b =
m.slice(0,0,2,2);
Please ignore the questions. The debugger just gave me all the answers.
However, for the next beta of TooN, I'd love to have a small memory
manager in the background to redirect the temp. allocations.
Rafael
-Ed
--
(You can't go wrong with psycho-rats.)(http://mi.eng.cam.ac.uk/
~er258)
/d{def}def/f{/Times s selectfont}d/s{11}d/r{roll}d f 2/m{moveto}d -1
r 230 350 m 0 1 179{ 1 index show 88 rotate 4 mul 0 rmoveto}for/s 12
d f pop 235 420 translate 0 0 moveto 1 2 scale show showpage
_______________________________________________
Toon-members mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/toon-members
------------------------------
_______________________________________________
Toon-members mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/toon-members
End of Toon-members Digest, Vol 42, Issue 10
********************************************