This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//These are two functions which aid in raising a matrix data[][] to the power n using fast exponentiation techniques. | |
/* | |
Prerequisites: | |
// The matrix must be a 2x2 matrix. | |
1. data[2][2] ->The matrix which is required to be raised to nth power | |
2. result[2][2] ->Initially make it equal to a 2x2 identity matrix.This matrix contains the required result. | |
3. n -> The exponent | |
4. Also include --> #define ll long long int | |
5. Also include --> #define mod_12 1000000007 | |
<--- Note-All the above variables must be global ---> |