Home | History | Annotate | Download | only in b_TensorEm
      1 /*
      2  * Copyright (C) 2008 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef bts_FLT16MAT2D_EM_H
     18 #define bts_FLT16MAT2D_EM_H
     19 
     20 /* ---- includes ----------------------------------------------------------- */
     21 
     22 #include "b_BasicEm/Basic.h"
     23 #include "b_BasicEm/Phase.h"
     24 #include "b_TensorEm/Int16Vec2D.h"
     25 #include "b_TensorEm/Flt16Vec2D.h"
     26 
     27 /* ---- related objects  --------------------------------------------------- */
     28 
     29 /* ---- typedefs ----------------------------------------------------------- */
     30 
     31 /* ---- constants ---------------------------------------------------------- */
     32 
     33 /* ---- object definition -------------------------------------------------- */
     34 
     35 /** 2d matrix with floating point */
     36 struct bts_Flt16Mat2D
     37 {
     38 
     39 	/* ---- private data --------------------------------------------------- */
     40 
     41 	/* ---- public data ---------------------------------------------------- */
     42 
     43 	/** xx component */
     44 	int16 xxE;
     45 
     46 	/** xy component */
     47 	int16 xyE;
     48 
     49 	/** yx component */
     50 	int16 yxE;
     51 
     52 	/** yy component */
     53 	int16 yyE;
     54 
     55 	/** point position */
     56 	int16 bbpE;
     57 };
     58 
     59 /* ---- associated objects ------------------------------------------------- */
     60 
     61 /* ---- external functions ------------------------------------------------- */
     62 
     63 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
     64 
     65 /** initializes matrix */
     66 void bts_Flt16Mat2D_init( struct bts_Flt16Mat2D* ptrA );
     67 
     68 /** destroys matrix */
     69 void bts_Flt16Mat2D_exit( struct bts_Flt16Mat2D* ptrA );
     70 
     71 /* ---- \ghd{ operators } -------------------------------------------------- */
     72 
     73 /** copy operator */
     74 void bts_Flt16Mat2D_copy( struct bts_Flt16Mat2D* ptrA, const struct bts_Flt16Mat2D* srcPtrA );
     75 
     76 /** equal operator */
     77 flag bts_Flt16Mat2D_equal( const struct bts_Flt16Mat2D* ptrA, const struct bts_Flt16Mat2D* srcPtrA );
     78 
     79 /* ---- \ghd{ query functions } -------------------------------------------- */
     80 
     81 /* ---- \ghd{ modify functions } ------------------------------------------- */
     82 
     83 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
     84 
     85 /* ---- \ghd{ exec functions } --------------------------------------------- */
     86 
     87 /** returns determinate of matrix; return bbp is  ptrA->bbpE * 2 */
     88 uint32 bts_Flt16Mat2D_det( const struct bts_Flt16Mat2D* ptrA );
     89 
     90 /** inverts matrix */
     91 void bts_Flt16Mat2D_invert( struct bts_Flt16Mat2D* ptrA );
     92 
     93 /** returns inverted matrix */
     94 struct bts_Flt16Mat2D bts_Flt16Mat2D_inverted( const struct bts_Flt16Mat2D* ptrA );
     95 
     96 /** creates identity matrix */
     97 struct bts_Flt16Mat2D bts_Flt16Mat2D_createIdentity( void );
     98 
     99 /** creates rotation matrix */
    100 struct bts_Flt16Mat2D bts_Flt16Mat2D_createRotation( phase16 angleA );
    101 
    102 /** creates scale matrix */
    103 struct bts_Flt16Mat2D bts_Flt16Mat2D_createScale( int32 scaleA, int32 scaleBbpA );
    104 
    105 /** creates rigid matrix (scale & rotation) */
    106 struct bts_Flt16Mat2D bts_Flt16Mat2D_createRigid( phase16 angleA, int32 scaleA, int32 scaleBbpA );
    107 
    108 /** creates matrix from 16 bit values */
    109 struct bts_Flt16Mat2D bts_Flt16Mat2D_create16( int16 xxA, int16 xyA, int16 yxA, int16 yyA, int16 bbpA );
    110 
    111 /** creates matrix from 32 bit values (automatic adjustment of bbp value) */
    112 struct bts_Flt16Mat2D bts_Flt16Mat2D_create32( int32 xxA, int32 xyA, int32 yxA, int32 yyA, int32 bbpA );
    113 
    114 /** scales matrix by a factor */
    115 void bts_Flt16Mat2D_scale( struct bts_Flt16Mat2D* ptrA, int32 scaleA, int32 scaleBbpA );
    116 
    117 /** multiplies matrix with vecA; returns resulting vector */
    118 struct bts_Int16Vec2D bts_Flt16Mat2D_map( const struct bts_Flt16Mat2D* matPtrA,
    119 								          const struct bts_Int16Vec2D* vecPtrA );
    120 
    121 /** Multiplies matrix with float vecA; returns resulting vector. */
    122 struct bts_Flt16Vec2D bts_Flt16Mat2D_mapFlt( const struct bts_Flt16Mat2D* matPtrA,
    123 								             const struct bts_Flt16Vec2D* vecPtrA );
    124 
    125 /** multiplies matrix with matA; returns resulting matrix */
    126 struct bts_Flt16Mat2D bts_Flt16Mat2D_mul( const struct bts_Flt16Mat2D* mat1PtrA,
    127 								          const struct bts_Flt16Mat2D* mat2PtrA );
    128 
    129 /** multiplies matrix with matA; returns pointer to resulting matrix */
    130 struct bts_Flt16Mat2D* bts_Flt16Mat2D_mulTo( struct bts_Flt16Mat2D* mat1PtrA,
    131 				                             const struct bts_Flt16Mat2D* mat2PtrA );
    132 
    133 #endif /* bts_FLT16MAT2D_EM_H */
    134 
    135