Re: Scale a vector



Peter Duniho wrote:
Matteo Migliore wrote:
N is the size of the vector, M is the wanted size after the
processing of the new vector.

IMHO, we are having some problems with your terminology. For example:

You're right my teminology is wrong :-).
Sorry! :-P

With vector I intend an array of int: int[] vector = new int[] { 10,
15, 17, 30, 200 };

In this case N = 5 and for example I need a new vector of size 8 that
redistributes the values.

Based on the above statement, M and N are the _dimensions_ of your
vectors. Assuming you want to continue calling the two arrays
vectors, of course.

Think that is a line:
P1(1, 10) - P2(2, 15) - P3(3, 17) - P4(4, 30) - P5(5, 200)

That's not a line. It's a bunch of lines, approximating a curve.

You're right again, suppose that it's a curve.

I need a new line:
P1(1, ?) - P2(2, ?) - P3(3, ?) - P4(4, ?) - P5(5, ?) - P6(6, ?) -
P7(7, ?) - P8(8, ?)

If you're treating the "vector" as a collection of second coordinates
in a 2-dimensional space (which is what the above implies), why are
you not adjusting the first coordinate in the output sequence as well?

For example, if your original "line" starts at (1, 10) and ends at (5,
200) wouldn't you also want the resulting "line" to also start at (1,
10) and end at (5, 200)?

No, it's not a closed curve. It's only an array of int that I need to scale
to a less or great array. Think that the array are Y-coordinates and you've
to zoom (increasing or decreasing the size) of this curve.

As far as the specific example goes, what would those "?" be replaced
with? Do you have a specific relationship between the input and
output data in mind? Or is part of your question intended to solicit
opinions regarding what an appropriate relationship would be?

Mmmm I post a prototype of function that I need:
------------------------------
public int[] Scale(int[] array, int newSize) {
if (array.Lenght <= 3)
return array;

//Otherwise calculate the new values
int[] scaled = new int[newSize];

//Here is the problem! :-)
}
------------------------------

I've to preserve the curve "morphology".

[...]
No, it's not a 2-dimensional vector, it's a 1-dimension vector. But
can I use Matrix.TransformVectors() .

You cannot use TransformVectors(), of that much I am sure.

As for what the data is, it appears to me that it's not a
2-dimensional vector, nor is it a 1-dimensional vector. The data is
a 1-dimensional array, which _possibly_ could be treated as an
M-dimensional vector but in fact it doesn't really appear to me that
your data really is a vector after all.

My data are not real! I've to calculate from a real image before (read down...).

As for specifically how to "scale" the input data to create the
desired output data, I'm afraid I still don't see enough information
to explain what the intended results are. It seems that if you could
provide at least one concrete example of both the input and the
output, that would go a long way toward helping explain the problem
better.

In pratical I need to resize RGB projections (horizontal and vertical)
of images from XxY to a TxZ, where T and Z must be fixed.

A RGB projection it's only a int[] array, the lentgh is X for horizontal
and Y for vertical projections. The range of values of elements of the arrays is 0..255 (the luminance).

I hope to be more clear, sorry for my english :-).

Pete

Thx!!!!!! ;-)
Matteo Migliore.

.



Relevant Pages

  • Re: convert C routine to Mex-function (matlab executive)
    ... guess the pointers just changed whatever output data was necessary) or clean ... It's all through the pointers. ... are not passing in a fixed size array, you're passing in a double *. ... MATLAB FAQ: http://www.mit.edu/~pwb/cssm/ ...
    (comp.soft-sys.matlab)
  • Re: Scale a vector
    ... Think that the array are Y-coordinates and you've ... I'm not saying it's a closed curve. ... I'm trying to establish what the input and output data look like. ... So far, all you've shown is a hypothetical input array; without seeing a corresponding hypothetical output array, it's very difficult to visualize what exactly you're trying to do. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Has anyone used arrayfunctions from Alan Beban?
    ... Steve - ... I haven't used Alan Beban's functions, but since it seems to be an array ... range it correctly shows the output data at the bottom of the window but I ...
    (microsoft.public.excel.worksheet.functions)
  • Problem marshalling two-dimensional array in structure
    ... ByRef composition As composition_data, ByRef curve As curve_data) As Long ... I have tried with and without different MarshalAs directives with no success. ... It seems that the two-dimensional array is the problem. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: A real curve fitting problem
    ... Now I should fit the curve with a complex function which I have defined as a separate MATLAB function. ... Typically, X is a design matrix of predictor values, with one row for each value in Y and one column for each coefficient. ... X may be any array that MODELFUN is prepared to accept. ... So X can be anything, including a cell array that has a bunch of predictor stuff in it, or an empty, because you've used nested functions and don't need to have any predictor values passed explicitly. ...
    (comp.soft-sys.matlab)

Loading