public class Real1
extends java.lang.Object
Real1
combines a Sampling
with a reference to an
an array of function values. In this way, a Real1
wraps
an array of function values. Because array values are referenced (not
copied), the cost of wrapping any array with a Real1
is small.
One consequence of referencing the array of function values is that
changes to elements in such an array are reflected in all
Real1
s that reference that array. If this behavior is not
desired, the copy constructor Real1(Real1)
creates a
new array copy of function values.
Constructor and Description |
---|
Real1(float[] v)
Constructs a function with specified values and default sampling.
|
Real1(int n,
double d,
double f)
Constructs a function with specified sampling and values zero.
|
Real1(int n,
double d,
double f,
float[] v)
Constructs a function with specified sampling and values.
|
Real1(Real1 r)
Constructs a copy of the specified sampled function.
|
Real1(Sampling s)
Constructs a function with specified sampling and values zero.
|
Real1(Sampling s,
float[] v)
Constructs a function with specified sampling and values.
|
Modifier and Type | Method and Description |
---|---|
static Real1 |
add(float ar,
Real1 rb)
Returns the sum ar + rb of constant ar and function rb.
|
static Real1 |
add(Real1 ra,
float br)
Returns the sum ra + br of function ra and constant br.
|
static Real1 |
add(Real1 ra,
Real1 rb)
Returns the sum ra + rb of two functions ra and rb.
|
Real1 |
convolve(Real1 ra)
Convolves this function with the specified function.
|
static Real1 |
div(float ar,
Real1 rb)
Returns the quotient ar / rb of constant ar and function rb.
|
static Real1 |
div(Real1 ra,
float br)
Returns the quotient ra / br of function ra and constant br.
|
static Real1 |
div(Real1 ra,
Real1 rb)
Returns the quotient ra / rb of two functions ra and rb.
|
static Real1 |
fill(double ar,
int n)
Returns a function with constant values.
|
static Real1 |
fill(double ar,
Sampling s)
Returns a function with constant values.
|
Sampling |
getFourierSampling(int nmin)
Gets sampling for the Fourier transform of this function.
|
Sampling |
getSampling()
Gets the sampling for this function.
|
float[] |
getValues()
Gets the array of function values for this function.
|
static Real1 |
mul(float ar,
Real1 rb)
Returns the product ar * rb of constant ar and function rb.
|
static Real1 |
mul(Real1 ra,
float br)
Returns the product ra * br of function ra and constant br.
|
static Real1 |
mul(Real1 ra,
Real1 rb)
Returns the product ra * rb of two functions ra and rb.
|
Real1 |
plus(float ar)
Returns the sum this + ar of this function and constant ar.
|
Real1 |
plus(Real1 ra)
Returns the sum this + ra of functions this and ra.
|
static Real1 |
ramp(double fv,
double dv,
int nv)
Returns a sampled linear (ramp) function.
|
static Real1 |
ramp(double fv,
double dv,
Sampling s)
Returns a sampled linear (ramp) function.
|
Real1 |
resample(Sampling s)
Returns this function resampled to have the specified sampling.
|
static Real1 |
sub(float ar,
Real1 rb)
Returns the difference ar - rb of constant ar and function rb.
|
static Real1 |
sub(Real1 ra,
float br)
Returns the difference ra - br of function ra and constant br.
|
static Real1 |
sub(Real1 ra,
Real1 rb)
Returns the difference ra - rb of two functions ra and rb.
|
static Real1 |
zero(int n)
Returns a sampled function with values zero.
|
static Real1 |
zero(Sampling s)
Returns a sampled function with values zero.
|
public Real1(Sampling s)
s
- the sampling.public Real1(float[] v)
v
- array of function values; referenced, not copied.public Real1(Sampling s, float[] v)
s
- the sampling.v
- array of function values; referenced, not copied.
The array length v.length must equal the number of samples in s.public Real1(int n, double d, double f)
n
- the number (count) of samples.d
- the sampling interval (delta).f
- the value of the first sample.public Real1(int n, double d, double f, float[] v)
n
- the number (count) of time samples.d
- the sampling interval (delta).f
- the value of the first sample.v
- array of function values; referenced, not copied.
The array length v.length must equal n.public Real1(Real1 r)
r
- the function to copy.public Sampling getSampling()
public float[] getValues()
public Real1 resample(Sampling s)
If the specified sampling is compatible with the sampling of this function, this method copies the function values in the overlap between the two samplings, and assigns zero values to the function values where the two samplings do not overlap.
If the specified sampling is incompatible with the sampling of this function, then this method must interpolate or decimate this function Neither interpolation or decimation is supported, yet.
s
- the sampling.java.lang.UnsupportedOperationException
- if the specified sampling is
incompatible with this sampling.public Real1 plus(Real1 ra)
ra
- a function.public Real1 plus(float ar)
ar
- a constant.public Real1 convolve(Real1 ra)
ra
- the function with which to convolve.public Sampling getFourierSampling(int nmin)
A minimum number of Fourier transform samples must be specified, and the number of samlpes in the returned sampling will not be less than the larger of that specified minimum and the number of samples in this function.
nmin
- the minimum number of samples after Fourier transform.public static Real1 zero(int n)
n
- the number of samples.public static Real1 zero(Sampling s)
s
- the sampling.public static Real1 fill(double ar, int n)
ar
- the constant.n
- the number of samples.public static Real1 fill(double ar, Sampling s)
ar
- the constant.s
- the sampling.public static Real1 ramp(double fv, double dv, int nv)
fv
- the first function value.dv
- the function value delta.nv
- the number of values.public static Real1 ramp(double fv, double dv, Sampling s)
fv
- the first function value.dv
- the function value delta.s
- the sampling.public static Real1 add(Real1 ra, Real1 rb)
ra
- a function.rb
- a function.public static Real1 add(float ar, Real1 rb)
ar
- a constant.rb
- a function.public static Real1 add(Real1 ra, float br)
ra
- a function.br
- a constant.public static Real1 sub(Real1 ra, Real1 rb)
ra
- a function.rb
- a function.public static Real1 sub(float ar, Real1 rb)
ar
- a constant.rb
- a function.public static Real1 sub(Real1 ra, float br)
ra
- a function.br
- a constant.public static Real1 mul(Real1 ra, Real1 rb)
ra
- a function.rb
- a function.public static Real1 mul(float ar, Real1 rb)
ar
- a constant.rb
- a function.public static Real1 mul(Real1 ra, float br)
ra
- a function.br
- a constant.public static Real1 div(Real1 ra, Real1 rb)
ra
- a function.rb
- a function.public static Real1 div(float ar, Real1 rb)
ar
- a constant.rb
- a function.