I just started Linear Algebra for my programming degree and to full understand everything I want to put it into code and make my own "matrix calculator." I have all the theory but I am having issues keeping the matrix variable and moving it around the class' functions to create it and output it. Once I know I have it saved I think I can get the addition/multiplication to work. Here is the code I have so far:
#include <string>
#include <iostream>
using namespace std;
class matrix {
I just want to know the code of the program: Write code to accept matrix as aurgument and display its multiplication matrix which return its multiplication matrix.
I am trying to read two matrices from individual .txt file, and later trying to multiply them. But I am unable to succeed.
Here is the code.
#include<stdio.h> #include<stdlib.h> #include<stdbool.h> // Here starts the main int main() { // The two input values FILE *inputFile1; FILE *inputFile2;
[Code] .....
I am able to get only the first values as the output. The first matrix is 5x3, and the second one is a 3x3 matrix.
Matrix 1 1 2 3 4 5 6 7 8 9 10 11 12
Matrix 2 1 2 3 4 5 6 7 8 9
The output which I am getting is
Enter File name of matrix #1 - with extention - : matrix1.txt Enter File name of matrix #2 - with extention - : matrix2.txt Rows1 = 1 Cols1 = 2 Rows2 = 1 Cols2 = 2Cant multiply those two matrices
I am writing a brute force implementation of matrix multiplication:
Header file:
vector<vector<int> > matrix_multiplication(vector <vector<int> >& a, vector <vector<int> >& B)/>/>/>;
Source file:
vector<vector<int> > matrix_multiplication(vector <vector<int> >& a, vector <vector<int> >& B)/>/>/>{ int n = a.size(); vector< vector <int> > c (n , vector<int> (n)); for (int i =0 ; i<n ; i++){ for (int j =0 ; j < n ; j++){ for (int k ; k < n ; k++){ c[i][j] = a[i][k] + b[k][j];
[Code] ....
I keep on getting occasional seg faults />/>. I can't see why.
I am actually working on IEEE Arithmetic especially the IEEE 754 specification where the IEEE double only have 53 bits of precision. I am working on Z/nZ matrix multiplication that works on 53 bits specs. How to write a matrix multiplication algorithm that works well on 53 bits IEEE precision standard.
I've been trying to get my matrix multiplication program to run a few different ways. My assignments wants me to run it statically using chunks, but we're not supposed to use OpenMPs scheduler. So I'm not sure how that's possible. And secondly, we have to run it dynamically using locks/unlocks.
I wrote program for Sequential matrix multiplication .But after execution for any input value( ex. 100,150,400) it shows the execution time is 0.000 msec.
#include <stdio.h> #include <math.h> #include <sys/time.h> void print_results(char *prompt, int N, float *a); int main(int argc, char *argv[])
This code is for a member function called Triangle. It's a Draw() function that uses border characters and fill characters. I've been trying to work it out in a seperate file just so I can get it to work before I add it to my function definition.
#include <iostream> using namespace std; int main() { for(int i=1; i<=8; i++) { for(int sp=1; sp<=8-i; sp++) {
[code]....
I haven't attempted the fill characters (well... I have, but it was so wrong it was ridiculous). I need to get rid of the extra '*' at the very top. Here's an example of what this should look like...
I have made a Biginteger class that performs multiplication operation according to Karatsuba's algorithm. But it seems that the code is not working perfectly.In the class I have made a function named karatsuba(BigInteger a1, BigInteger b1)that performs the Multilplication operation. There might be problems in this function as I have tried to store the original digits(neglecting the leading zeros) of the two big integer values into two integers or there might be problems in somewhere else. corrected version of this function? My code is given below:
I have made a Biginteger class that performs multiplication operation according to Karatsuba's algorithm. But it seems that the code is not working perfectly.In the class I have made a function named karatsuba(BigInteger a1, BigInteger b1)that performs the Multilplication operation. There might be problems in this function as I have tried to store the original digits(neglecting the leading zeros) of the two big integer values into two integers or there might be problems in somewhere else.My code is given below:
i need the output to display the product of every whole number from 1-3 in a table format.
this is the code i have so far. i know some brackets are missing but i just pasted the meat of the code. when i run the program i keep getting the number 1 displayed in a straight line going on forever
Write a program that prints a multiplication table using nested loops. In main ask the user for the smallest column number , the largest column number and the size of the increment. Ask the user for the same information for the row values.
In the example the column values entered are: 5, 15 and 2 and the row values 3, 6 and 1.
Given those numbers you would generate the following table.
Multiplication Table | 5 7 9 11 13 15 ___|___________________________________ | 3 | 15 21 27 33 39 45 4 | 20 28 36 44 52 60 5 | 25 35 45 55 65 75 6 | 30 42 54 66 78 90 Print the 24 values with the grey background. The other numbers show the values to be multiplied.
Code: #include<stdio.h> main() { int a,b,c,d,e,f; int i,j,total; printf("Please enter smallest column number: "); scanf("%i",&a); printf("
[Code] ....
Challenge: As an added challenge try to print out the column headings (5 7 9 11 13 15) and the row headings (3 4 5 6)