Namensräume
Varianten
Aktionen

cpp/numeric/valarray/slice: Unterschied zwischen den Versionen

Aus cppreference.com
< cpp‎ | numeric‎ | valarray
(Translated from the English version using Google Translate)
K (Use {{lc}}. Update links. Various fixes.)
 
(2 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 6: Zeile 6:
 
}}
 
}}
  
{{tr|{{tt|std::slice}} ist der Selektor Klasse, die eine Teilmenge von {{c|std::valarray}} ähnlich [[enwiki:BLAS|BLAS]] Scheibe identifiziert. Ein Objekt des Typs {{tt|std::slice}} hält drei Werte: die Startindex, die Schrittlänge und die Gesamtzahl der Werte in der Teilmenge. Objekte vom Typ {{tt|std::slice}} können als Indizes mit valarray die {{tt|operator[]}} verwendet werden .|{{tt|std::slice}} is the selector class that identifies a subset of {{c|std::valarray}} similar to [[enwiki:BLAS|BLAS]] slice. An object of type {{tt|std::slice}} holds three values: the starting index, the stride, and the total number of values in the subset. Objects of type {{tt|std::slice}} can be used as indexes with valarray's {{tt|operator[]}}.}}
+
{{tr|{{tt|std::slice}} ist der Selektor Klasse, die eine Teilmenge von {{|std::valarray}} ähnlich [[enwiki:BLAS|BLAS]] Scheibe identifiziert. Ein Objekt des Typs {{tt|std::slice}} hält drei Werte: die Startindex, die Schrittlänge und die Gesamtzahl der Werte in der Teilmenge. Objekte vom Typ {{tt|std::slice}} können als Indizes mit valarray die {{tt|operator[]}} verwendet werden .|{{tt|std::slice}} is the selector class that identifies a subset of {{|std::valarray}} similar to [[enwiki:BLAS|BLAS]] slice. An object of type {{tt|std::slice}} holds three values: the starting index, the stride, and the total number of values in the subset. Objects of type {{tt|std::slice}} can be used as indexes with valarray's {{tt|operator[]}}.}}
  
 
===Member-Funktionen===
 
===Member-Funktionen===
{{dcl list begin}}
+
{{begin}}
{{dcl list mem ctor | cpp/numeric/valarray/slice/slice |{{tr| baut eine Scheibe| constructs a slice}}}}
+
{{mem ctor | cpp/numeric/valarray/slice/slice |{{tr| baut eine Scheibe| constructs a slice}}}}
{{dcl list mem fun | cpp/numeric/valarray/slice/start |{{tr| greift auf den Start der Scheibe| accesses the start of the slice}}}}
+
{{mem fun | cpp/numeric/valarray/slice/start |{{tr| greift auf den Start der Scheibe| accesses the start of the slice}}}}
{{dcl list mem fun | cpp/numeric/valarray/slice/size |{{tr| greift auf die Größe der Scheibe| accesses the size of the slice}}}}
+
{{mem fun | cpp/numeric/valarray/slice/size |{{tr| greift auf die Größe der Scheibe| accesses the size of the slice}}}}
{{dcl list mem fun | cpp/numeric/valarray/slice/stride |{{tr| greift die Schrittlänge der Scheibe| accesses the stride of the slice}}}}
+
{{mem fun | cpp/numeric/valarray/slice/stride |{{tr| greift die Schrittlänge der Scheibe| accesses the stride of the slice}}}}
{{dcl list end}}
+
{{end}}
  
 
===Beispiel===
 
===Beispiel===
Zeile 47: Zeile 47:
  
 
===Siehe auch===
 
===Siehe auch===
{{dcl list begin}}
+
{{begin}}
{{dcl list template | cpp/numeric/valarray/dcl list operator_at}}
+
{{| cpp/numeric/valarray/operator_at}}
{{dcl list template | cpp/numeric/valarray/dcl list gslice}}
+
{{| cpp/numeric/valarray/gslice}}
{{dcl list template | cpp/numeric/valarray/dcl list slice_array}}
+
{{| cpp/numeric/valarray/slice_array}}
{{dcl list end}}
+
{{end}}
 +
 
 +
 +
 +
 +
 +
 +
 +
 +

Aktuelle Version vom 1. Juli 2013, 20:43 Uhr

 
 
Numerik-Bibliothek
Gemeinsame mathematischen Funktionen
Floating-Point-Umgebung
Komplexe Zahlen
Numerische Arrays
Pseudo-Zufallszahlen
Compile-time rationale Arithmetik (C++11)
Generische numerische Operationen
Original:
Generic numeric operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iota(C++11)
accumulate
inner_product
adjacent_difference
partial_sum
 
 
definiert in Header <valarray>
class slice;
std::slice ist der Selektor Klasse, die eine Teilmenge von std::valarray ähnlich BLAS Scheibe identifiziert. Ein Objekt des Typs std::slice hält drei Werte: die Startindex, die Schrittlänge und die Gesamtzahl der Werte in der Teilmenge. Objekte vom Typ std::slice können als Indizes mit valarray die operator[] verwendet werden .
Original:
std::slice is the selector class that identifies a subset of std::valarray similar to BLAS slice. An object of type std::slice holds three values: the starting index, the stride, and the total number of values in the subset. Objects of type std::slice can be used as indexes with valarray's operator[].
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Member-Funktionen

baut eine Scheibe
Original:
constructs a slice
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(öffentliche Elementfunktion)
greift auf den Start der Scheibe
Original:
accesses the start of the slice
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(öffentliche Elementfunktion)
greift auf die Größe der Scheibe
Original:
accesses the size of the slice
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(öffentliche Elementfunktion)
greift die Schrittlänge der Scheibe
Original:
accesses the stride of the slice
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(öffentliche Elementfunktion)

[Bearbeiten] Beispiel

Barebones valarray-backed Matrix-Klasse mit einem verfolgen Rechenfunktion .
Original:
Barebones valarray-backed Matrix class with a verfolgen calculating function.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <valarray>
class Matrix {
    std::valarray<int> data;
    int dim;
 public:
    Matrix(int r, int c) : data(r*c), dim(c) {}
    int& operator()(int r, int c) {return data[r*dim + c];}
    int trace() const {
        return data[std::slice(0, dim, dim+1)].sum();
    }
};
int main()
{
    Matrix m(3,3);
    int n = 0;
    for(int r=0; r<3; ++r)
       for(int c=0; c<3; ++c)
           m(r, c) = ++n;
    std::cout << "Trace of the matrix (1,2,3) (4,5,6) (7,8,9) is " << m.trace() << '\n';
}

Output:

Trace of the matrix (1,2,3) (4,5,6) (7,8,9) is 15

[Bearbeiten] Siehe auch

get / set valarray Element, Scheibe, oder Maske
Original:
get/set valarray element, slice, or mask
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(öffentliche Elementfunktion) [edit]
generalisierte Scheibe eines valarray: Startindex, Längen eingestellt, der Fortschritte festgelegt
Original:
generalized slice of a valarray: starting index, set of lengths, set of strides
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Klasse) [edit]
Proxy auf eine Teilmenge eines valarray nach Anwendung einer Scheibe
Original:
proxy to a subset of a valarray after applying a slice
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Klassen-Template) [edit]