<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Zeilenvektoren aus einer Matrix?]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich möchte aus einer Matrix seine Zeilenvektoren rausholen. Habe folgendes gemacht:</p>
<pre><code>int const M = 7;
int const N = 7;

double d[M][N]={0};

for (i=0; i&lt;M; i++)
{   
    for (j=0; j&lt;N; j++)  
    {          
        zeile1[j] = d[i][j];
        zeile2[j] = d[i][j];
        ...
        zeile7[j] = d[i][j];
    }
}
</code></pre>
<p>Es gibt für dieses bsp also 7 Zeilenvektoren, die als &quot;zeile1 bis zeile7&quot; gespeichert sind. Nur ich möchte das ganze automatisieren lassen, damit der Programmcode bei 100x100 Matrix kürzer wird. Z.B:</p>
<pre><code>zeile_i[j] = d[i][j];
</code></pre>
<p>Wie könnte man das lösen?</p>
<p>Vielen Dank im Voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/314001/zeilenvektoren-aus-einer-matrix</link><generator>RSS for Node</generator><lastBuildDate>Sat, 01 Aug 2026 20:09:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/314001.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 17 Feb 2013 13:16:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 13:18:25 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich möchte aus einer Matrix seine Zeilenvektoren rausholen. Habe folgendes gemacht:</p>
<pre><code>int const M = 7;
int const N = 7;

double d[M][N]={0};

