Class: Numo::GSL::Wavelet2D

Inherits:
Object
  • Object
show all
Defined in:
ext/numo/gsl/wavelet/gsl_wavelet.c

Defined Under Namespace

Classes: GslWaveletBspline, GslWaveletBsplineCentered, GslWaveletDaubechies, GslWaveletDaubechiesCentered, GslWaveletHaar, GslWaveletHaarCentered

Instance Method Summary collapse

Instance Method Details

#nstransform(data, dir) ⇒ DFloat

These functions compute the two-dimensional wavelet transform in non-standard form.

Parameters:

  • data (DFloat)
  • dir (Integer)

Returns:

  • (DFloat)

    result



746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
# File 'ext/numo/gsl/wavelet/gsl_wavelet.c', line 746

static VALUE
wavelet2d_nstransform(VALUE self, VALUE v1, VALUE v2)
{
    ndfunc_arg_in_t ain[1] = {{OVERWRITE,2}};
    ndfunc_t ndf = {iter_wavelet2d_nstransform, NO_LOOP, 1,0, ain,0};
    gsl_wavelet *w;
    gsl_wavelet_workspace *a;
    size_t    n;
    int       dir;
    void     *opts[3];
    VALUE     vws;

    TypedData_Get_Struct(self, gsl_wavelet, &wavelet2d_data_type, w);
    opts[0] = w;

    v1 = wavelet_array_check(v1, 2, &n);

    vws = wavelet_workspace_s_new(cWaveletWorkspace, SIZET2NUM(n));
    TypedData_Get_Struct(vws, gsl_wavelet_workspace, &wavelet_workspace_data_type, a);
    opts[1] = a;
    dir = NUM2INT(v2);
    opts[2] = &dir;

    na_ndloop3(&ndf, opts, 1, v1);
    RB_GC_GUARD(vws);
    return v1;
}

#nstransform_forward(data) ⇒ DFloat

These functions compute the two-dimensional wavelet transform in non-standard form.

Parameters:

  • data (DFloat)

Returns:

  • (DFloat)

    result



784
785
786
787
788
789
790
791
792
793
794
795
796
# File 'ext/numo/gsl/wavelet/gsl_wavelet.c', line 784

static VALUE
wavelet2d_nstransform_forward(VALUE self, VALUE v1)
{
    int dir;
    VALUE v2;

    
    dir = gsl_wavelet_forward;
    
    v2 = INT2FIX(dir);

    return wavelet2d_nstransform(self, v1, v2);
}

#nstransform_inverse(data) ⇒ DFloat

These functions compute the two-dimensional wavelet transform in non-standard form.

Parameters:

  • data (DFloat)

Returns:

  • (DFloat)

    result



808
809
810
811
812
813
814
815
816
817
818
819
820
# File 'ext/numo/gsl/wavelet/gsl_wavelet.c', line 808

static VALUE
wavelet2d_nstransform_inverse(VALUE self, VALUE v1)
{
    int dir;
    VALUE v2;

    
    dir = gsl_wavelet_backward;
    
    v2 = INT2FIX(dir);

    return wavelet2d_nstransform(self, v1, v2);
}

#transform(data, dir) ⇒ DFloat

These functions compute two-dimensional in-place forward and inverse discrete wavelet transforms in standard form on the array data stored in row-major form with dimensions size1 and size2 and physical row length tda. The dimensions must be equal (square matrix) and are restricted to powers of two. For the transform version of the function the argument dir can be either forward (+1) or backward (-1). A workspace work of the appropriate size must be provided. On exit, the appropriate elements of the array data are replaced by their two-dimensional wavelet transform.

The functions return a status of GSL_SUCCESS upon successful completion. GSL_EINVAL is returned if size1 and size2 are not equal and integer powers of 2, or if insufficient workspace is provided.

Parameters:

  • data (DFloat)
  • dir (Integer)

Returns:

  • (DFloat)

    result



610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
# File 'ext/numo/gsl/wavelet/gsl_wavelet.c', line 610

static VALUE
wavelet2d_transform(VALUE self, VALUE v1, VALUE v2)
{
    ndfunc_arg_in_t ain[1] = {{OVERWRITE,2}};
    ndfunc_t ndf = {iter_wavelet2d_transform, NO_LOOP, 1,0, ain,0};
    gsl_wavelet *w;
    gsl_wavelet_workspace *a;
    size_t    n;
    int       dir;
    void     *opts[3];
    VALUE     vws;

    TypedData_Get_Struct(self, gsl_wavelet, &wavelet2d_data_type, w);
    opts[0] = w;

    v1 = wavelet_array_check(v1, 2, &n);

    vws = wavelet_workspace_s_new(cWaveletWorkspace, SIZET2NUM(n));
    TypedData_Get_Struct(vws, gsl_wavelet_workspace, &wavelet_workspace_data_type, a);
    opts[1] = a;
    dir = NUM2INT(v2);
    opts[2] = &dir;

    na_ndloop3(&ndf, opts, 1, v1);
    RB_GC_GUARD(vws);
    return v1;
}

#transform_forward(data) ⇒ DFloat

These functions compute two-dimensional in-place forward and inverse discrete wavelet transforms in standard form on the array data stored in row-major form with dimensions size1 and size2 and physical row length tda. The dimensions must be equal (square matrix) and are restricted to powers of two. For the transform version of the function the argument dir can be either forward (+1) or backward (-1). A workspace work of the appropriate size must be provided. On exit, the appropriate elements of the array data are replaced by their two-dimensional wavelet transform.

The functions return a status of GSL_SUCCESS upon successful completion. GSL_EINVAL is returned if size1 and size2 are not equal and integer powers of 2, or if insufficient workspace is provided.

Parameters:

  • data (DFloat)

Returns:

  • (DFloat)

    result



662
663
664
665
666
667
668
669
670
671
672
673
674
# File 'ext/numo/gsl/wavelet/gsl_wavelet.c', line 662

static VALUE
wavelet2d_transform_forward(VALUE self, VALUE v1)
{
    int dir;
    VALUE v2;

    
    dir = gsl_wavelet_forward;
    
    v2 = INT2FIX(dir);

    return wavelet2d_transform(self, v1, v2);
}

#transform_inverse(data) ⇒ DFloat

These functions compute two-dimensional in-place forward and inverse discrete wavelet transforms in standard form on the array data stored in row-major form with dimensions size1 and size2 and physical row length tda. The dimensions must be equal (square matrix) and are restricted to powers of two. For the transform version of the function the argument dir can be either forward (+1) or backward (-1). A workspace work of the appropriate size must be provided. On exit, the appropriate elements of the array data are replaced by their two-dimensional wavelet transform.

The functions return a status of GSL_SUCCESS upon successful completion. GSL_EINVAL is returned if size1 and size2 are not equal and integer powers of 2, or if insufficient workspace is provided.

Parameters:

  • data (DFloat)

Returns:

  • (DFloat)

    result



700
701
702
703
704
705
706
707
708
709
710
711
712
# File 'ext/numo/gsl/wavelet/gsl_wavelet.c', line 700

static VALUE
wavelet2d_transform_inverse(VALUE self, VALUE v1)
{
    int dir;
    VALUE v2;

    
    dir = gsl_wavelet_backward;
    
    v2 = INT2FIX(dir);

    return wavelet2d_transform(self, v1, v2);
}