Class Dobjects::Dtable
In: ext/Dobjects/Dvector/dvector.c
Parent: Object

Dtables are a specialized implementation of two-dimensional arrays of double precision floating point numbers. They are intended for use in applications needing efficient processing of large 2D tables of numeric data. Essentially any of the operations you might do with a Ruby Array of numbers can also be done with a Dtable. Dtables follow the same design philosophy as Dvector and uses Dvectors for several operations.

Methods

%   *   **   +   -   -@   /   []   []=   _dump   _load   abs   abs!   acos   acos!   acosh   acosh!   add   add!   as_exponent_of   as_exponent_of!   asin   asin!   asinh   asinh!   at   atan   atan!   atan2   atan2!   atanh   atanh!   ceil   ceil!   clear   column   cos   cos!   cosh   cosh!   div   div!   dup   each_column   each_row   exp   exp!   exp10   exp10!   floor   floor!   interpolate   inv   inv!   log   log!   log10   log10!   max   max_lt   min   min_gt   minus   minus!   mod   mod!   modulo   modulo!   mul   mul!   neg   neg!   new   num_cols   num_rows   plus   plus!   pow   pow!   raised_to   raised_to!   read   remainder   remainder!   reverse_cols   reverse_rows   rotate_ccw90   rotate_cw90   round   round!   row   safe_acos   safe_acos!   safe_asin   safe_asin!   safe_inv   safe_inv!   safe_log   safe_log!   safe_log10   safe_log10!   safe_sqrt   safe_sqrt!   set   set_column   set_row   sin   sin!   sinh   sinh!   sqrt   sqrt!   sub   sub!   sum   tan   tan!   tanh   tanh!   times   times!   transpose   trim   trim!  

Public Class methods

Called by the marshalling mechanism to retrieve a permanent copy of a Dtable.

Returns a new Dtable with the requested dimensions.

Public Instance methods

%(p1)

Alias for modulo

*(p1)

Alias for mul

**(p1)

Alias for pow

+(p1)

Alias for add

-(p1)

Alias for sub

-@()

Alias for neg

/(p1)

Alias for div

[](p1, p2)

Alias for at

Replaces the element at location row, col by the given number.

Called by the marshalling mechanism to store a permanent copy of a Dtable. limit is simply ignored.

Returns of copy of dtable with all entries replaced by their absolute values.

Replace each entry x of dtable with abs(x).

Returns of copy of dtable with entry x replaced by acos(x).

Replace each entry x of dtable with acos(x).

Returns of copy of dtable with entry x replaced by acosh(x).

Replace each entry x of dtable with acosh(x).

When argument is a number, this operation returns a copy of dtable with each entry x replaced by x + number. When argument is a data array, this operation returns a copy of dtable with each entry x replaced by x + the corresponding entry in the other data array.

When argument is a number, each entry x in dtable is replaced by x + number. When argument is a data array, each entry x in dtable is replaced by x + the corresponding entry in the other data array.

When argument is a number, this operation returns a copy of dtable with each entry x replaced by number ** x. When argument is a data array, this operation returns a copy of dtable with each entry x replaced by the corresponding entry in the other data array raised to the power x.

When argument is a number, this operation replaces each entry x of dtable by number ** x. When argument is a data array, this operation replaces each entry x of dtable by the corresponding entry in the other data array raised to the power x.

Returns of copy of dtable with entry x replaced by asin(x).

Replace each entry x of dtable with asin(x).

Returns of copy of dtable with entry x replaced by asinh(x).

Replace each entry x of dtable with asinh(x).

Returns the element at location row, col. Returns nil if the location is out of range.

Returns of copy of dtable with entry x replaced by atan(x).

Replace each entry x of dtable with atan(x).

When argument is a number, this operation returns a copy of dtable with each entry x replaced by the angle whose tangent is x/number. When argument is a data array, this operation returns a copy of dtable with each entry x replaced by the angle whose tangent is x divided by the corresponding entry in the other data array.