for (i=0; i&lt;M; i++)
{   
    for (j=0; j&lt;N; j++)  
    {          
        zeile1[j] = d[i][j];
        zeile2[j] = d[i][j];
        ...
        zeile7[j] = d[i][j];
    }
}
</code></pre>
<p>Es gibt für dieses bsp also 7 Zeilenvektoren, die als &quot;zeile1 bis zeile7&quot; gespeichert sind. Nur ich möchte das ganze automatisieren lassen, damit der Programmcode bei 100x100 Matrix kürzer wird. Z.B:</p>
<pre><code>zeile_i[j] = d[i][j];
</code></pre>
<p>Wie könnte man das lösen?</p>
<p>Vielen Dank im Voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299435</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299435</guid><dc:creator><![CDATA[skyforce]]></dc:creator><pubDate>Sun, 17 Feb 2013 13:18:25 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 15:22:55 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/u100590" rel="nofollow">Martin Richter</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/f1" rel="nofollow">MFC (Visual C++)</a> in das Forum <a href="http://www.c-plusplus.net/forum/f15" rel="nofollow">C++ (auch C++0x und C++11)</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299465</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299465</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Sun, 17 Feb 2013 15:22:55 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 15:24:43 GMT]]></title><description><![CDATA[<p>Mehrdimensionales Array?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299468</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299468</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sun, 17 Feb 2013 15:24:43 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 16:49:56 GMT]]></title><description><![CDATA[<p>der Vektor d ist 2 dim. Die zeilenvektoren sind nur 1. dim</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299492</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299492</guid><dc:creator><![CDATA[skyforce]]></dc:creator><pubDate>Sun, 17 Feb 2013 16:49:56 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 16:59:37 GMT]]></title><description><![CDATA[<p>Ja, die Zeilenvektoren kannst du zweidimensional machen.<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox9140" checked="true" /><label for="checkbox9140">zeile[1][x].</label></div></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299496</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299496</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sun, 17 Feb 2013 16:59:37 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 17:14:29 GMT]]></title><description><![CDATA[<p>Verstehe ich das richtig, du möchtest ein Zweidimensionales Array von Skalaren?<br />
Da böte sich <a href="http://www.boost.org/doc/libs/1_53_0/libs/multi_array/doc/index.html" rel="nofollow">Boost.MultiArray</a>, <a href="http://www.boost.org/doc/libs/1_53_0/libs/numeric/ublas/doc/matrix.htm" rel="nofollow">Boost.numeric.uBLAS.matrix</a>, ein verschachtelter <code>std::vector</code> (<strong>bei fester Große, wie im Beispiel</strong>, <code>std::array</code> ) oder ein <code>std::valarray</code> , oder ein normaler sequentieller Container den du wrappst sodass er zweidimensional wird (erklärt dir jemand anders) an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299504</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299504</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Sun, 17 Feb 2013 17:14:29 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 17:18:09 GMT]]></title><description><![CDATA[<p>Wrappen heißt: einen zweidim auf einen eindim abbilden.<br />
Beispiel:</p>
<pre><code>std::size_t 2dim_to_1dim(std::size_t x, std::size_t y, std::size_t width)
{
    return y * width + x;
}
std::size_t 3dim_to_1dim(std::size_t x, std::size_t y, std::size_t z, std::size_t width, std::size_t height)
{
    return z * height + y * width + x;
}
</code></pre>
<p>Das wird notwendig, weil man als guter C++-Programmierer keine C-Style-Arrays/Pointer mehr verwendet.</p>
<p>Ich habe mal gelesen, dass man std::vector&lt;std::vector&lt;int&gt;&gt; nicht verwenden sollte.<br />
Weiß einer wieso oder ist das Quatsch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299507</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299507</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sun, 17 Feb 2013 17:18:09 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 17:26:39 GMT]]></title><description><![CDATA[<p>Nathan schrieb:</p>
<blockquote>
<p>Wrappen heißt: einen zweidim auf einen eindim abbilden.</p>
</blockquote>
<p>Was <em>ich meine</em>, ist was du fälschlicherweise als wrappen beschreibst. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Nathan schrieb:</p>
<blockquote>
<p>Ich habe mal gelesen, dass man std::vector&lt;std::vector&lt;int&gt;&gt; nicht verwenden sollte.<br />
Weiß einer wieso oder ist das Quatsch?</p>
</blockquote>
<p>Außer, dass es ein wenig Speicher-verschwenderisch ist, dazu <s>vielleicht</s> teilweise unschön* - spricht nichts dagegen.<br />
(Gerade der letzte Punkt ist aber <strong>definitiv</strong> ein Grund zum Nachdenken ;))</p>
<p>* Beispiel: Du möchtest drüberiterieren. Oder wie ein C-Array behandeln, bzw. einer Funktion ein C-Array mit selbem Inhalt geben usw.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299509</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299509</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Sun, 17 Feb 2013 17:26:39 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 17:39:04 GMT]]></title><description><![CDATA[<p>Wieso, für mich ist das auch Wrappen. :p<br />
Und für mich spricht eher der erste Punkt dagegen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299512</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299512</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sun, 17 Feb 2013 17:39:04 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 17:46:11 GMT]]></title><description><![CDATA[<p>warum denkt ihr so kompliziert? kein Wrappen, nur eine stink normale umspeicherung. Ich möchte einfach nur die Zeilenelemente einer Matrix in ein Vektor speichern. Beispiel:</p>
<p>A(3x2) = (1 2; 3 4; 4 5)</p>
<p>=&gt; zeile1 = 1 2<br />
zeile2 = 3 4<br />
zeile3 = 4 5</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299516</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299516</guid><dc:creator><![CDATA[skyforce]]></dc:creator><pubDate>Sun, 17 Feb 2013 17:46:11 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 17:52:30 GMT]]></title><description><![CDATA[<p>Nathan schrieb:</p>
<blockquote>
<p>Wieso, für mich ist das <strong>auch</strong> Wrappen. :p</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2299518</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299518</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Sun, 17 Feb 2013 17:52:30 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 17:57:06 GMT]]></title><description><![CDATA[<p>vector&lt;vector&lt;float&gt;&gt; nutzt man nicht aus Speichergründen nicht für Matrizen, sondern weil jeder vector seinen Speicher seperat alloziert, dh. die Maxtrix ist über den Speicher verteilt, was extrem CPU-Cache feindlich ist.</p>
<p>Am Besten alles in einen vector wrappen. Wer Lust hat, ein Zeilen-Iterator wäre ne nette Idee.</p>
<p>Minimaler Ansatz:</p>
<pre><code>template&lt;typename T&gt;
class matrix2d
{
private:
    vector&lt;T&gt; storage;
    size_t width, height;

public:
    matrix2d(size_t width, size_t height)
        : storage(width * height), width(width), height(height)
    { }

    T&amp; operator(size_t x, size_t y)
    {
        assert(x &lt; width &amp;&amp; y &lt; height);
        return y * width + x;
    }
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2299520</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299520</guid><dc:creator><![CDATA[Ethon]]></dc:creator><pubDate>Sun, 17 Feb 2013 17:57:06 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 18:05:53 GMT]]></title><description><![CDATA[<p>*Mal alten Code rauskram*:</p>
<pre><code>// Library MySTL
// multiarray.hpp
// More-dimensional arrays/vectors

#ifndef MULTIARRAY_HPP_INCLUDED
#define MULTIARRAY_HPP_INCLUDED

#include &lt;array&gt;
#include &lt;map&gt;
#include &lt;stdexcept&gt;
#include &lt;tuple&gt;
#include &lt;type_traits&gt;
#include &lt;vector&gt;

#include &lt;iostream&gt;

namespace my
{
namespace stl
{
    // Forwards
    template &lt;std::size_t dims&gt;
    class multi_array_index_t;
    template &lt;std::size_t dims&gt;
    class multi_array_getter;

    /// \brief A more-dimensional, dynamic growing vector, based on a spezific STL-Container
    /// \param T: the type of the multi_array
    /// \param dims: the number of dimensions (more than one is recommend!)
    /// \param G: the getter function for the multi_array (says how the values are stored); default: multi_array_getter
    /// \param C: the container storing the values, must have a random_access_iterator (vector or deque); default: vector
    template &lt;typename T, std::size_t dims, template&lt;std::size_t&gt; class G = multi_array_getter, template&lt;typename, typename...&gt; class C = std::vector&gt;
    class multi_array
    {
    public:
        // Typedefs
        /// \brief The type and its references, const_references, allocators and pointers
        using value_type            = typename C&lt;T&gt;::value_type;
        using allocator_type        = typename C&lt;T&gt;::allocator_type;
        using reference             = typename C&lt;T&gt;::reference;
        using const_reference       = typename C&lt;T&gt;::const_reference;
        using pointer               = typename C&lt;T&gt;::pointer;
        using const_pointer         = typename C&lt;T&gt;::const_pointer;

        /// \brief The getter class and the container
        using getter    = G&lt;dims&gt;;
        using container = C&lt;T&gt;;

        /// \brief The iterators
        using iterator               = typename C&lt;T&gt;::iterator;
        using const_iterator         = typename C&lt;T&gt;::const_iterator;
        using reverse_iterator       = typename C&lt;T&gt;::reverse_iterator;
        using const_reverse_iterator = typename C&lt;T&gt;::const_reverse_iterator;

        /// \brief Type representing an index in the multi_array
        using index_t   = multi_array_index_t&lt;dims&gt;;
        /// \brief Type representing a size in the multi_array
        using size_type = multi_array_index_t&lt;dims&gt;;

        // Static Functions
        /// \brief Returns the dimensions of the multi_array
        static constexpr std::size_t dimensions() noexcept {return dims;}

    public:
        // Constructors
        /// \brief Default Constructor
        multi_array() = default;
        /// \brief Constructor
        /// Initalize the multi_array with a size and another container (optional)
        /// \param size: the size (from type size_type)
        /// \param container: the other container (from type container) (optional)
        explicit multi_array(size_type size) : size_(size) {}
        multi_array(size_type size, const container  &amp;container);
        multi_array(size_type size, const container &amp;&amp;container);

        // Iterators
        /// \brief Common iterator access
        /// Is like any other iterator access, see STL-Documentation
        iterator begin() noexcept;
        const_iterator begin() const noexcept;
        iterator end() noexcept;
        const_iterator end() const noexcept;

        reverse_iterator rbegin() noexcept;
        const_reverse_iterator rbegin() const noexcept;
        reverse_iterator rend() noexcept;
        const_reverse_iterator rend() const noexcept;

        const_iterator cbegin() const noexcept;
        const_iterator cend() const noexcept;

        const_reverse_iterator crbegin() const noexcept;
        const_reverse_iterator crend() const noexcept;

        /// \brief Iterator access to certain sequences (rows, columns, etc.)
        /// \param iterator_t: a typename for the return type (a typename)
        /// \param dimension: the dimension you want to access (0 for the first (default: x-dimension), 1 for the second,...) (from type std::size_t)
        /// \param position: the position where the sequence is located, the dimension set with dimension will be ignored (from type index_t)
        /// \param begin: a function returning an iterator from type iterator_t to the first object (function pointer) (default: begin)
        /// \return an iterator to the start of the sequence and one to the end (from type std::pair&lt;iterator_t, iterator_t)
        template &lt;typename iterator_t = decltype(multi_array::begin())&gt;
        std::tuple&lt;iterator_t, iterator_t&gt; range(std::size_t dimension, index_t position);
        template &lt;typename iterator_t = decltype(multi_array::cbegin())&gt;
        std::tuple&lt;iterator_t, iterator_t&gt; range(std::size_t dimension, index_t position,
                                                iterator_t (multi_array::*begin) (void)) const;

        /// \brief Iterator access to certain levels (like range, but more-dimensional)
        /// \param iterator_t: a typename for the return type (a typename)
        /// \param dimensions: how many dimensions you want to access (from type std::size_t)
        /// \param dimension: the dimensions you want to access (from type std::array&lt;std::size_t, dimensions&gt;)
        /// \param position: the position where the level is located (from type

        // Capacity
        /// \brief Get the size of the multi_array
        /// \return The current size of the multi_array (from type size_type)
        constexpr size_type size() noexcept;

        /// \brief Get the maximum size of the multi_array
        /// \return The maximum size of the multi_array (from type std::size_t)
        constexpr std::size_t max_size() noexcept;

        /// \brief Check wether container is empty or not
        /// \return true if the container is empty, false otherwise (from type bool)
        constexpr bool empty() noexcept;

        /// \brief Resize the multi_array, behaves like the resize of the container
        /// \param size: the new size of the multi_array (from type size_type)
        /// \param value: an initialization value for the new values (from type value_type) (default: value_type())
        void resize(size_type size, const value_type &amp;value = value_type());

        // Element access
        /// \brief Get element
        /// \param at: the position of the element (from type index_t)
        /// \return The element at the position at (from type reference/const_reference)
        reference       operator [] (index_t at);
        const_reference operator [] (index_t at) const;

        /// \brief Get element, if it has a wrong index, std::out_of_range is thrown
        /// \param at: the position of the element (from type index_t)
        /// \return The element at the position at (from type reference/const_reference)
        reference       at(index_t at);
        const_reference at(index_t at) const;

        /// \brief Get the data of the container
        /// \return The container (copy) (from type container)
        container data() const noexcept;

        // Modifiers
        /// \brief Assign the multi_array with another multi_array (like operator =)
        /// \param array: the other multi_array (from type multi_array)
        void assign(const multi_array  &amp;array);
        void assign(const multi_array &amp;&amp;array);

        /// \brief Assign the multi_array with another container and a new size
        /// \param size: the new size (from type size_type)
        /// \param container: the container (from type container)
        void assign(size_type size, const container  &amp;container);
        void assign(size_type size, const container &amp;&amp;container);

        /// \brief Assign the multi_array with another container; size remains the same
        /// \param container: the container (from type container)
        void assign(const container  &amp;container);
        void assign(const container &amp;&amp;container);

        /// Size can't be modified directly, so objects can't be inserted.

        /// \brief Swaps the content of this multi_array and another, size is swapped too
        /// \param other: the other multi_array (from type multi_array)
        void swap(multi_array &amp;other);

        /// \brief Clears the multi_array, container has no objects any longer, size is 0 in all dimensions.
        void clear();

    private:
        container container_; ///&lt; The one-dimensional container which stores the data
        size_type size_; ///&lt; The size of the MultiArray
        getter get_; ///&lt; The Getter of the MultiArray
    };

    /// \brief An index-type for the multi_array based on an std::array&lt;std::size_t, dims&gt;
    /// \param dims: the dimension of the index_t (from type std::size_t)
    template &lt;std::size_t dims&gt;
    class multi_array_index_t : public std::array&lt;std::size_t, dims&gt;
    {
    public:
        /// \brief Default Constructor
        multi_array_index_t() = default;

        /// \brief Constructor
        /// Initialize with an initializer-list
        /// \param il: the initializer-list (from type std::initalizer_list&lt;std::size_t&gt;)
        multi_array_index_t(std::initializer_list&lt;std::size_t&gt; il) noexcept;

        /// \brief Get the length of the index_t
        /// \return The length of the index_t (from type std::size_t)
        constexpr std::size_t length() noexcept;
    };

    /// \brief A getter class for a multi_array
    /// This class converts more-dimensional indices to a one-dimensional
    /// \param dims: the dimensions of the getter (from type std::size_t)
    template &lt;std::size_t dims&gt;
    class multi_array_getter
    {
    public:
        /// \brief Operator ()
        /// Converts more-dimensional indices to a one-dimensional
        /// \param position: the position being converted (from type multi_array_index_t&lt;dims&gt;)
        /// \param size: the size of the relating multi_array (from type multi_array_index_t&lt;dims&gt;)
        /// \return the one-dimensional coordinates (from type std::size_t)
        std::size_t operator () (multi_array_index_t&lt;dims&gt; position, multi_array_index_t&lt;dims&gt; size) const noexcept;

        /// \brief Operator ()
        /// Converts one-dimensional indices to more-dimensional
        /// \param index: the one-dimensional index (from type std::size_t)
        /// \param size: the size of the related multi_array (from type multi_array_index_t&lt;dims&gt;)
        /// \return the more-dimensional coordinates (from type multi_array_index_t&lt;dims&gt;)
        multi_array_index_t&lt;dims&gt; operator () (std::size_t index, multi_array_index_t&lt;dims&gt; size) const noexcept;
    };

    #include &quot;impl\multiarray-impl.hpp&quot;

} // namespace stl
} // namespace my

#endif // MULTIARRAY_HPP_INCLUDED
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2299522</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299522</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sun, 17 Feb 2013 18:05:53 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Thu, 12 Jun 2014 10:49:40 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299530</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299530</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Thu, 12 Jun 2014 10:49:40 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 19:40:55 GMT]]></title><description><![CDATA[<p>können wir bitte bei meinem Vorhaben bleiben? Es hat doch nichts mit Wrappen zu tun! Es muss doch einfacher gehen!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299546</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299546</guid><dc:creator><![CDATA[skyforce]]></dc:creator><pubDate>Sun, 17 Feb 2013 19:40:55 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 19:45:51 GMT]]></title><description><![CDATA[<p>kommt halt drauf an, was genau du machen willst. willst du einfach nur die i-te Zeile referenzieren, dann bist du mit</p>
<pre><code>double* zeile = d[i];
</code></pre>
<p>schon ziemlich gut beraten. Dann brauchst du auch kein zeile1 etc. Ist leider nicht genau herauszubekommen was du brauchst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299547</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299547</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Sun, 17 Feb 2013 19:45:51 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 19:50:39 GMT]]></title><description><![CDATA[<p>Verstehe ich dich richtig? Du hast eine (I x J)-dimensionale Matrix und möchtest I Variablen für die einzelnen Zeilen erzeugen? Darf ich fragen, was der Blödsinn soll? Wenn du die i-te Zeile aus Performancegründen zwischenspeichern willst, würde ich das so machen:</p>
<pre><code class="language-cpp">double* d = &amp;d[0][0];
</code></pre>
<p>Wenn du wirklich I Variablen namens zeile_1,...,zeile_n erstellen möchtest, müsstest du mit dem Präprozessor arbeiten. Da kenne ich mich aber nicht hinreichend gut aus, aber es müsste imo machbar sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299549</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299549</guid><dc:creator><![CDATA[Ramanujan]]></dc:creator><pubDate>Sun, 17 Feb 2013 19:50:39 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilenvektoren aus einer Matrix? on Sun, 17 Feb 2013 21:36:54 GMT]]></title><description><![CDATA[<p>Vllt solltes du mal sagen was du eigentlich machen willst. Wenn du mehrere Vektoren speichern willst, ergibt das wieder eine Matrix.</p>
<pre><code>zeile_i[j] = Matrix[i][j];
&lt;=&gt;
zeile[i][j] = Matrix[i][j];
</code></pre>
<p>Merkste was?</p>
<p>Da bei deinem 2dim Array die Zeilen sowieso hintereinander im Speicher liegt macht das alles keinen Sinn irgendwie.<br />
Willst du an die Spalten ran, bräuchtest du nur transponieren.</p>
<p>Vllt willst du alles ja an eine Funktion übergeben. Das geht auch:</p>
<pre><code>double tolle_funktion (double *zeile, int dim_zeile)
{
  // unglaublicher code
}

tolle_funktion( Matrix + dim_spalte*zeile, dim_zeile);
</code></pre>
<p>oder auf Spalten</p>
<pre><code>tolle_funktion ( Matrix_transponiert + dim_zeile*spalte, dim_spalte);
</code></pre>
<p>Aber irgendwie ist das alles auch kein C++</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2299590</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2299590</guid><dc:creator><![CDATA[ScottZhang]]></dc:creator><pubDate>Sun, 17 Feb 2013 21:36:54 GMT</pubDate></item></channel></rss>