3

Multilinear function is such that it is linear with respect to each variable. For example, x1+x2x1-x4x3 is a multilinear function. Working with them requires proper data-structure and algrorihms for fast assignment, factorization and basic aritmetics.

Does there exist some library for processing multilinear function in Matlab?

2
  • 1
    A quick search of the documentation for 'multilinear' turns up entries only in the Statistics Toolbox. Forgive me if I'm wrong, but isn't this just a special case of linear algebra, which MATLAB is pretty good at anyway?
    – wakjah
    Mar 22, 2013 at 12:40
  • 2
    @wakjah - Sorry, but not at all. That is like saying graph theory is what we use when we do a scatter plot. Yes, the functions are linear in a sense, and algebra is somewhat involved. But linear algebra is a very special area of study that does not interact with the question.
    – user85109
    Mar 22, 2013 at 20:18

1 Answer 1

1

No, not that much so.

For example, interp2 an interpn have 'linear' methods, which are effectively as you describe. But that is about the limit of what is supplied. And there is nothing for more general functions of this form.

Anyway, this class of functions has some significant limitations. For example, as applied to color image processing, they are often a terribly poor choice because of what they do to neutrals in your image. Other functional forms are strongly preferred there.

Of course, there is always the symbolic toolbox for operations such as factorization, etc., but that tool is not a speed demon.

Edit: (other functional forms)

I'll use a bilinear form as the example. This is the scheme that is employed by tools like Photoshop when bilinear interpolation is chosen. Within the square region between a group of four pixels, we have the form

f(x,y) = f_00*(1-x)*(1-y) + f_10*x*(1-y) + f_01*(1-x)*y + f_11*x*y

where x and y vary over the unit square [0,1]X[0,1]. I've written it here as a function parameterized by the values of our function at the four corners of the square. Of course, those values are given in image interpolation as the pixel values at those locations.

As has been said, the bilinear interpolant is indeed linear in x and in y. If you hold either x or y fixed, then the function is linear in the other variable.

An interesting question is what happens along the diagonal of the unit square? Thus, as we follow the path between points (0,0) and (1,1). Since x = y along this path, substitute x for y in that expression, and expand.

f(x,x) = f_00*(1-x)*(1-x) + f_10*x*(1-x) + f_01*(1-x)*x + f_11*x*x
       = (f_11 + f_00 - f_10 - f_01)*x^2 + (f_10 + f_01 - 2*f_00)*x + f_00

So we end up with a quadratic polynomial along the main diagonal. Likewise, had we followed the other diagonal, it too would have been quadratic in form. So despite the "linear" nature of this beast, it is not truly linear along any linear path. It is only linear along paths that are parallel to the axes of the interpolation variables.

In three dimensions, which is where we really care about this behavior for color space interpolation, that main diagonal will now show a cubic behavior along that path, despite that "linear" name for the function.

Why are these diagonals important? What happens along the diagonal? If our mapping takes colors from an RGB color space to some other space, then the neutrals in your image live along the path R=G=B. This is the diagonal of the cube. The problem is when you interpolate an image with a neutral gradient, you will see a gradient in the result after color space conversion that moves from neutral to some non-neutral color as the gradient moves along the diagonal through one cube after another. Sadly, the human eye is very able to see differences from neutrality, so this behavior is critically important. (By the way, this is what happens inside the guts of your color ink jet printer, so people do care about it.)

The alternative chosen is to dissect the unit square into a pair of triangles, with the shared edge along that main diagonal. Linear interpolation now works inside a triangle, and along that edge, the interpolant is purely a function of the endpoints of that shared edge.

In three dimensions, the same thing happens, except we use a dissection of the unit cube into SIX tetrahedra, all of which share the main diagonal of the cube. The difference is indeed critically important, with a dramatic reduction in the deviation of your neutral gradients from neutrality. As it turns out, the eye is NOT so perceptive to deviations along other gradients, so the loss along other paths does not hurt nearly so much. It is neutrals that are crucial, and the colors we must reproduce as accurately as possible.

So IF you do color space interpolation using mappings defined by what are commonly called 3-d lookup tables, this is the agreed way to do that interpolation (agreed upon by the ICC, an acronym for the International Color Consortium.)

3
  • Can you clarify the statement "Other function forms are strongly preferred here." with perhaps some examples?
    – hhh
    Mar 22, 2013 at 13:46
  • 1
    That would get long if I start giving examples, because I would then need to explain why they are preferred. I'll see what I can do.
    – user85109
    Mar 22, 2013 at 19:39
  • One thing I cannot understand here is how you implement the different operations such as the translation. Now homogenous coordinates (p.8 here) can for example turn translation into a simple matrix product where you introduce a new dummy dimension. This makes sense because then matrix-product would be sufficient achieve most of the operations -- I haven't yet considered how to achieve the factorization: it could be done somehow with the data-structure perhaps by ordering different factors, ideas?
    – hhh
    Mar 23, 2013 at 0:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.