This repository contains a Java project for performing operations on complex matrices. The project is structured into several classes, each responsible for different aspects of handling and manipulating complex numbers and matrices. The main functionalities include creating complex matrices, performing arithmetic operations, and handling complex number arithmetic.
- Complex Number Operations: Basic operations on complex numbers such as addition, subtraction, multiplication, and division.
- Complex Matrix Operations: Creation and manipulation of matrices with complex numbers including matrix addition, subtraction, multiplication, and scalar operations.
- Utility Methods: Helper methods to facilitate complex number and matrix operations.
- Input Handling: Reading complex matrices from input files and processing them.
src/
├── TComplejo.java
├── TOperaComplejos.java
├── TMatrizCompleja.java
├── TOpMatricesComplejas.java
└── MatricesComplejas.java
This class defines the structure and basic operations for complex numbers. It includes methods for addition, subtraction, multiplication, and division of complex numbers.
public class TComplejo {
private double real;
private double imag;
public TComplejo(double real, double imag) {
this.real = real;
this.imag = imag;
}
public TComplejo add(TComplejo c) {
return new TComplejo(this.real + c.real, this.imag + c.imag);
}
public TComplejo subtract(TComplejo c) {
return new TComplejo(this.real - c.real, this.imag - c.imag);
}
// Other operations...
}
This class provides additional operations for complex numbers, possibly including utility functions that extend the basic arithmetic operations provided in TComplejo.java
.
This class represents a matrix with complex numbers. It includes methods to perform matrix-specific operations such as addition, subtraction, and multiplication.
public class TMatrizCompleja {
private TComplejo[][] data;
public TMatrizCompleja(int rows, int cols) {
data = new TComplejo[rows][cols];
}
public TMatrizCompleja add(TMatrizCompleja m) {
// Implementation for matrix addition
}
public TMatrizCompleja multiply(TMatrizCompleja m) {
// Implementation for matrix multiplication
}
// Other matrix operations...
}
This class likely provides additional operations for complex matrices, complementing the basic operations defined in TMatrizCompleja.java
.
This is the main class that coordinates the complex matrix operations, possibly including reading inputs, initializing matrices, and invoking operations.
public class MatricesComplejas {
public static void main(String[] args) {
// Initialize matrices and perform operations
TMatrizCompleja matrix1 = new TMatrizCompleja(3, 3);
TMatrizCompleja matrix2 = new TMatrizCompleja(3, 3);
TMatrizCompleja result = matrix1.add(matrix2);
// Output the result...
}
}
- Clone the repository
git clone https://github.com/yourusername/ComplexMatrixOperations.git
- Navigate to the project directory:
cd ComplexMatrixOperations
- Compile the Java files:
javac src/*.java
- Run the main class:
java src/MatricesComplejas
The input file ENTRADAS MATRICES COMPLEJAS.txt
contain the matrices to be processed. Each matrix is represented by its elements, where each complex number is specified in the format (real, imaginary).
3
3
3
2
3
5
2
1
-4
2
5
4
6
...