ArrayFire: seq Class Reference (original) (raw)

seq is used to create sequences for indexing af::array More...

#include <[seq.h](seq%5F8h%5Fsource.htm)>

Public Member Functions
seq (double length=0)
Creates a sequence of size length as [0, 1, 2..., length - 1]. More...
~seq ()
Destructor. More...
seq (double begin, double end, double step=1)
Creates a sequence starting at begin, ending at or before end (inclusive) with increments as step. More...
seq (seq other, bool is_gfor)
Copy constructor. More...
seq (const af_seq &s_)
Create a seq object from an af_seq struct. More...
seq & operator= (const af_seq &s)
Assignment operator to create a new sequence from an af_seq. More...
seq operator- ()
Negation operator creates a sequence with the signs negated. More...
seq operator+ (double x)
Addition operator offsets the begin and end by x. More...
seq operator- (double x)
Subtraction operator offsets the begin and end by x. More...
seq operator* (double x)
Multiplication operator spaces the sequence by a factor x. More...
operator array () const
Implicit conversion operator from seq to af::array. More...
Data Fields
af_seq s
Get the af_seq C-style struct. More...
size_t size
Get's the length of the sequence. More...
bool m_gfor
Flag for gfor. More...
Friends
seq operator+ (double x, seq y)
seq operator- (double x, seq y)
seq operator* (double x, seq y)

seq is used to create sequences for indexing af::array

Examples

computer_vision/fast.cpp, computer_vision/harris.cpp, computer_vision/matching.cpp, computer_vision/susan.cpp, getting_started/rainfall.cpp, getting_started/vectorize.cpp, graphics/field.cpp, graphics/gravity_sim.cpp, graphics/plot2d.cpp, graphics/plot3.cpp, helloworld/helloworld.cpp, image_processing/binary_thresholding.cpp, image_processing/confidence_connected_components.cpp, image_processing/filters.cpp, image_processing/image_editing.cpp, image_processing/morphing.cpp, image_processing/pyramids.cpp, lin_algebra/svd.cpp, machine_learning/bagging.cpp, machine_learning/deep_belief_net.cpp, machine_learning/geneticalgorithm.cpp, machine_learning/kmeans.cpp, machine_learning/neural_network.cpp, machine_learning/rbm.cpp, and pde/bhrt.cpp.

Definition at line 45 of file seq.h.

seq() [1/4]

Creates a sequence of size length as [0, 1, 2..., length - 1].

The sequence has begin as 0, end as length - 1 and step as 1.

Note

When doing seq(-n), where n is > 0, then the sequence is generated as 0...-n but step remains +1. This is because when such a sequence is used for indexing af::array, then -n represents n elements from the end. That is, seq(-2) will imply indexing an array 0...dimSize - 2.

seq a(10);

seq is used to create sequences for indexing af::array

Parameters

[in] length is the size of the seq to be created.

seq() [2/4]

seq ( double begin,
double end,
double step = 1
)

Creates a sequence starting at begin, ending at or before end (inclusive) with increments as step.

The sequence will be [begin, begin + step, begin + 2 * step...., begin + n * step] where the begin + n * step <= end.

seq a(10, 20);

seq b(10, 20, 2);

seq c(-5, 5);

seq d(-5, -15, -1);

seq e(-15, -5, 1);

Parameters

[in] begin is the start of the sequence
[in] end is the maximum value a sequence can take (inclusive)
[in] step is the increment or decrement size (default is 1)

seq() [3/4]

seq ( seq other,
bool is_gfor
)

Copy constructor.

Creates a copy seq from another sequence.

Parameters

[in] other seqence to be copies
[in] is_gfor is the gfor flag

seq() [4/4]

Create a seq object from an af_seq struct.

Parameters

operator array()

Implicit conversion operator from seq to af::array.

Convertes a seq object into an af::array object. The contents of the af:array will be the explicit values from the seq.

Note

Do not use this to create arrays of sequences. Use range.

seq s(10, 20, 2);

af_print(arr);

A multi dimensional data container.

af_seq s

Get the af_seq C-style struct.

operator*()

seq operator* ( double x) inline

Multiplication operator spaces the sequence by a factor x.

begin is changed to begin * x end is changed to end * x step is changed to step * x

seq a(10, 20, 2);

seq b(-5, 5);

seq c = a * 3;

seq d = b * 3;

seq e = a * 0.5;

Definition at line 199 of file seq.h.

seq(double length=0)

Creates a sequence of size length as [0, 1, 2..., length - 1].

double end

End position of the sequence (inclusive)

double step

Step size between sequence values.

double begin

Start position of the sequence.

operator+()

seq operator+ ( double x) inline

Addition operator offsets the begin and end by x.

There is no change in step.

begin is changed to begin + x end is changed to end + x

seq a(2, 20, 2);

seq b = a + 3;

Definition at line 164 of file seq.h.

operator-() [1/2]

Negation operator creates a sequence with the signs negated.

begin is changed to -begin end is changed to -end step is changed to -step

Definition at line 149 of file seq.h.

operator-() [2/2]

seq operator- ( double x) inline

Subtraction operator offsets the begin and end by x.

There is no change in step.

begin is changed to begin - x end is changed to end - x

seq a(10, 20, 2);

seq b(2, 10);

seq c = a - 3;

seq d = b - 3;

Definition at line 181 of file seq.h.

operator=()

Assignment operator to create a new sequence from an af_seq.

This operator creates a new sequence using the begin, end and step from the input sequence.

Parameters

[in] s is the input sequence

operator*

seq operator* ( double x, seq y ) friend

operator+

seq operator+ ( double x, seq y ) friend

operator-

seq operator- ( double x, seq y ) friend

m_gfor

Flag for gfor.

Definition at line 61 of file seq.h.

s

Get the af_seq C-style struct.

Definition at line 51 of file seq.h.

size

Get's the length of the sequence.

Definition at line 56 of file seq.h.


The documentation for this class was generated from the following file: