PINE LIBRARY

Matrix_Functions_Lib_JD

Library "Matrix_Functions_Lib_JD"

This is a library to add matrix / 2D array functionality to Pinescript.
once you import the library at the beginning of your script, you can add all the functions described below just by calling them like you do any other built'in function.

Enjoy,
Gr, JD.

PS. if you find functionality or calculation errors in the functions, please let me know, so I can fix them.
There are quite a lot of functions, so little mishaps may have slipped in! ;-)

get_nr_of_rows() Returns the number of rows from a 2D matrix

get_nr_of_columns() Returns the number of columns from a 2D matrix

get_size() Returns a tuple with the total number of rows and columns from a 2D matrix

init() 2D matrix init function, builds a 2D matrix with dimensional metadata in first two values and fills it with a default value, the body of the actual matrix data starts at index 2.

from_list() 2D matrix init function, builds a 2D matrix from an existing array by adding dimensional metadata in first two values, the body of the actual matrix data consists of the data of the source array and starts at index 2.

set() Sets values in 2D matrix with (row index, column index) (index for rows and columns both starts at 0 !!)

fill_val() Fills all elements in a 2D matrix with a value

randomize() Fills a 2D matrix with random values//

get() Gets values from 2D matrix with (row index, column index) (index for rows and columns both starts at 0 !!)

copy_slice_body() Cuts off the metadata header and returns the array body, WITHOUT THE DIMENSIONAL METADATA!!
do_slice This variable should be set as: - 'false' to only make a copy, changes to the new array copy will NOT ALTER the ORIGINAL - 'true' to make a slice, changes to the new array slice WILL(!) ALTER the ORIGINAL

get_record() Gets /retrieve the values from a ROW/RECORD from a certain row/lookback period, the values are returned as an array

get_row_index() Gets the row nr. in a 2D matrix from 1D index (index for rows and columns both starts at 0 !!)

get_column_index() Gets the column nr. in a 2D matrix from 1D index (index for rows and columns both starts at 0 !!)

get_row_column_index() Gets a tuple with the (row, column) coordinates in 2D matrix from 1D index (index starts at 0 and does not include the header!!)

get_array_index() Gets the 1D index from (row, column) coordinates in 2D matrix (index for row and column both starts at 0 !! Index starts at 0 and does not include the header!!)

remove_rows() Removes one or more rows/records from a 2D matrix (if from_row = to_row, only this row is removed)

remove_columns() Remove one or more columns from a 2D matrix (if from_column = to_column, only this column is removed)

insert_array_of_rows() Insert an array of rows/records at a certain row number in a 2D matrix

add_row() ADDS a ROW/RECORD on the TOP of a sheet, shift the whole list one down and gives the option to REMOVE the OLDEST row/record. (2D version of "unshift" + "pop" but with a whole row at once)

insert_array_of_columns() Insert an array of columns at a certain column number in a 2D matrix

append_array_of_rows() Appends/adds an array of rows/records to the bottom of a 2D matrix

append_array_of_columns() Appends/adds an array of columns to the right side of a 2D matrix

pop_row() Removes / pops and returns the last row/record from a 2D matrix.

pop_column() Removes / pops and returns the last (most right) column from a 2D matrix.

replace()

abs()

add_value() Returns a new matrix with the same value added to all the elements of the source matrix.

addition() Returns a new matrix with the of the elements of one 2D matrix added to every corresponding element of a source 2D matrix.

subtract_value() Returns a new matrix with the same value subtracted from every element of a 2D matrix

subtraction() Returns a new matrix with the values of the elements of one 2D matrix subtracted from every corresponding element of a source 2D matrix.

scalar_multipy() Returns a new matrix with all the elements of the source matrix scaled/multiplied by a scalar value.

transpose() Returns a new matrix with the elements of the source matrix transposed.

multiply_elem() Performs ELEMENT WISE MULTIPLICATION of 2D matrices, returns a new matrix c.

multiply() Performs DOT PROCUCT MULTIPLICATION of 2D matrices, returns a new matrix c.

determinant_2x2() Calculates the determinant of 2x2 matrices.

determinant_3x3() Calculates the determinant of 3x3 matrices.

determinant_4x4() Calculates the determinant of 4x4 matrices.

print() displays a 2D matrix in a table layout.
arraysstatisticstechindicator

파인 라이브러리

진정한 TradingView 정신에 따라, 저자는 이 파인 코드를 다른 파인 프로그래머들이 재사용할 수 있도록 오픈 소스 라이브러리로 공개했습니다. 저자에게 박수를 보냅니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈 소스 출판물에서 사용할 수 있지만, 이 코드를 출판물에서 재사용하는 것은 하우스 룰에 의해 관리됩니다.


Disclaimer.
I AM NOT A FINANCIAL ADVISOR.
THESE IDEAS ARE NOT ADVICE AND ARE FOR EDUCATION PURPOSES ONLY.
ALWAYS DO YOUR OWN RESEARCH!
JD.

You can contact me for info/access in PM or on Telegram: @jduyck
PLS, DON'T ASK FOR ACCESS IN THE COMMENT SECTION!
또한 다음에서도:

면책사항