When argument is a number, this operation replaces each entry x of dtable by the angle whose tangent is x/number. When argument is a data array, this operation replaces each entry x of dtable by the angle whose tangent is x divided by the corresponding entry in the other data array.

Returns of copy of dtable with entry x replaced by atanh(x).

Replace each entry x of dtable with atanh(x).

Returns of copy of dtable with entry x replaced by smallest integer not less than x.

Replace each entry x of dtable with the smallest integer not less than x.

Sets the entries of dtable array to zero.

Creates a Dvector holding a copy of the contents of the requested column.

Returns of copy of dtable with entry x replaced by cos(x).

Replace each entry x of dtable with cos(x).

Returns of copy of dtable with entry x replaced by cosh(x).

Replace each entry x of dtable with cosh(x).

When argument is a number, this operation returns a copy of dtable with each entry x replaced by x / number. When argument is a data array, this operation returns a copy of dtable with each entry x replaced by x / the corresponding entry in the other data array.

When argument is a number, each entry x in dtable is replaced by x / number. When argument is a data array, each entry x in dtable is replaced by x / the corresponding entry in the other data array.

Returns a copy of dtable. For performance sensitive situations involving a series of operations, first make a copy using dup and then do "bang" operations to modify the result without further copying.

Iterates over all columns and executes the given block

Iterates over all rows and executes the given block

Returns of copy of dtable with each entry x replaced by exp(x).

Replace each entry x of dtable with exp(x).

Returns of copy of dtable with each entry x replaced by 10**x.

Replace each entry x of dtable with 10**x.

Returns of copy of dtable with each entry x replaced by largest integer not greater than x.

Replace each entry x of dtable with the largest integer not greater than x.

Returns a copy of dtable with the values interpolated given the proper X and Y axis to create a uniform spaced result in the X- and Y direction consisting of nx- and ny values for each direction.

Returns of copy of dtable with each entry x replaced by 1/x.

Replace each entry x of dtable with 1/x.

Returns of copy of dtable with each entry x replaced by log(x).

Replace each entry x of dtable with log(x).

Returns of copy of dtable with each entry x replaced by log10(x).

Replace each entry x of dtable with log10(x).

Returns the maximum entry in dtable.

Returns the maximum entry in dtable which is less than val, or nil if no such entry if found.

Returns the minimum entry in dtable.

Returns the minimum entry in dtable which is greater than val, or nil if no such entry if found.

minus(p1)

Alias for sub

minus!(p1)

Alias for sub!

mod(p1)

Alias for modulo

mod!(p1)

Alias for modulo!

When argument is a number, this operation returns a copy of dtable with each entry x replaced by x % number. When argument is a data array, this operation returns a copy of dtable with each entry x replaced by x % the corresponding entry in the other data array.

When argument is a number, this operation returns a copy of dtable with each entry x replaced by x % number. When argument is a data array, this operation returns a copy of dtable with each entry x replaced by x % the corresponding entry in the other data array.

When argument is a number, this operation returns a copy of dtable with each entry x replaced by x * number. When argument is a data array, this operation returns a copy of dtable with each entry x replaced by x * the corresponding entry in the other data array.

When argument is a number, each entry x in dtable is replaced by x * number. When argument is a data array, each entry x in dtable is replaced by x * the corresponding entry in the other data array.

Returns of copy of dtable with each entry x replaced by -x.

Replace each entry x of dtable with -x.

Returns the number of entries in the x dimension of dtable.

Returns the number of entries in the y dimension of dtable.

plus(p1)

Alias for add

plus!(p1)

Alias for add!

When argument is a number, this operation returns a copy of dtable with each entry x replaced by x ** number. When argument is a data array, this operation returns a copy of dtable with each entry x replaced by x ** the corresponding entry in the other data array.

When argument is a number, this operation returns a copy of dtable with each entry x replaced by x ** number. When argument is a data array, this operation returns a copy of dtable with each entry x replaced by x ** the corresponding entry in the other data array.

raised_to(p1)

Alias for pow

raised_to!(p1)

