Add 2 matrix and store result in a third one - Android java.lang

Android examples for java.lang:Math Matrix

Description

Add 2 matrix and store result in a third one

Demo Code


//package com.java2s;

public class Main {
    /**/*from   www  .j a va 2 s .  c o  m*/
     * Add 2 matrix and store result in a third one
     * 
     * @param dstM The destination matrix
     * @param dstOffset The destination matrix start offset
     * @param firstM The first matrix to add
     * @param firstOffset The first matrix start offset
     * @param secondM The first matrix to add
     * @param secondOffset The first matrix start offset
     */
    public static final void addM(final float[] dstM, final int dstOffset,
            final float[] firstM, final int firstOffset,
            final float[] secondM, final int secondOffset) {
        //android.util.Log.d(TAG,"add()");
        for (int i = firstOffset, j = secondOffset, k = dstOffset; i < firstM.length; i++, j++, k++) {
            dstM[k] = firstM[i] + secondM[j];
        }
    }
}

Related Tutorials