Class: Hornetseye::Lambda

Inherits:
Node show all
Defined in:
docs/multiarray/lib/multiarray/lambda.rb

Overview

Class for representing lambda expressions

Instance Method Summary collapse

Methods inherited from Node

#<=>, ===, #[], #[]=, #allocate, #b=, #b_with_decompose, #basetype, #between?, bool, #check_shape, #clip, coercion_bool, coercion_byte, coercion_maxint, #collect, #components, cond, #conditional, #convolve, #dilate, dimension, #dimension, #downsample, #dup, #each, #empty?, #eq_with_multiarray, #erode, #fill!, #flip, float_scalar, floating, #fmod_with_float, #g=, #g_with_decompose, #gauss_blur, #gauss_gradient, #height, #histogram, #histogram_with_rgb, #if, #if_else, #imag=, #imag_with_decompose, indgen, #inject, #inspect, #integral, #lut, #lut_with_rgb, #mask, #matched?, #max, #mean, #memorise, #min, #normalise, #orig_to_cvmat, #orig_to_type_with_frame, #prod, #r=, #r_with_decompose, #range, #real=, #real_with_decompose, #reshape, rgb?, #rgb?, #roll, #save_dfloat, #save_dfloatrgb, #save_magick, #save_openexr, #save_sfloat, #save_sfloatrgb, #save_ubyte, #save_ubytergb, #save_uint, #save_uintrgb, #save_usint, #save_usintrgb, scalar, shape, #shift, #show, #size, #sobel, #stretch, #sum, #swap_rgb_with_scalar, #to_a, #to_cvmat, #to_magick, #to_narray, to_type, #to_type, #to_type_with_frame, #to_type_with_identity, #to_type_with_rgb, #transpose, typecode, #unmask, #unroll, #warp, #width

Constructor Details

#initialize(index, term) ⇒ Lambda

Construct lambda term

Parameters:

  • index (Variable)

    Variable to bind.

  • term (Node)

    The term based on that variable.



29
30
31
32
# File 'docs/multiarray/lib/multiarray/lambda.rb', line 29

def initialize(index, term)
  @index = index
  @term = term
end

Instance Method Details

#decompose(i) ⇒ Node

Decompose composite elements

This method decomposes composite elements into array.

Returns:

  • (Node)

    Result of decomposition.



201
202
203
# File 'docs/multiarray/lib/multiarray/lambda.rb', line 201

def decompose( i )
  Lambda.new @index, @term.decompose( i )
end

#memoryMalloc, ...

Get storage object if there is any

Returns:



37
38
39
# File 'docs/multiarray/lib/multiarray/lambda.rb', line 37

def memory
  @term.memory
end

#shapeArray<Integer>

Get shape of this term

Returns:

  • (Array<Integer>)

    Returns shape of array.



82
83
84
# File 'docs/multiarray/lib/multiarray/lambda.rb', line 82

def shape
  @term.shape + [@index.size.get]
end

#typecodeClass

Element-type of this term

Returns:

  • (Class)

    Element-type of this datatype.



75
76
77
# File 'docs/multiarray/lib/multiarray/lambda.rb', line 75

def typecode
  @term.typecode
end