Alias for pow!

The contents of dtable are replaced by the contents of the file, starting after skipping the specified number of lines. The values in the file are listed with row number 0 first.

When the argument is a number, this operation returns a copy of dtable with each entry x replaced by the remainder of x divided by number. When the argument is a data array, this operation returns a copy of dtable with each entry x replaced by the remainder of x divided by the corresponding entry in the other data array.

When the argument is a number, this operation replaces with each entry x of dtable by the remainder of x divided by number. When the argument is a data array, this operation replaces with each entry x of dtable by remainder of x divided by the corresponding entry in the other data array.

Returns a copy of dtable with the order of columns reversed.

Returns a copy of dtable with the order of rows reversed.

Returns a copy of dtable rotated 90 degrees counter-clockwise.

Returns a copy of dtable rotated 90 degrees clockwise.

Returns of copy of dtable with each entry x replaced by round(x). (Numbers midway between integers round away from zero.)

Replace each entry x of dtable with the integer closest to x. (Numbers midway between integers round away from zero.)

Creates a Dvector holding a copy of the contents of the requested row.

Returns a copy of dtable with each entry x replaced by acos(max(-1,min(1,x))).

Replaces each entry x in dtable by acos(max(-1,min(1,x)))..

Returns a copy of dtable with each entry x replaced by asin(max(-1,min(1,x))).

Replaces each entry x in dtable by asin(max(-1,min(1,x)))..

Returns a copy of dtable with each entry x replaced by sign(x)/cutoff if abs(x) < cutoff, 1/x otherwise.

Replaces each entry x in dtable by sign(x)/cutoff if abs(x) < cutoff, 1/x otherwise.

Returns a copy of dtable with each entry x replaced by log(max(x,cutoff)).

Replaces each entry x in dtable by log(max(x,cutoff)).

Returns a copy of dtable with each entry x replaced by log10(max(x,cutoff)).

Replaces each entry x in dtable by log10(max(x,cutoff)).

Returns a copy of dtable with each entry x replaced by sqrt(max(x,0)).

Replaces each entry x in dtable by sqrt(max(x,0)).

Modifies the entries of dtable array. If the argument is a float, then all of the entries are set to that value. If the argument is another Dtable array, then it must be the size as dtable, and its contents are copied to dtable.

Stores the contents of a_dec in the specified column of the array. The length of the vector must equal the number of rows in the array.

Stores the contents of a_dec in the specified row of the array. The length of the vector must equal the number of columns in the array.

Returns of copy of dtable with entry x replaced by sin(x).

Replace each entry x of dtable with sin(x).

Returns of copy of dtable with entry x replaced by sinh(x).

Replace each entry x of dtable with sinh(x).

Returns of copy of dtable with each entry x replaced by sqrt(x).

Replace each entry x of dtable with sqrt(x).

When argument is a number, this operation returns a copy of dtable with each entry x replaced by x - number. When argument is a data array, this operation returns a copy of dtable with each entry x replaced by x - the corresponding entry in the other data array.

When argument is a number, each entry x in dtable is replaced by x - number. When argument is a data array, each entry x in dtable is replaced by x - the corresponding entry in the other data array.

Returns the sum of the entries in dtable. Returns 0.0 if dtable is empty.

   a = Dtable.new(2,4)
   a.set_column(0, Dvector[1,2,3,4])
   a.set_column(1, Dvector[0, 1, 0, 1])
   a.sum        -> 12.0
   Dtable.new(2,2).sum   -> 0.0

Returns of copy of dtable with entry x replaced by tan(x).

Replace each entry x of dtable with tan(x).

Returns of copy of dtable with entry x replaced by tanh(x).

Replace each entry x of dtable with tanh(x).

times(p1)

Alias for mul

times!(p1)

Alias for mul!

Returns a transposed copy of dtable (i.e., exchange rows and columns).

Returns a copy of dtable with any entry with absolute value less than cutoff replaced by 0.

Each entry x in dtable having absolute value less than cutoff is replaced by 0.

[Validate]