Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IDATT2003 Mappevurdering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Håvard Johannes Versto Daleng
IDATT2003 Mappevurdering
Commits
889c1173
Commit
889c1173
authored
1 year ago
by
Håvard Daleng
Browse files
Options
Downloads
Patches
Plain Diff
Created Matrix2x2-class.
parent
f1053aa2
No related branches found
No related tags found
1 merge request
!1
Merge master and main
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/edu/ntnu/stud/model/Matrix2x2.java
+52
-0
52 additions, 0 deletions
src/main/java/edu/ntnu/stud/model/Matrix2x2.java
with
52 additions
and
0 deletions
src/main/java/edu/ntnu/stud/model/Matrix2x2.java
0 → 100644
+
52
−
0
View file @
889c1173
package
edu.ntnu.stud.model
;
/**
* Class representing a 2x2 matrix.
*/
public
class
Matrix2x2
{
/**
* The a00 component of the matrix.
*/
private
double
a00
;
/**
* The a01 component of the matrix.
*/
private
double
a01
;
/**
* The a10 component of the matrix.
*/
private
double
a10
;
/**
* The a11 component of the matrix.
*/
private
double
a11
;
/**
* Create a new 2x2 matrix.
*
* @param a00 The a00 component of the matrix.
* @param a01 The a01 component of the matrix.
* @param a10 The a10 component of the matrix.
* @param a11 The a11 component of the matrix.
*/
public
Matrix2x2
(
double
a00
,
double
a01
,
double
a10
,
double
a11
)
{
this
.
a00
=
a00
;
this
.
a01
=
a01
;
this
.
a10
=
a10
;
this
.
a11
=
a11
;
}
/**
* Multiply the matrix by a vector., i.e. compute the product of the matrix and the vector.
*
* @return The a00 component of the matrix.
*/
public
Vector2D
multiply
(
Vector2D
v
)
{
return
new
Vector2D
(
a00
*
v
.
getX0
()
+
a01
*
v
.
getX1
(),
a10
*
v
.
getX0
()
+
a11
*
v
.
getX1
());
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment