◐ Shell
clean mode source ↗

std::valarray - cppreference.com

De cppreference.com

Definido en el archivo de encabezado <valarray>

template< class T > class valarray;

std::valarray es la clase para representar y manipular arrays de valores. Admite operaciones matemáticas elemento por elemento y varias formas de operadores de subíndices generalizados, corte y acceso indirecto.

Notas

std::valarray y las clases auxiliares están definidas para estar libres de ciertas formas de alias, lo que permite optimizar las operaciones en estas clases de manera similar al efecto de la palabra clave restrict en el lenguaje de programación C. Además, las funciones y los operadores que toman argumentos valarray pueden devolver objetos proxy para que el compilador optimice una expresión como v1 = a*v2 + v3; como un bucle único que ejecuta v1[i] = a*v2[i] + v3[i]; evitando pases temporales o múltiples. Sin embargo, las plantillas de expresión hacen que la misma técnica de optimización esté disponible para cualquier contenedor de C++, y la mayoría de las bibliotecas numéricas prefieren las plantillas de expresión a los valarrays por flexibilidad. Algunas implementaciones de la biblioteca estándar de C++ usan plantillas de expresión para implementar operaciones eficientes en std::valarray (por ejemplo, GNU libstdc++ y LLVM libc++). Solo en raras ocasiones se optimizan más los valarrays, como por ejemplo, en las Primitivas de rendimiento integradas de Intel.

Parámetros de plantilla

T - El tipo de los elementos. El tipo debe cumplir con los requerimientos de NumericType.

Tipos miembro

Tipo miembro Definición
value_type T

Funciones miembro

construye nueva matriz numérica

Original:

constructs new numeric array

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(función miembro pública) [editar]

destruye la matriz numérica

Original:

destructs the numeric array

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(función miembro pública) [editar]

asigna el contenido

Original:

assigns the contents

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(función miembro pública) [editar]
obtener / establecer un elemento de valarray, sector o máscara
(función miembro pública) [editar]
se aplica un operador aritmético unario a cada elemento del valarray
(función miembro pública) [editar]

se aplica el operador de asignación compuestos para cada elemento de la valarray

Original:

applies compound assignment operator to each element of the valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(función miembro pública) [editar]

swaps con otro valarray

Original:

swaps with another valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(función miembro pública) [editar]

devuelve el tamaño de valarray

Original:

returns the size of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(función miembro pública) [editar]

cambia el tamaño de valarray

Original:

changes the size of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(función miembro pública) [editar]

calcula la suma de todos los elementos

Original:

calculates the sum of all elements

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(función miembro pública) [editar]

devuelve el elemento más pequeño

Original:

returns the smallest element

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(función miembro pública) [editar]

devuelve el elemento más grande

Original:

returns the largest element

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(función miembro pública) [editar]

cero llenado desplazar los elementos de la valarray

Original:

zero-filling shift the elements of the valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(función miembro pública) [editar]

desplazamiento circular de los elementos de la valarray

Original:

circular shift of the elements of the valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(función miembro pública) [editar]
applies a function to every element of a valarray
(función miembro pública) [editar]

Funciones no miembro

Especializa el algoritmo std::swap.
(plantilla de función) [editar]
Especialización de std::begin.
(plantilla de función) [editar]
Especialización de std::end.
(plantilla de función) [editar]
se aplica operadores binarios a cada elemento de dos valarrays, o un valarray y un valor
(plantilla de función) [editar]
compara dos valarrays o un valarray con un valor
(plantilla de función) [editar]

se aplica la std::abs función a cada elemento de valarray

Original:

applies the function std::abs to each element of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]
Funciones exponenciales

se aplica la std::exp función a cada elemento de valarray

Original:

applies the function std::exp to each element of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]

se aplica la std::log función a cada elemento de valarray

Original:

applies the function std::log to each element of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]

se aplica la std::log10 función a cada elemento de valarray

Original:

applies the function std::log10 to each element of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]
Funciones de potencias

aplica la función std::pow a dos o valarrays valarray una y un valor

Original:

applies the function std::pow to two valarrays or a valarray and a value

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]
Se aplica la función std::sqrt a cada elemento de valarray.
(plantilla de función) [editar]
Funciones trigonométricas
Aplica la función std::sin a cada elemento de valarray.
(plantilla de función) [editar]

se aplica la std::cos función a cada elemento de valarray

Original:

applies the function std::cos to each element of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]

se aplica la std::tan función a cada elemento de valarray

Original:

applies the function std::tan to each element of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]

se aplica la std::asin función a cada elemento de valarray

Original:

applies the function std::asin to each element of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]
Se aplica la función std::acos a cada elemento de valarray.
(plantilla de función) [editar]

se aplica la std::atan función a cada elemento de valarray

Original:

applies the function std::atan to each element of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]

se aplica la función std::atan2 a un valarray y un valor

Original:

applies the function std::atan2 to a valarray and a value

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]
Funciones hiperbólicas

se aplica la std::sinh función a cada elemento de valarray

Original:

applies the function std::sinh to each element of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]

se aplica la std::cosh función a cada elemento de valarray

Original:

applies the function std::cosh to each element of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]

se aplica la std::tanh función a cada elemento de valarray

Original:

applies the function std::tanh to each element of valarray

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de función) [editar]

Clases auxiliares

BLAS-como una rebanada de valarray: índice de inicio, duración, ritmo

Original:

BLAS-like slice of a valarray: starting index, length, stride

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(clase) [editar]

proxy para un subconjunto de un valarray después de la aplicación de una rebanada

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.


(plantilla de clase) [editar]

rebanada generalizada de un valarray: Índice de partida, establecida de longitudes, un conjunto de pasos

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.


(clase) [editar]

proxy para un subconjunto de un valarray después de aplicar un GSlice

Original:

proxy to a subset of a valarray after applying a gslice

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de clase) [editar]

proxy para un subconjunto de un valarray después de la aplicación de un operador booleano máscara []

Original:

proxy to a subset of a valarray after applying a boolean mask operator[]

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de clase) [editar]

proxy para un subconjunto de un valarray después de aplicar operador indirecta []

Original:

proxy to a subset of a valarray after applying indirect operator[]

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(plantilla de clase) [editar]

Guías de deducción(desde C++17)